import { useParams, useNavigate, Link } from 'react-router-dom'; import { useVariability } from '../hooks/useVariability'; import { VariabilityPanel } from './VariabilityPanel'; export function DetailsView() { const { type, value } = useParams<{ type: string; value: string }>(); const navigate = useNavigate(); const { data, loading, error } = useVariability(type || '', value || ''); if (loading) { return (
Chargement...
); } if (error) { return (

Erreur: {error.message}

); } if (!data) return null; const typeLabels: Record = { ip: { label: 'IP' }, ja4: { label: 'JA4' }, country: { label: 'Pays' }, asn: { label: 'ASN' }, host: { label: 'Host' }, user_agent: { label: 'User-Agent' }, }; const typeInfo = typeLabels[type || ''] || { label: type }; return (
{/* Breadcrumb */} {/* En-tête */}

{typeInfo.label}

{value}

{data.total_detections}
détections (24h)
{type === 'ip' && value && ( )} {type === 'ja4' && value && ( )}
{/* Stats rapides */}
{/* Insights + Variabilité côte à côte */}
{data.insights.length > 0 && (

Insights

{data.insights.map((insight, i) => ( ))}
)}
0 ? 'col-span-2' : 'col-span-3'}>
{/* Bouton retour */}
); } // Composant StatBox function StatBox({ label, value }: { label: string; value: string }) { return (
{value}
{label}
); } // Composant InsightCard function InsightCard({ insight }: { insight: { type: string; message: string } }) { const styles: Record = { warning: 'bg-yellow-500/10 border-yellow-500/50 text-yellow-500', info: 'bg-blue-500/10 border-blue-500/50 text-blue-400', success: 'bg-green-500/10 border-green-500/50 text-green-400', }; return (
{insight.message}
); } // Helper pour formater la date function formatDate(dateStr: string): string { const date = new Date(dateStr); return date.toLocaleDateString('fr-FR', { day: '2-digit', month: '2-digit', hour: '2-digit', minute: '2-digit' }); }