Add an offline-data status dot to the topbar
Small green/gray indicator reusing the existing /api/offline-tiles check, showing at a glance whether this server has offline map data. Closes out the top banner TODO item — DEM elevation and a hamburger menu are intentionally left out (no DEM layer yet, and the sidebar isn't mobile-collapsed).
This commit is contained in:
1 parent
53b0e8961b
commit
8ca5ca9bc1
4 files changed
+18
-1
No files matched your search
@@ -442,6 +442,7 @@ function applyStyle(name) {
|
||||
// the Online/Offline switch itself doesn't make sense (there's nothing to
|
||||
// switch to), so it's removed entirely rather than left sitting there
|
||||
// offering a choice that can't work.
|
||||
const offlineStatus = document.querySelector(".topbar__offline-status");
|
||||
fetch("/api/offline-tiles")
|
||||
.then((response) => response.json())
|
||||
.then(({ available }) => {
|
||||
@@ -451,6 +452,9 @@ fetch("/api/offline-tiles")
|
||||
layerToggle.remove();
|
||||
map.removeControl(mapLayersButton);
|
||||
}
|
||||
offlineStatus.hidden = false;
|
||||
offlineStatus.classList.toggle("topbar__offline-status--ready", available);
|
||||
offlineStatus.title = available ? "Offline map data ready" : "No offline map data on this server";
|
||||
})
|
||||
.catch(() => {
|
||||
// Backend check failed; keep the online style and leave the switch as
|
||||
|
||||
Reference in new issue
Block a user