diff --git a/.env.tmpl b/.env.tmpl index abe6386..7d9473c 100644 --- a/.env.tmpl +++ b/.env.tmpl @@ -5,7 +5,9 @@ PUBLIC_SITE_URL=https://info-canicule.nocleus.com # Valkey shared infra — DB 0 (isolation par préfixe `info-canicule:*` via ACL) REDIS_URL=redis://info-canicule:{{ pass://Infra/Valkey — info-canicule/password }}@valkey:6379/0 -VIGILANCE_PROVIDER=opendatasoft +# Provider Vigilance : `meteofrance` (API officielle, frais) ou `opendatasoft` (no-auth, lag possible). +# Vide = auto (MF si METEOFRANCE_API_KEY défini, sinon opendatasoft). +VIGILANCE_PROVIDER= VIGILANCE_CACHE_TTL=900 # Umami analytics (RGPD, auto-hébergé — analytics.nocleus.com) diff --git a/src/components/TemperatureChartInteractive.astro b/src/components/TemperatureChartInteractive.astro index deae348..1d02c4f 100644 --- a/src/components/TemperatureChartInteractive.astro +++ b/src/components/TemperatureChartInteractive.astro @@ -7,18 +7,20 @@ interface Props { hourly?: HourlySeries | null; // 24h days7: DayObservation[]; days30: DayObservation[]; - normales7?: NormalePoint[]; // 1 normale par jour (même longueur que days7) - normales30?: NormalePoint[]; // idem pour 30j - normaleHourly?: NormalePoint | null; // 1 seule normale (jour courant) pour overlay 24h + days365: DayObservation[]; + normales7?: NormalePoint[]; + normales30?: NormalePoint[]; + normales365?: NormalePoint[]; + normaleHourly?: NormalePoint | null; // 1 normale (jour courant) pour overlay 24h stationLabel?: string | null; } -const { hourly, days7, days30, normales7 = [], normales30 = [], normaleHourly = null, stationLabel } = Astro.props; +const { + hourly, days7, days30, days365, + normales7 = [], normales30 = [], normales365 = [], + normaleHourly = null, stationLabel, +} = Astro.props; -// Sérialiser les 3 séries pour le JS client (toggle + hover). -// Pour les normales : -// - 24h : 1 seul point répété (la normale du jour courant) → ligne horizontale -// - 7j / 30j : 1 normale par jour (courbe qui suit la saison) const serialize = { hourly: hourly?.observations.map((o) => ({ t: o.time, tx: o.t, tn: null })) ?? [], days7: days7.map((d, i) => ({ @@ -29,10 +31,15 @@ const serialize = { t: d.date, tx: d.tx, tn: d.tn, normTx: normales30[i]?.tx ?? null, normTn: normales30[i]?.tn ?? null, })), + days365: days365.map((d, i) => ({ + t: d.date, tx: d.tx, tn: d.tn, + normTx: normales365[i]?.tx ?? null, normTn: normales365[i]?.tn ?? null, + })), normaleHourly: normaleHourly ? { tx: normaleHourly.tx, tn: normaleHourly.tn } : null, }; const hasHourly = (hourly?.observations.length ?? 0) > 0; +const hasYear = days365.length > 30; const defaultPeriod = hasHourly ? '24h' : '7j'; --- @@ -68,10 +75,21 @@ const defaultPeriod = hasHourly ? '24h' : '7j'; role="tab" data-period="30j" aria-selected={false} - class="period-tab px-3 py-1 text-xs font-medium aria-selected:bg-canicule-600 aria-selected:text-white" + class:list={['period-tab px-3 py-1 text-xs font-medium aria-selected:bg-canicule-600 aria-selected:text-white', hasYear ? 'border-r border-slate-200' : '']} > 30 jours + {hasYear && ( + + )} @@ -117,7 +135,11 @@ const defaultPeriod = hasHourly ? '24h' : '7j'; } function render(period) { - const series = data[period === '24h' ? 'hourly' : period === '7j' ? 'days7' : 'days30']; + const seriesKey = period === '24h' ? 'hourly' + : period === '7j' ? 'days7' + : period === '30j' ? 'days30' + : 'days365'; + const series = data[seriesKey]; if (!series || series.length === 0) { svg.innerHTML = 'Aucune donnée disponible'; return; diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro index 938160b..47d9f96 100644 --- a/src/layouts/Base.astro +++ b/src/layouts/Base.astro @@ -103,7 +103,7 @@ const jsonLd = {
- 🌡️ + Info Canicule