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 (