feat: button thing
This commit is contained in:
13
app.js
13
app.js
@ -158,6 +158,7 @@ function addSightMarker(sight, number) {
|
|||||||
// Create popup content for markers
|
// Create popup content for markers
|
||||||
function createPopupContent(sight) {
|
function createPopupContent(sight) {
|
||||||
const icon = categoryIcons[sight.category] || "📍";
|
const icon = categoryIcons[sight.category] || "📍";
|
||||||
|
const isSelected = selectedSights.has(sight.id);
|
||||||
return `
|
return `
|
||||||
<div class="popup-content">
|
<div class="popup-content">
|
||||||
<h4>${icon} ${sight.name}</h4>
|
<h4>${icon} ${sight.name}</h4>
|
||||||
@ -165,6 +166,10 @@ function createPopupContent(sight) {
|
|||||||
<p><strong>Admission:</strong> ${sight.admission}</p>
|
<p><strong>Admission:</strong> ${sight.admission}</p>
|
||||||
<p><strong>Hours:</strong> ${sight.hours}</p>
|
<p><strong>Hours:</strong> ${sight.hours}</p>
|
||||||
<p><strong>Duration:</strong> ${sight.visit_duration}</p>
|
<p><strong>Duration:</strong> ${sight.visit_duration}</p>
|
||||||
|
<label class="checkbox-wrapper" style="margin: 8px 0; display: block;">
|
||||||
|
<input type="checkbox" ${isSelected ? 'checked' : ''} onchange="toggleSightSelection(${sight.id})">
|
||||||
|
<span>Add to my route</span>
|
||||||
|
</label>
|
||||||
<button onclick="openSightModal(${sight.id})" class="btn btn--primary btn--sm">More Details</button>
|
<button onclick="openSightModal(${sight.id})" class="btn btn--primary btn--sm">More Details</button>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
@ -278,7 +283,13 @@ function toggleSightSelection(sightId) {
|
|||||||
} else {
|
} else {
|
||||||
selectedSights.add(sightId);
|
selectedSights.add(sightId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update the popup content for this sight's marker
|
||||||
|
const marker = markers.find(m => m.sightData && m.sightData.id === sightId);
|
||||||
|
if (marker) {
|
||||||
|
marker.setPopupContent(createPopupContent(marker.sightData));
|
||||||
|
}
|
||||||
|
|
||||||
updateRouteDisplay();
|
updateRouteDisplay();
|
||||||
renderSightsList(getCurrentFilter(), getCurrentSearch());
|
renderSightsList(getCurrentFilter(), getCurrentSearch());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user