import { useState, useEffect } from 'react'; import { LineChart, Line, XAxis, YAxis, Tooltip, ResponsiveContainer, PieChart, Pie, Cell } from 'recharts'; const COLORS = ['#00f3ff', '#bc13fe']; // Cyan pour Gains, Magenta pour Pertes export default function App() { const [seuil, setSeuil] = useState(2.0); const [data, setData] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { setLoading(true); // Appel de l'API sur le même domaine (port 7860) fetch(`/api/stats?seuil=${seuil}`) .then(res => res.json()) .then(result => { setData(result); setLoading(false); }) .catch(err => { console.error("Erreur API:", err); setLoading(false); }); }, [seuil]); if (loading || !data) { return (
Chargement des données...
); } if (data.error) { return
{data.error}
; } // Formatage des données pour Recharts const chartData = data.historique.map((r, i) => ({ name: i, cote: r.cote })); const pieData = [ { name: `Gains (> ${seuil}x)`, value: data.distribution.gains }, { name: `Pertes (<= ${seuil}x)`, value: data.distribution.pertes } ]; return (
{/* Header */}

AVIATOR ANALYTICS V3

Analyse dynamique en temps réel

{/* LE SUPER SLIDER DE SEUIL */}
Seuil d'analyse
1.0x setSeuil(parseFloat(e.target.value))} className="neon-slider w-full" /> 10.0x
{seuil.toFixed(1)}x
{/* KPI Cards */}
0} />
{/* Graphiques */}
{/* Courbe des cotes */}

Historique des Cotes (100 derniers)

[`${value}x`, "Cote"]} />
{/* Pie Chart Distribution */}

Distribution

{pieData.map((entry, index) => ( ))} [`${value} (${((value/data.totalRounds)*100).toFixed(1)}%)`, name]} />
Gains ({data.distribution.pourcentageGains}%)
Pertes ({data.distribution.pourcentagePertes}%)
{/* Styles CSS Injectés pour le Glassmorphism (pour éviter un fichier tailwind trop complexe pour l'instant) */}
); } // Composant Card réutilisable const KpiCard = ({ title, value, color, shadow, isNegative }) => (

{title}

{value}

);