--- import Base from '../layouts/Base.astro'; import FranceMap from '../components/FranceMap.astro'; import DepartementGrid from '../components/DepartementGrid.astro'; import VigilanceLegend from '../components/VigilanceLegend.astro'; import VigilanceChip from '../components/VigilanceChip.astro'; import { getVigilanceSnapshot, maxColorByDepartement, activeAlerts, currentEcheance } from '../lib/vigilance'; import { getDepartement } from '../lib/departements'; import type { VigilanceAlert } from '../lib/vigilance'; export const prerender = false; let snapshot; let error: string | null = null; try { snapshot = await getVigilanceSnapshot(); } catch (e) { error = (e as Error).message; } // Determine l'écheance "aujourd'hui réel" — peut être J ou J1 selon l'heure // (entre minuit et la publication du bulletin suivant ~6h, J du bulletin = hier). const ech = snapshot ? currentEcheance(snapshot) : 'J'; const colorsByDept = snapshot ? maxColorByDepartement(snapshot, ech) : new Map(); const alertsToday = snapshot ? snapshot.alerts.filter((a) => a.echeance === ech && a.colorId >= 2) : []; const alertsByDept = new Map(); if (snapshot) { for (const a of snapshot.alerts) { if (a.echeance !== ech) continue; if (a.colorId < 2) continue; const list = alertsByDept.get(a.departement) ?? []; list.push(a); alertsByDept.set(a.departement, list); } } // Tri des départements actifs par code (2A/2B inséré après 19). function deptSortKey(code: string): string { if (code === '2A') return '19.1'; if (code === '2B') return '19.2'; return code; } const activeDeptCodes = [...alertsByDept.keys()].sort((a, b) => deptSortKey(a).localeCompare(deptSortKey(b), 'en', { numeric: true }), ); const canicule = alertsToday.filter((a) => a.phenomenonId === 6).length; const orages = alertsToday.filter((a) => a.phenomenonId === 3).length; const orange = alertsToday.filter((a) => a.colorId >= 3).length; const productDate = snapshot?.productDatetime ? new Date(snapshot.productDatetime).toLocaleString('fr-FR', { dateStyle: 'long', timeStyle: 'short', timeZone: 'Europe/Paris', }) : 'inconnu'; // Date de validité de l'écheance affichée (pour clarifier au visiteur) const dayLabel = (() => { if (!snapshot) return ''; const sample = snapshot.alerts.find((a) => a.echeance === ech); if (!sample) return ''; return new Date(sample.beginTime).toLocaleDateString('fr-FR', { weekday: 'long', day: 'numeric', month: 'long', timeZone: 'Europe/Paris', }); })(); ---

Vigilance Météo France en temps réel

Carte des alertes Vigilance par département, conseils officiels et numéros d'urgence. {dayLabel && ( <> Affichage pour {dayLabel}. )}

Bulletin Météo France émis le {productDate} (heure de Paris).

{ error && (
Données indisponibles. Réessayer dans quelques minutes. Détail technique : {error}
) } { !error && (
{canicule}
départements en vigilance canicule
{orange}
en niveau orange ou rouge (tous phénomènes)
{orages}
en vigilance orages
) }
{ !error && ( <>

Niveau par département{dayLabel ? ` — ${dayLabel}` : ''}

Survolez un département pour voir le détail des alertes, cliquez pour la page complète.

Vue par région (liste)

Source officielle : vigilance.meteofrance.fr — toujours s'y référer en cas d'urgence.

Outre-mer non couvert par cette source open data : Guadeloupe · Martinique · Guyane · La Réunion · Mayottevigilance.meteofrance.fr

) } { !error && activeDeptCodes.length > 0 && (

Départements en alerte ({activeDeptCodes.length})

Triés par numéro de département. Un département peut cumuler plusieurs phénomènes (ex: canicule + orages).

    {activeDeptCodes.map((code) => { const dept = getDepartement(code); if (!dept) return null; const alerts = (alertsByDept.get(code) ?? []).slice().sort((a, b) => b.colorId - a.colorId); return (
  • {code} · {dept.name}
    {alerts.map((a) => ( ))}
  • ); })}
) }