From 65089f6cd4d0c6835225a4d76006827038a22f13 Mon Sep 17 00:00:00 2001 From: Gwadaking Date: Tue, 14 Apr 2026 17:52:41 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20status=20200=20+=20bandeau=20avertisseme?= =?UTF-8?q?nt=20donn=C3=A9es=20p=C3=A9rim=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- backend/src/Controller/StatusController.php | 2 +- frontend/src/components/Map/SargassesMap.css | 16 ++++++++++++++++ frontend/src/components/Map/SargassesMap.jsx | 10 +++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/backend/src/Controller/StatusController.php b/backend/src/Controller/StatusController.php index 2f14bf0..aad0bbb 100644 --- a/backend/src/Controller/StatusController.php +++ b/backend/src/Controller/StatusController.php @@ -63,6 +63,6 @@ class StatusController extends AbstractController 'finishedAt' => $job['processed_at'], 'retryCount' => (int) $job['retry_count'], ] : null, - ], $healthy ? 200 : 503); + ]); } } diff --git a/frontend/src/components/Map/SargassesMap.css b/frontend/src/components/Map/SargassesMap.css index fdf2e5d..e2e6bbc 100644 --- a/frontend/src/components/Map/SargassesMap.css +++ b/frontend/src/components/Map/SargassesMap.css @@ -31,6 +31,22 @@ z-index: 10; } +/* ── Avertissement données périmées ── */ +.smap-stale { + position: absolute; + bottom: max(52px, calc(52px + env(safe-area-inset-bottom))); + left: max(10px, calc(10px + env(safe-area-inset-left))); + background: rgba(251, 191, 36, 0.92); + backdrop-filter: blur(4px); + border-radius: 6px; + padding: 4px 10px; + font-size: 11px; + color: #78350f; + font-weight: 600; + pointer-events: none; + z-index: 10; +} + /* NavigationControl MapLibre — remonte au-dessus de la barre Android */ .maplibregl-ctrl-bottom-right { bottom: env(safe-area-inset-bottom) !important; diff --git a/frontend/src/components/Map/SargassesMap.jsx b/frontend/src/components/Map/SargassesMap.jsx index 4c4f2d9..444e45b 100644 --- a/frontend/src/components/Map/SargassesMap.jsx +++ b/frontend/src/components/Map/SargassesMap.jsx @@ -189,6 +189,7 @@ export default function SargassesMap({ onSpotSelect, selectedSpotId, activeStep, const [layerOpacity, setLayerOpacity] = useState(1); const [mapStyle, setMapStyle] = useState(null); // null = style not yet ready const [dataDate, setDataDate] = useState(null); + const [dataStale, setDataStale] = useState(false); // true = données > 6h const tilesOrigin = window.location.origin; @@ -199,8 +200,9 @@ export default function SargassesMap({ onSpotSelect, selectedSpotId, activeStep, if (s.lastObservation?.detectedAt) { setDataDate(new Date(s.lastObservation.detectedAt)); } + setDataStale(!s.healthy); }) - .catch(() => {}); + .catch(() => setDataStale(true)); }, []); // Load cartoon map style once — map is only mounted when style is ready, @@ -283,6 +285,12 @@ export default function SargassesMap({ onSpotSelect, selectedSpotId, activeStep, )} + {dataStale && ( +
+ Satellite en attente — données possiblement périmées +
+ )} + {activeStep === 'now' && (