--- import Embed from '../../../layouts/Embed.astro'; import VigilanceChip from '../../../components/VigilanceChip.astro'; import { getVigilanceSnapshot, alertsForDepartement, maxColorByDepartement } from '../../../lib/vigilance'; import { getDepartement, isDrom } from '../../../lib/departements'; import { COLORS } from '../../../lib/phenomena'; export const prerender = false; const { code } = Astro.params; const dept = code ? getDepartement(code.toUpperCase()) : undefined; if (!dept) { return new Response('not found', { status: 404 }); } let alerts = [] as Awaited>; let maxColor = 1; let error: string | null = null; if (!isDrom(dept.code)) { try { const snap = await getVigilanceSnapshot(); alerts = alertsForDepartement(snap, dept.code, 'J').sort((a, b) => b.colorId - a.colorId); maxColor = maxColorByDepartement(snap, 'J').get(dept.code) ?? 1; } catch (e) { error = (e as Error).message; } } const color = COLORS[maxColor as 1 | 2 | 3 | 4]; const siteUrl = `https://info-canicule.nocleus.com/departement/${dept.code}`; ---

{dept.name}

Vigilance Météo France · dept {dept.code}

= 3 ? '#fff' : '#1e293b'}`} > {color.name.toUpperCase()}
{error && (

Données indisponibles.

)} {isDrom(dept.code) && (

Vigilance Outre-mer non couverte par cette source. Source officielle ↗

)} {!error && !isDrom(dept.code) && alerts.length === 0 && (

Aucune vigilance particulière aujourd'hui.

)} {alerts.length > 0 && ( )}