feat(map): reverse geocode location + recenter button on dashboard and history

- Dashboard: recenter button in GPS card header (hidden until first fix)
- Dashboard: estimated location name under lat/lon via Nominatim reverse geocode (throttled 30s)
- History: recenter button fits map back to trip bounds
- Both buttons use crosshairs icon, hidden until data is available

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Mathieu Moran
2026-08-10 02:43:23 -04:00
co-authored by Copilot
parent 08a3bef558
commit f1145a4dbb
4 changed files with 63 additions and 10 deletions
+9
View File
@@ -21,6 +21,7 @@
let replayPoints = [];
let replayTimer = null;
let replayController = null;
const recenterBtn = document.getElementById("btn-recenter-history");
function formatDuration(seconds) {
const hours = Math.floor(seconds / 3600);
@@ -132,6 +133,14 @@
} else if (coordinates.length === 1) {
map.setView(coordinates[0], 15);
}
recenterBtn.hidden = false;
recenterBtn.onclick = function () {
if (coordinates.length > 1) {
map.fitBounds(routeLayer.getBounds(), { padding: [24, 24] });
} else if (coordinates.length === 1) {
map.setView(coordinates[0], 15);
}
};
summary.textContent = `${formatDistance(result.trip.distance_km)} · `
+ `${formatDuration(result.trip.duration_seconds)} · `
+ `avg ${formatSpeed(result.trip.average_speed_kmh)} · `