import { useState, useEffect } from 'react'; const API_BASE = '/seismic/api'; interface CoverageStats { total_positions: number; with_data: number; with_aux: number; total_files: number; coverage_pct: number; missing: number; } interface Gap { start: number; end: number; length: number; } function H5Coverage({ onClose }: { onClose: () => void }) { const [stats, setStats] = useState(null); const [gaps, setGaps] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { Promise.all([ fetch(`${API_BASE}/h5/coverage`).then(r => r.json()), fetch(`${API_BASE}/h5/gaps`).then(r => r.json()) ]).then(([statsData, gapsData]) => { setStats(statsData); setGaps(gapsData.gaps.sort((a: Gap, b: Gap) => b.length - a.length)); setLoading(false); }); }, []); if (loading) { return (
Chargement des statistiques H5…
); } return (

📊 H5 Data Coverage

{/* Stats globales */}
Positions totales
{stats?.total_positions}
Avec données
{stats?.with_data}
Manquantes
{stats?.missing}
Coverage
50 ? '#4ade80' : '#fbbf24' }}>{stats?.coverage_pct}%
Fichiers totaux
{stats?.total_files}
{/* Progress bar */}
Progression du déploiement
{stats?.with_data} / {stats?.total_positions} positions
{/* Top 10 gaps */}

🔍 Top 10 Gaps (plages manquantes)

{gaps.slice(0, 10).map((gap, i) => (
b{gap.start} → b{gap.end}
50 ? '#dc2626' : gap.length > 20 ? '#f59e0b' : '#3b82f6', color: '#fff', padding: '4px 12px', borderRadius: '12px', fontSize: '0.85rem', fontWeight: 'bold' }}> {gap.length} positions
))}
{gaps.length > 10 && (
… et {gaps.length - 10} autres gaps
)}
{/* Verdict */}
{stats && stats.coverage_pct < 50 ? '⚠️ Déploiement partiel détecté' : '✅ Coverage acceptable'}
{stats && stats.coverage_pct < 50 ? `Seulement ${stats.coverage_pct}% des positions planifiées ont des données. Cela suggère un test de déploiement plutôt qu'une collecte complète.` : `${stats?.coverage_pct}% des positions déployées avec succès.` }
); } export default H5Coverage;