diff --git a/static/index.html b/static/index.html index af9008a..8d76f3a 100644 --- a/static/index.html +++ b/static/index.html @@ -889,10 +889,17 @@ function updateSummary() { document.getElementById('bulkBtn').style.display = gps > 0 ? 'block' : 'none'; } +function updateFilterChips() { + const chipMap = { all: 'All', gps: '📍 GPS', nogps: '⚠️ No GPS' }; + document.querySelectorAll('.filter-chip').forEach(c => c.classList.remove('active')); + const target = Array.from(document.querySelectorAll('.filter-chip')) + .find(c => c.textContent.trim() === chipMap[currentFilter]); + if (target) target.classList.add('active'); +} + function setFilter(f) { currentFilter = f; - document.querySelectorAll('.filter-chip').forEach(c => c.classList.remove('active')); - event.target.classList.add('active'); + updateFilterChips(); renderGallery(); } @@ -901,6 +908,9 @@ function renderGallery() { if (currentFilter === 'gps') filtered = allPhotos.filter(p => p.hasGps); else if (currentFilter === 'nogps') filtered = allPhotos.filter(p => !p.hasGps); + // Sync filter chip visual state with currentFilter + updateFilterChips(); + const gallery = document.getElementById('gallery'); gallery.innerHTML = filtered.map(p => { const idx = allPhotos.indexOf(p); @@ -1330,6 +1340,11 @@ function resetAll() { allPhotos = []; selectedIdx = -1; currentFilter = 'all'; + // Reset filter chips to default state + document.querySelectorAll('.filter-chip').forEach(c => c.classList.remove('active')); + const allChip = Array.from(document.querySelectorAll('.filter-chip')) + .find(c => c.textContent.trim() === 'All'); + if (allChip) allChip.classList.add('active'); bulkData = []; if (bulkMap) { bulkMap.remove(); bulkMap = null; } document.getElementById('fileInput').value = '';