diff --git a/static/map.js b/static/map.js
index 820ae2a..f640371 100644
--- a/static/map.js
+++ b/static/map.js
@@ -255,6 +255,29 @@
rebuildMarkers();
});
+ // ── Locate-me button ───────────────────────────────────
+ var locateBtn = document.getElementById('locate-btn');
+ if (locateBtn) {
+ locateBtn.addEventListener('click', function () {
+ if (!navigator.geolocation) return;
+ navigator.geolocation.getCurrentPosition(function (pos) {
+ var latlng = [pos.coords.latitude, pos.coords.longitude];
+ map.setView(latlng, 14);
+ if (locateMarker) {
+ locateMarker.setLatLng(latlng);
+ } else {
+ var dotIcon = L.divIcon({
+ html: '
',
+ className: '',
+ iconSize: [20, 20],
+ iconAnchor: [10, 10],
+ });
+ locateMarker = L.marker(latlng, { icon: dotIcon, pane: 'locatePane' }).addTo(map);
+ }
+ });
+ });
+ }
+
// ── Mobile filter panel toggle ─────────────────────────
var filterToggle = document.getElementById('filter-toggle');
var sliderPanel = document.getElementById('slider-panel');
@@ -284,44 +307,11 @@
try {
// Create map and cluster group now that the DOM is ready.
map = L.map('map', { zoomControl: false }).setView([46.8, -71.2], 7);
+ map.createPane('locatePane').style.zIndex = 650;
L.control.zoom({ position: 'topright' }).addTo(map);
-
- // ── Locate-me control ──────────────────────────────────
- var LocateControl = L.Control.extend({
- options: { position: 'bottomright' },
- onAdd: function () {
- var container = L.DomUtil.create('div', 'leaflet-bar leaflet-control');
- var btn = L.DomUtil.create('a', '', container);
- btn.href = '#';
- btn.title = 'Ma position';
- btn.setAttribute('role', 'button');
- btn.setAttribute('aria-label', 'Ma position');
- btn.innerHTML = '';
- L.DomEvent.on(btn, 'click', function (e) {
- L.DomEvent.preventDefault(e);
- if (!navigator.geolocation) return;
- navigator.geolocation.getCurrentPosition(function (pos) {
- var latlng = [pos.coords.latitude, pos.coords.longitude];
- map.setView(latlng, 14);
- if (locateMarker) {
- locateMarker.setLatLng(latlng);
- } else {
- locateMarker = L.circleMarker(latlng, {
- radius: 10,
- color: '#fff',
- weight: 3,
- fillColor: '#2563eb',
- fillOpacity: 1,
- }).addTo(map);
- }
- });
- });
- return container;
- },
- });
- new LocateControl().addTo(map);
+ var lastUpdatedText = (document.getElementById('last-updated') || {}).textContent || '';
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
- attribution: '© OpenStreetMap | Données: Régie de l\'énergie du Québec',
+ attribution: '© OpenStreetMap | Données: Régie de l\'énergie du Québec' + (lastUpdatedText ? ' | ' + lastUpdatedText : ''),
maxZoom: 18,
}).addTo(map);
diff --git a/static/style.css b/static/style.css
index 0e92119..5ac2a89 100644
--- a/static/style.css
+++ b/static/style.css
@@ -128,15 +128,54 @@ html, body { height: 100%; margin: 0; padding: 0; }
font-size: 10px; color: var(--muted-foreground);
}
-#last-updated {
- position: absolute; bottom: 24px; right: 8px;
- padding: 5px 10px;
- z-index: 1000; font-size: 11px;
- color: var(--muted-foreground);
-}
-
.pin-icon { filter: drop-shadow(0 1px 3px rgba(0,0,0,0.35)); }
+#locate-btn {
+ position: absolute; bottom: 34px; right: 8px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 30px;
+ height: 30px;
+ padding: 0;
+ border: 1px solid var(--border);
+ border-radius: 6px;
+ background: var(--card);
+ color: var(--card-foreground);
+ box-shadow: 0 2px 8px rgba(0,0,0,0.15);
+ cursor: pointer;
+ z-index: 1000;
+}
+#locate-btn:hover { background: var(--muted); }
+
+/* Locate-me blue dot + pulse ring */
+.locate-dot {
+ position: relative;
+ width: 20px;
+ height: 20px;
+}
+.locate-dot-inner {
+ position: absolute;
+ inset: 4px;
+ border-radius: 50%;
+ background: #2563eb;
+ border: 2.5px solid #fff;
+ box-shadow: 0 1px 4px rgba(0,0,0,0.4);
+ z-index: 1;
+}
+.locate-dot-pulse {
+ position: absolute;
+ inset: 0;
+ border-radius: 50%;
+ background: #2563eb;
+ opacity: 0.35;
+ animation: locate-pulse 1.8s ease-out infinite;
+}
+@keyframes locate-pulse {
+ 0% { transform: scale(0.6); opacity: 0.5; }
+ 100% { transform: scale(2.2); opacity: 0; }
+}
+
.cluster-info-tip {
position: relative;
display: inline-flex;
diff --git a/templates/map.html b/templates/map.html
index 66636dd..bcd1521 100644
--- a/templates/map.html
+++ b/templates/map.html
@@ -66,7 +66,10 @@
- {{.LastUpdated}}
+
+ {{.LastUpdated}}