feat: OG png + sentry + dept api + drom notice + registre canicule
Some checks are pending
Deploy info-canicule / deploy (push) Waiting to run
Some checks are pending
Deploy info-canicule / deploy (push) Waiting to run
Quick wins : - public/og-image.png (1200x630, via sharp depuis le SVG, build via pnpm build) SVG ne fonctionne pas pour Open Graph (Slack/Discord/X/FB). - @sentry/astro intégré conditionnellement (skip si SENTRY_DSN absent → no-op). GIT_COMMIT_SHA en var pour le release tag dans GlitchTip si voulu. - /api/vigilance/dept/[code] : JSON enrichi (phenomenon label + color name) pour J et J1, CORS *, Cache-Control 5min. 404 si code unknown. - JSON-LD enrichi : @graph WebSite + Service avec isBasedOn Dataset + license LOv2. - Lien retour vigilance.meteofrance.fr visible sous la carte. DROM (97x / 976) : - 5 entrées ajoutées dans departements.ts (région "DROM"). - /departement/[code] DROM : bannière "Vigilance Outre-mer non couverte par cette source open data" + bouton vers vigilance.meteofrance.fr. - Home : ligne sous la carte listant les 5 DROM + lien retour. - L'API /api/vigilance/dept/<DROM> retourne quand même un JSON 200 (arrays vides). Registre canicule : - Page /conseils/registre-canicule : qui, quoi, comment s'inscrire au CCAS. - Numéro vert 0 800 06 66 66. - Bannière mise en avant en haut de /conseils. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
89e48c18e4
commit
87d173684c
13 changed files with 1595 additions and 35 deletions
|
|
@ -3,7 +3,7 @@ import Base from '../../layouts/Base.astro';
|
|||
import VigilanceChip from '../../components/VigilanceChip.astro';
|
||||
import VigilanceLegend from '../../components/VigilanceLegend.astro';
|
||||
import { getVigilanceSnapshot, alertsForDepartement } from '../../lib/vigilance';
|
||||
import { getDepartement } from '../../lib/departements';
|
||||
import { getDepartement, isDrom } from '../../lib/departements';
|
||||
import { PHENOMENA, COLOR_LABEL } from '../../lib/phenomena';
|
||||
import { ADVICE, EMERGENCY_NUMBERS } from '../../lib/advice';
|
||||
import { getClimatoForDepartement } from '../../lib/climato';
|
||||
|
|
@ -18,19 +18,25 @@ if (!dept) {
|
|||
return new Response('Département introuvable', { status: 404 });
|
||||
}
|
||||
|
||||
const drom = isDrom(dept.code);
|
||||
|
||||
let snapshot;
|
||||
let error: string | null = null;
|
||||
try {
|
||||
snapshot = await getVigilanceSnapshot();
|
||||
} catch (e) {
|
||||
error = (e as Error).message;
|
||||
if (!drom) {
|
||||
try {
|
||||
snapshot = await getVigilanceSnapshot();
|
||||
} catch (e) {
|
||||
error = (e as Error).message;
|
||||
}
|
||||
}
|
||||
|
||||
let climato = null;
|
||||
try {
|
||||
climato = await getClimatoForDepartement(dept.code);
|
||||
} catch (e) {
|
||||
console.warn('climato fetch failed for', dept.code, (e as Error).message);
|
||||
if (!drom) {
|
||||
try {
|
||||
climato = await getClimatoForDepartement(dept.code);
|
||||
} catch (e) {
|
||||
console.warn('climato fetch failed for', dept.code, (e as Error).message);
|
||||
}
|
||||
}
|
||||
|
||||
const today = snapshot ? alertsForDepartement(snapshot, dept.code, 'J') : [];
|
||||
|
|
@ -52,10 +58,30 @@ const adviceFor = highest && ADVICE[highest.phenomenonId];
|
|||
</section>
|
||||
|
||||
<section class="container-tight py-8">
|
||||
{error && <p class="text-red-700">Données indisponibles : {error}</p>}
|
||||
{drom && (
|
||||
<div class="rounded-lg border border-amber-200 bg-amber-50 p-4">
|
||||
<p class="font-semibold text-amber-900">Vigilance Outre-mer non couverte par cette source</p>
|
||||
<p class="mt-1 text-sm text-amber-800">
|
||||
Les départements et régions d'Outre-mer disposent de leur propre dispositif Vigilance, géré
|
||||
par les centres météorologiques locaux de Météo France. Ces données ne sont pas (encore)
|
||||
rediffusées en open data au même format que la métropole.
|
||||
</p>
|
||||
<p class="mt-3">
|
||||
<a
|
||||
href="https://vigilance.meteofrance.fr/"
|
||||
rel="noopener"
|
||||
class="inline-flex items-center gap-1 rounded bg-amber-700 px-4 py-2 text-sm font-semibold text-white no-underline hover:bg-amber-800"
|
||||
>
|
||||
Voir la Vigilance officielle Outre-mer →
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!drom && error && <p class="text-red-700">Données indisponibles : {error}</p>}
|
||||
|
||||
{
|
||||
!error && today.length === 0 && (
|
||||
!drom && !error && today.length === 0 && (
|
||||
<div class="rounded border border-green-200 bg-green-50 p-4">
|
||||
<p class="font-semibold text-green-800">Aucune vigilance particulière aujourd'hui.</p>
|
||||
<p class="text-sm text-green-700">Le département est en niveau vert pour tous les phénomènes.</p>
|
||||
|
|
@ -64,7 +90,7 @@ const adviceFor = highest && ADVICE[highest.phenomenonId];
|
|||
}
|
||||
|
||||
{
|
||||
!error && today.length > 0 && (
|
||||
!drom && !error && today.length > 0 && (
|
||||
<>
|
||||
<h2 class="mb-3 text-xl font-semibold">Alertes en cours</h2>
|
||||
<ul class="space-y-3">
|
||||
|
|
@ -100,7 +126,7 @@ const adviceFor = highest && ADVICE[highest.phenomenonId];
|
|||
}
|
||||
|
||||
{
|
||||
!error && tomorrow.length > 0 && (
|
||||
!drom && !error && tomorrow.length > 0 && (
|
||||
<div class="mt-8">
|
||||
<h2 class="mb-3 text-xl font-semibold">Prévision pour demain</h2>
|
||||
<ul class="space-y-2">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue