fix: status 200 + bandeau avertissement données périmées

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gwadaking
2026-04-14 17:52:41 -04:00
parent 2a4c92dc03
commit 65089f6cd4
3 changed files with 26 additions and 2 deletions

View File

@@ -63,6 +63,6 @@ class StatusController extends AbstractController
'finishedAt' => $job['processed_at'], 'finishedAt' => $job['processed_at'],
'retryCount' => (int) $job['retry_count'], 'retryCount' => (int) $job['retry_count'],
] : null, ] : null,
], $healthy ? 200 : 503); ]);
} }
} }

View File

@@ -31,6 +31,22 @@
z-index: 10; 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 */ /* NavigationControl MapLibre — remonte au-dessus de la barre Android */
.maplibregl-ctrl-bottom-right { .maplibregl-ctrl-bottom-right {
bottom: env(safe-area-inset-bottom) !important; bottom: env(safe-area-inset-bottom) !important;

View File

@@ -189,6 +189,7 @@ export default function SargassesMap({ onSpotSelect, selectedSpotId, activeStep,
const [layerOpacity, setLayerOpacity] = useState(1); const [layerOpacity, setLayerOpacity] = useState(1);
const [mapStyle, setMapStyle] = useState(null); // null = style not yet ready const [mapStyle, setMapStyle] = useState(null); // null = style not yet ready
const [dataDate, setDataDate] = useState(null); const [dataDate, setDataDate] = useState(null);
const [dataStale, setDataStale] = useState(false); // true = données > 6h
const tilesOrigin = window.location.origin; const tilesOrigin = window.location.origin;
@@ -199,8 +200,9 @@ export default function SargassesMap({ onSpotSelect, selectedSpotId, activeStep,
if (s.lastObservation?.detectedAt) { if (s.lastObservation?.detectedAt) {
setDataDate(new Date(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, // Load cartoon map style once — map is only mounted when style is ready,
@@ -283,6 +285,12 @@ export default function SargassesMap({ onSpotSelect, selectedSpotId, activeStep,
</div> </div>
)} )}
{dataStale && (
<div className="smap-stale">
Satellite en attente données possiblement périmées
</div>
)}
{activeStep === 'now' && ( {activeStep === 'now' && (
<Source <Source
id="observations" id="observations"