From 42286a8c0dbd8a61a055f6966ac7b5eae602973d Mon Sep 17 00:00:00 2001 From: syoul Date: Mon, 23 Mar 2026 23:33:37 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20barre=20de=20g=C3=A9oloc=20toujours=20vi?= =?UTF-8?q?sible,=20bas=C3=A9e=20sur=20la=20p=C3=A9riode=20compl=C3=A8te?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit En mode animation, globalGeoStats passe les chiffres de la période entière (depuis stats global) pour que la barre affiche le vrai taux Cesium+. Le label indique "(période)" pour rappeler que ce n'est pas par frame. Co-Authored-By: Claude Sonnet 4.6 --- src/App.tsx | 1 + src/components/StatsPanel.tsx | 47 ++++++++++++++++++++--------------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 4bb5df8..f894e26 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -72,6 +72,7 @@ export default function App() { source={source} currentUD={currentUD} animationLabel={animation.active ? (animation.currentFrame?.label ?? undefined) : undefined} + globalGeoStats={animation.active && stats ? { geoCount: stats.geoCount, transactionCount: stats.transactionCount } : undefined} /> {/* Map area */} diff --git a/src/components/StatsPanel.tsx b/src/components/StatsPanel.tsx index c77bf86..05208a4 100644 --- a/src/components/StatsPanel.tsx +++ b/src/components/StatsPanel.tsx @@ -8,6 +8,8 @@ interface StatsPanelProps { source: 'live' | 'mock'; currentUD: number; animationLabel?: string; + // Stats de géoloc de la période complète (indépendantes de la frame courante) + globalGeoStats?: { geoCount: number; transactionCount: number }; } const MEDALS = ['🥇', '🥈', '🥉']; @@ -33,7 +35,7 @@ function formatDU(g1: number, ud: number): string { return `≈ ${Math.round(du).toLocaleString('fr-FR')} DU`; } -export function StatsPanel({ stats, loading, periodDays, source, currentUD, animationLabel }: StatsPanelProps) { +export function StatsPanel({ stats, loading, periodDays, source, currentUD, animationLabel, globalGeoStats }: StatsPanelProps) { const periodLabel = periodDays === 1 ? '24 dernières heures' : `${periodDays} derniers jours`; const prevStats = useRef(null); @@ -55,9 +57,6 @@ export function StatsPanel({ stats, loading, periodDays, source, currentUD, anim // Mémorise les stats après le rendu if (stats && !loading) prevStats.current = stats; - const geoPct = stats && stats.transactionCount > 0 - ? Math.round((stats.geoCount / stats.transactionCount) * 100) - : null; return (