'use client'; import { useMemo } from 'react'; import type { SwarmTopologyData } from '../../hooks/use-swarm-topology'; interface SwarmGraphProps { topology: SwarmTopologyData | null; isLoading: boolean; } export function SwarmGraph({ topology, isLoading }: SwarmGraphProps) { const nodes = useMemo(() => { if (!topology) return []; // Simple layout strategy: Clusters // Done: Left side // Active: Center // Ready: Right // Blocked: Bottom Right const output: React.ReactNode[] = []; // 1. Completed (Green Cluster) topology.completed.forEach((item, i) => { const col = i % 5; const row = Math.floor(i / 5); output.push( ); }); // 2. Active (Pulsing Center) topology.active.forEach((item, i) => { const cx = 140 + (i * 20); const cy = 30 + (i % 2) * 10; output.push( ); }); // 3. Ready (White Pipeline) topology.ready.forEach((item, i) => { const cx = 220 + (i * 10); const cy = 30; output.push( ); }); // 4. Blocked (Red Hazard) topology.blocked.forEach((item, i) => { const cx = 220 + (i * 10); const cy = 50; output.push( ); }); return output; }, [topology]); if (isLoading) { return (
SCANNING TOPOLOGY...
); } if (!topology || (topology.completed.length === 0 && topology.active.length === 0 && topology.ready.length === 0)) { return (
EMPTY SIGNAL
); } return (
{/* Connection Lines (Abstract) */} {nodes} {/* Labels */} DONE ACTIVE READY BLOCKED
); }