feat: button thing
This commit is contained in:
11
app.js
11
app.js
@ -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>
|
||||
`;
|
||||
@ -279,6 +284,12 @@ function toggleSightSelection(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();
|
||||
renderSightsList(getCurrentFilter(), getCurrentSearch());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user