feat: button thing

This commit is contained in:
2025-10-23 18:11:30 +02:00
parent b64ec35ec2
commit 69767d0172

13
app.js
View File

@ -158,6 +158,7 @@ function addSightMarker(sight, number) {
// Create popup content for markers
function createPopupContent(sight) {
const icon = categoryIcons[sight.category] || "📍";
const isSelected = selectedSights.has(sight.id);
return `
<div class="popup-content">
<h4>${icon} ${sight.name}</h4>
@ -165,6 +166,10 @@ function createPopupContent(sight) {
<p><strong>Admission:</strong> ${sight.admission}</p>
<p><strong>Hours:</strong> ${sight.hours}</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>
</div>
`;
@ -278,7 +283,13 @@ function toggleSightSelection(sightId) {
} else {
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();
renderSightsList(getCurrentFilter(), getCurrentSearch());
}