/** * CallGraphAnalyzer — Function Call Graph architectural intelligence instrument. * * Provides function-to-function dependency analysis, blast radius estimation, * caller/callee tracing, recursion detection, and function-level telemetry. */ import React, { useState, useCallback, useEffect, useRef, useMemo } from 'react'; import ReactFlow, { Background, MiniMap, useNodesState, useEdgesState, ReactFlowProvider, Position, MarkerType, Handle, useReactFlow, } from 'reactflow'; import 'reactflow/dist/style.css'; import { apiUrl, extractErrorMessage } from '../../lib/api'; import { Button } from '../ui/Button'; import { Badge } from '../ui/Badge'; import { MetricCard } from '../ui/MetricCard'; import { EmptyState } from '../ui/EmptyState'; import { SkeletonCard, SkeletonGroup, Skeleton } from '../ui/Skeleton'; import { Workflow, Zap, AlertTriangle, ArrowUpFromLine, ArrowDownToLine, RefreshCw, Search, X, Code2, GitBranch, Repeat2, Info, ZoomIn, ZoomOut, Maximize, Sparkles, ExternalLink, ArrowRight, ArrowLeft, } from 'lucide-react'; import { computeCallGraphLayout, CG_NODE_W, CG_NODE_H } from './graph/callGraphLayout'; import { buildMutualPairSet, edgeFocusRole, edgeTransition, isMutual, resolveCallEdgeStyle, resolveFocusChoreography, } from './graph/edgeSemantics'; // ── Types ───────────────────────────────────────────────────────────────── interface CgNode { id: string; label: string; category: string; degree: number; centrality: number; language: string; highlighted: boolean; is_focus: boolean; qualified: string; file_path: string; fan_in: number; fan_out: number; is_recursive: boolean; parent_class?: string; symbol_type: string; } interface CgEdge { source: string; target: string; relationship: string; ambiguous: boolean; } interface GraphResponse { nodes: CgNode[]; edges: CgEdge[]; node_count: number; edge_count: number; error?: string; } interface CgStats { node_count: number; edge_count: number; entry_functions: number; recursive_functions: number; mutual_recursion_groups: number; top_fan_in: { node_id: string; fan_in: number }[]; top_fan_out: { node_id: string; fan_out: number }[]; generated_at: string | null; } interface BlastRadius { function_id: string; affected_functions: string[]; affected_files: string[]; depth: number; risk_level: string; recursive_cycles: string[][]; } interface Props { repoName: string; } // ── Constants ────────────────────────────────────────────────────────────── const CAT_COLOR: Record = { entry_point: '#818cf8', // indigo — entry roots core_module: '#34d399', // emerald — high fan-in hubs high_coupling:'#f59e0b', // amber — recursive focus: '#ffffff', // white — selected node regular: '#71717a', // zinc }; const LANG_COLOR: Record = { python: '#3572A5', typescript: '#3178C6', javascript: '#f1e05a', go: '#00ADD8', rust: '#dea584', cpp: '#f34b7d', java: '#b07219', }; function shortId(id: string): string { const parts = id.split('::'); return parts.length > 1 ? parts[1] : id; } function riskTone(level: string): 'danger' | 'warn' | 'success' { if (level === 'high') return 'danger'; if (level === 'medium') return 'warn'; return 'success'; } // ── Custom React Flow Node Card Component ───────────────────────────────── interface CustomNodeData { node: CgNode; isSelected: boolean; isDimmed: boolean; isCaller: boolean; isCallee: boolean; colorBy: 'category' | 'language'; /** Where this node sits in the execution ordering, in milliseconds. */ stageDelayMs?: number; onNodeClick: (node: CgNode) => void; } const CustomCallNode: React.FC<{ data: CustomNodeData }> = ({ data }) => { const { node, isSelected, isDimmed, isCaller, isCallee, colorBy, stageDelayMs = 0 } = data; const isRecursive = node.is_recursive; let baseBorder = 'border-zinc-800 bg-zinc-900/90 text-zinc-300 hover:border-zinc-700'; if (colorBy === 'language') { const lang = node.language.toLowerCase(); const hex = LANG_COLOR[lang] || '#71717a'; baseBorder = `border-[${hex}] bg-zinc-900/90 text-zinc-200`; } else { if (isRecursive) { baseBorder = 'border-amber-500/70 bg-zinc-900/95 text-amber-200 hover:border-amber-400'; } else if (node.category === 'entry_point' || node.fan_in === 0) { baseBorder = 'border-indigo-500/60 bg-zinc-900/95 text-indigo-300 font-medium hover:border-indigo-400'; } else if (node.category === 'core_module' || node.fan_in >= 3) { baseBorder = 'border-emerald-500/60 bg-zinc-900/95 text-emerald-300 font-medium hover:border-emerald-400'; } } if (isCaller) { baseBorder = 'border-emerald-400/80 bg-zinc-900/95 text-emerald-200 z-10 shadow-sm hover:border-emerald-300'; } else if (isCallee) { baseBorder = 'border-indigo-400/80 bg-zinc-900/95 text-indigo-200 z-10 shadow-sm hover:border-indigo-300'; } if (isSelected) { baseBorder = 'border-indigo-400 bg-zinc-900 text-white ring-1 ring-indigo-500/50 shadow-[0_0_20px_rgba(99,102,241,0.15)] font-bold scale-[1.02] z-20'; } const fileName = node.file_path.split('/').pop() || node.file_path; const inlineBorder = colorBy === 'language' && !isSelected ? { borderColor: LANG_COLOR[node.language.toLowerCase()] || '#71717a' } : {}; return (
{/* Position in the execution chain relative to the selection. Caller and callee were previously distinguished by border colour alone; the arrow and word state it outright, which is what makes "what runs before and after this function" readable at a glance. */} {(isCaller || isCallee) && !isSelected && ( {isCaller ? 'calls this' : 'called by this'} )} {/* Function name + Fan-in badge */}
{isRecursive ? ( ) : ( )} {shortId(node.id)}
{node.fan_in > 0 && ↙{node.fan_in}} {node.fan_out > 0 && ↗{node.fan_out}}
{/* File & category pills */}
{fileName}
{node.language && ( {node.language} )} {node.symbol_type && ( {node.symbol_type} )} {isRecursive && ( cyclic )}
); }; const customNodeTypes = { customCallNode: CustomCallNode, }; // ── React Flow canvas wrapper ────────────────────────────────────────────── interface CanvasProps { cgNodes: CgNode[]; cgEdges: CgEdge[]; selectedNodeId: string | null; colorBy: 'category' | 'language'; onNodeClick: (node: CgNode | null) => void; } const CallGraphCanvas: React.FC = ({ cgNodes, cgEdges, selectedNodeId, colorBy, onNodeClick }) => { const [rfNodes, setRfNodes, onNodesChange] = useNodesState([]); const [rfEdges, setRfEdges, onEdgesChange] = useEdgesState([]); const [hoveredNodeId, setHoveredNodeId] = useState(null); const { zoomIn, zoomOut, fitView, setCenter, getNodes } = useReactFlow(); // Find direct callers (incoming) and callees (outgoing) const callerIds = useMemo(() => { if (!selectedNodeId) return new Set(); const set = new Set(); cgEdges.forEach((e) => { if (e.target === selectedNodeId) set.add(e.source); }); return set; }, [selectedNodeId, cgEdges]); const calleeIds = useMemo(() => { if (!selectedNodeId) return new Set(); const set = new Set(); cgEdges.forEach((e) => { if (e.source === selectedNodeId) set.add(e.target); }); return set; }, [selectedNodeId, cgEdges]); const neighborIds = useMemo(() => { if (!selectedNodeId) return new Set(); const set = new Set([selectedNodeId, ...callerIds, ...calleeIds]); return set; }, [selectedNodeId, callerIds, calleeIds]); // Hovered node object for micro-inspector tooltip const hoveredNode = useMemo(() => { if (!hoveredNodeId || hoveredNodeId === selectedNodeId) return null; return cgNodes.find((n) => n.id === hoveredNodeId) ?? null; }, [hoveredNodeId, selectedNodeId, cgNodes]); // Compute balanced aspect-ratio layout on data changes useEffect(() => { const positions = computeCallGraphLayout(cgNodes, cgEdges); const mappedNodes = cgNodes.map((n) => { const isSelected = selectedNodeId === n.id; const isCaller = callerIds.has(n.id); const isCallee = calleeIds.has(n.id); const isDimmed = selectedNodeId !== null && !neighborIds.has(n.id); return { id: n.id, type: 'customCallNode', position: positions[n.id] || { x: 0, y: 0 }, width: CG_NODE_W, height: CG_NODE_H, data: { node: n, isSelected, isDimmed, isCaller, isCallee, colorBy, /* Position in the execution ordering, so the node's own transition waits its turn: callers, then the function, then callees. */ stageDelayMs: resolveFocusChoreography( selectedNodeId === null ? 'idle' : isSelected ? 'focus' : isCaller ? 'incoming' : isCallee ? 'outgoing' : 'unrelated', 'execution', ).delayMs, }, }; }); // Mutual recursion is derived from the edge list already on screen. const mutualPairs = buildMutualPairSet(cgEdges); const mappedEdges = cgEdges.map((e, i) => { const isIncoming = Boolean(selectedNodeId) && e.target === selectedNodeId; const isOutgoing = Boolean(selectedNodeId) && e.source === selectedNodeId; const visual = resolveCallEdgeStyle({ isSelfCall: e.source === e.target, isMutualRecursion: isMutual(mutualPairs, e.source, e.target), isOutgoing, isIncoming, isAmbiguous: Boolean(e.ambiguous), hasActive: selectedNodeId !== null, }); /* Execution order, expressed as timing. Callers illuminate immediately, callees follow, unrelated chains retreat last — so selecting a function reads as tracing execution through it rather than as a highlight snapping on. The shared choreography keeps this identical to the node staging below and distinct from the File Graph's simultaneous resolve. */ const choreo = resolveFocusChoreography( edgeFocusRole({ isIncoming, isOutgoing, hasActive: selectedNodeId !== null }), 'execution', ); return { id: `e-${i}`, source: e.source, target: e.target, /* Never animated: React Flow's `animated` paints marching dashes that would overwrite the dash patterns carrying recursion and ambiguity, and a moving edge implies runtime traffic the analyser never measured. */ animated: false, style: { stroke: visual.stroke, strokeWidth: visual.strokeWidth, opacity: visual.opacity, strokeDasharray: visual.dash, transition: edgeTransition(choreo), }, markerEnd: { type: MarkerType.ArrowClosed, width: 10, height: 10, color: visual.stroke, }, // Mutual recursion gets a head at both ends. ...(visual.bothEnds ? { markerStart: { type: MarkerType.ArrowClosed, width: 10, height: 10, color: visual.stroke, }, } : {}), }; }); setRfNodes(mappedNodes as any); setRfEdges(mappedEdges as any); }, [cgNodes, cgEdges, selectedNodeId, neighborIds, callerIds, calleeIds, colorBy, setRfNodes, setRfEdges]); // Center on load useEffect(() => { if (rfNodes.length > 0) { const timer = setTimeout(() => { fitView({ padding: 0.15, duration: 300, minZoom: 0.15, maxZoom: 1.5 }); }, 100); return () => clearTimeout(timer); } }, [rfNodes.length, fitView]); // Smooth center on selected node useEffect(() => { if (selectedNodeId) { const nodes = getNodes(); const target = nodes.find((n) => n.id === selectedNodeId); if (target && target.position) { setCenter(target.position.x + CG_NODE_W / 2, target.position.y + CG_NODE_H / 2, { zoom: 1.15, duration: 350, }); } } }, [selectedNodeId, getNodes, setCenter]); const handleNodeClick = useCallback((_: any, node: any) => { const original = cgNodes.find((n) => n.id === node.id); if (original) onNodeClick(original); }, [cgNodes, onNodeClick]); const handleNodeMouseEnter = useCallback((_: any, node: any) => { setHoveredNodeId(node.id); }, []); const handleNodeMouseLeave = useCallback(() => { setHoveredNodeId(null); }, []); const handlePaneClick = useCallback(() => { onNodeClick(null); setHoveredNodeId(null); }, [onNodeClick]); return (
instance.fitView({ padding: 0.15, duration: 300, minZoom: 0.15, maxZoom: 1.5 })} fitView fitViewOptions={{ padding: 0.15, minZoom: 0.15, maxZoom: 1.5 }} minZoom={0.05} maxZoom={2.5} proOptions={{ hideAttribution: true }} > {/* Minimal Transparent Pan/Zoom Controls */}
{ const original = n.data?.node as CgNode; if (!original) return '#27272a'; if (original.is_recursive) return '#f59e0b'; if (original.category === 'entry_point') return '#818cf8'; if (original.category === 'core_module') return '#34d399'; return '#3f3f46'; }} maskColor="rgba(3, 3, 3, 0.85)" className="!bg-zinc-950/95 !border-zinc-800/80 !rounded-lg overflow-hidden" nodeStrokeWidth={0} nodeBorderRadius={3} />
{/* Hover Micro-Inspector Tooltip */} {hoveredNode && (
{hoveredNode.category.replace('_', ' ')} {hoveredNode.language && ( {hoveredNode.language} )}
{shortId(hoveredNode.id)}
{hoveredNode.file_path}
Callers: {hoveredNode.fan_in} Callees: {hoveredNode.fan_out} {hoveredNode.is_recursive && ( CYCLIC )}
)}
); }; // ── Node detail panel (Function Inspector v2) ────────────────────────── interface NodePanelProps { node: CgNode; repoName: string; onClose: () => void; onBlastRadius: (id: string) => void; onNeighbors: (id: string) => void; onTrace: (id: string, dir: 'forward' | 'backward') => void; } const NodePanel: React.FC = ({ node, repoName, onClose, onBlastRadius, onNeighbors, onTrace, }) => { const [panelTab, setPanelTab] = useState<'overview' | 'metadata' | 'callers' | 'callees'>('overview'); const panelTabs = [ { id: 'overview', label: 'Overview' }, { id: 'metadata', label: 'Metadata' }, { id: 'callers', label: 'Callers' }, { id: 'callees', label: 'Callees' }, ] as const; /** * Coupling band, derived from the node's own fan-in and degree. * * This replaces a former HIGH/MEDIUM/LOW *RISK* verdict. The backend supplies * no risk score, so that badge asserted a severity the payload never measured — * and it folded `is_recursive` into the verdict even though recursion already * has its own badge beside it and is not a coupling measure. * * The band is labelled as derived so it cannot be mistaken for backend * telemetry, and it stays amber at worst: heavy coupling is a property worth * noticing, not a failure. */ const couplingBand = useMemo(() => { if (node.degree > 15 || node.fan_in > 5) { return { text: 'HIGH COUPLING', tone: 'warn' as const }; } if (node.degree > 6) { return { text: 'MODERATE COUPLING', tone: 'neutral' as const }; } return { text: 'LOW COUPLING', tone: 'neutral' as const }; }, [node]); return ( ); }; // ── Blast radius panel ───────────────────────────────────────────────────── const BlastRadiusPanel: React.FC<{ br: BlastRadius; onClose: () => void; }> = ({ br, onClose }) => (

Blast Radius Risk Assessment

Callers Affected

{br.affected_functions.length}

Files Affected

{br.affected_files.length}

Max Call Depth

{br.depth}

Risk Factor: {br.risk_level.toUpperCase()}
{br.recursive_cycles.length > 0 && (

{br.recursive_cycles.length} recursion cycle{br.recursive_cycles.length > 1 ? 's' : ''} detected

{br.recursive_cycles.slice(0, 3).map((cycle, i) => (
{cycle.map(shortId).join(' ↔ ')}
))}
)}
); // ── Stats panel ──────────────────────────────────────────────────────────── const StatsPanel: React.FC<{ stats: CgStats }> = ({ stats }) => (
} label="Functions" value={stats.node_count.toLocaleString()} hint="tracked symbols" /> } label="Call Edges" value={stats.edge_count.toLocaleString()} hint="call relationships" /> } label="Entry Points" value={stats.entry_functions} hint="no callers" /> } label="Recursive" value={stats.recursive_functions} hint="self-calling" /> } label="Mutual Cycles" value={stats.mutual_recursion_groups} hint="SCCs > 1" />

Top Fan-in (Most Referenced Functions)

{stats.top_fan_in.slice(0, 8).map((item, i) => (
#{i + 1} {shortId(item.node_id)} {item.fan_in} calls
))}

Top Fan-out (Most Outgoing Calls)

{stats.top_fan_out.slice(0, 8).map((item, i) => (
#{i + 1} {shortId(item.node_id)} {(item as any).fan_out} calls
))}
); // ── Main component ───────────────────────────────────────────────────────── export const CallGraphAnalyzer: React.FC = ({ repoName }) => { const [owner, repoSlug] = repoName.split('/'); // Build state const [building, setBuilding] = useState(false); const [buildProgress, setBuildProgress] = useState(''); const [buildError, setBuildError] = useState(null); // Graph data const [graphData, setGraphData] = useState(null); const [graphLoading, setGraphLoading] = useState(false); const [graphError, setGraphError] = useState(null); // Stats const [stats, setStats] = useState(null); // UI state const [activeView, setActiveView] = useState<'graph' | 'stats'>('graph'); const [searchQuery, setSearchQuery] = useState(''); const [selectedNode, setSelectedNode] = useState(null); const [blastRadius, setBlastRadius] = useState(null); const [brLoading, setBrLoading] = useState(false); // Filters & controls const [colorBy, setColorBy] = useState<'category' | 'language'>('category'); const [hideExternal, setHideExternal] = useState(false); const [hideCycles, setHideCycles] = useState(false); const searchDebounce = useRef | null>(null); // ── Data fetchers ──────────────────────────────────────────────────────── const loadGraph = useCallback(async (q: string) => { setGraphLoading(true); setGraphError(null); try { const url = apiUrl( `/api/v1/call-graph/${owner}/${repoSlug}${q ? `?q=${encodeURIComponent(q)}` : ''}` ); const res = await fetch(url); if (!res.ok) { const body = await res.json().catch(() => ({})); if (res.status === 404) { setGraphData(null); return; } throw new Error(extractErrorMessage(body)); } const data: GraphResponse = await res.json(); setGraphData(data); } catch (err: any) { setGraphError(extractErrorMessage(err)); } finally { setGraphLoading(false); } }, [owner, repoSlug]); const loadStats = useCallback(async () => { try { const res = await fetch(apiUrl(`/api/v1/call-graph/${owner}/${repoSlug}/stats`)); if (res.ok) setStats(await res.json()); } catch { /* optional */ } }, [owner, repoSlug]); const loadNeighbors = useCallback(async (functionId: string) => { setGraphLoading(true); setGraphError(null); try { const res = await fetch( apiUrl(`/api/v1/call-graph/${owner}/${repoSlug}/neighbors/${encodeURIComponent(functionId)}`) ); if (!res.ok) throw new Error(`HTTP ${res.status}`); const data: GraphResponse = await res.json(); setGraphData(data); } catch (err: any) { setGraphError(extractErrorMessage(err)); } finally { setGraphLoading(false); } }, [owner, repoSlug]); const loadTrace = useCallback(async (functionId: string, dir: 'forward' | 'backward') => { setGraphLoading(true); setGraphError(null); try { const res = await fetch( apiUrl(`/api/v1/call-graph/${owner}/${repoSlug}/trace/${encodeURIComponent(functionId)}?direction=${dir}&depth=6`) ); if (!res.ok) throw new Error(`HTTP ${res.status}`); const data: GraphResponse = await res.json(); setGraphData(data); } catch (err: any) { setGraphError(extractErrorMessage(err)); } finally { setGraphLoading(false); } }, [owner, repoSlug]); const loadBlastRadius = useCallback(async (functionId: string) => { setBrLoading(true); setBlastRadius(null); try { const res = await fetch( apiUrl(`/api/v1/call-graph/${owner}/${repoSlug}/blast-radius/${encodeURIComponent(functionId)}`) ); if (!res.ok) throw new Error(`HTTP ${res.status}`); setBlastRadius(await res.json()); } catch (err: any) { setGraphError(extractErrorMessage(err)); } finally { setBrLoading(false); } }, [owner, repoSlug]); // Filter nodes & edges on client side before passing to canvas const filteredNodes = useMemo(() => { if (!graphData || !graphData.nodes) return []; return graphData.nodes.filter(n => { if (hideCycles && n.is_recursive) return false; if (hideExternal && (n.symbol_type === 'external' || !n.file_path)) return false; return true; }); }, [graphData, hideCycles, hideExternal]); const filteredEdges = useMemo(() => { if (!graphData || !graphData.edges) return []; const validNodeIds = new Set(filteredNodes.map(n => n.id)); return graphData.edges.filter(e => { return validNodeIds.has(e.source) && validNodeIds.has(e.target); }); }, [graphData, filteredNodes]); // Telemetry metrics const entryCount = useMemo(() => { return filteredNodes.filter((n) => n.category === 'entry_point' || n.fan_in === 0).length; }, [filteredNodes]); const recursiveCount = useMemo(() => { return filteredNodes.filter((n) => n.is_recursive).length; }, [filteredNodes]); // ── Auto-load on mount ─────────────────────────────────────────────────── useEffect(() => { setSelectedNode(null); setBlastRadius(null); setSearchQuery(''); setGraphData(null); setStats(null); loadGraph(''); loadStats(); }, [repoName, loadGraph, loadStats]); // ── Build handler (SSE stream) ─────────────────────────────────────────── const handleBuild = useCallback(async () => { setBuilding(true); setBuildError(null); setBuildProgress('Starting…'); setGraphData(null); setStats(null); try { const res = await fetch(apiUrl('/api/v1/call-graph/build'), { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ repo: repoName }), }); if (!res.body) throw new Error('No response body.'); const reader = res.body.getReader(); const decoder = new TextDecoder(); let buffer = ''; while (true) { const { value, done } = await reader.read(); if (done) break; buffer += decoder.decode(value, { stream: true }); const lines = buffer.split('\n'); buffer = lines.pop() ?? ''; for (const line of lines) { if (!line.startsWith('data: ')) continue; try { const ev = JSON.parse(line.slice(6)); if (ev.status === 'indexing' || ev.status === 'resolving') { setBuildProgress(`${ev.file_count ?? 0} files scanned…`); } else if (ev.status === 'complete') { setBuilding(false); loadGraph(''); loadStats(); return; } else if (ev.status === 'error') { throw new Error(ev.message || 'Build failed.'); } } catch (e: any) { if (e.message && e.message !== 'Unexpected end of JSON input') { throw e; } } } } } catch (err: any) { setBuildError(extractErrorMessage(err)); } finally { setBuilding(false); } }, [repoName, loadGraph, loadStats]); // ── Search handler ─────────────────────────────────────────────────────── const handleSearch = useCallback((val: string) => { setSearchQuery(val); if (searchDebounce.current) clearTimeout(searchDebounce.current); searchDebounce.current = setTimeout(() => { loadGraph(val); }, 300); }, [loadGraph]); return (
{/* Editorial Technical Header */}
FUNCTION CALL GRAPH / INTER-FUNCTION TOPOLOGY
{filteredNodes.length.toLocaleString()} FUNCTIONS · {filteredEdges.length.toLocaleString()} CALL EDGES · {entryCount} ENTRY POINTS {recursiveCount > 0 && ( <> · {recursiveCount} RECURSIVE )} · DIRECTED
{/* Controls: Mode toggle + Actions */}
{/* Graph / Stats Mode Switch */}
{/* Reset button */} {/* Rebuild button */}
{/* Build progress notification banner. The spinner carries the activity — pulsing the whole banner as well was two signals for one state. */} {building && (
Analyzing AST and constructing function call graph: {buildProgress}
)} {buildError && (
Error generating call graph: {buildError}
)} {/* Loading state */} {graphLoading && !building && (
MAPPING FUNCTION CALL TOPOLOGY…
)} {/* Error state */} {!graphLoading && graphError && (
} title="TOPOLOGY UNAVAILABLE" description={graphError} action={} />
)} {/* Empty / Not Built State */} {!graphLoading && !graphError && !graphData && !building && (
} title="Call Graph Not Built" description="Generate a complete function-level call hierarchy for this repository." action={} />
)} {/* Main Content Area */} {!graphLoading && !graphError && graphData && (
{/* Stats View */} {activeView === 'stats' && stats && } {activeView === 'stats' && !stats && ( } title="NOT AVAILABLE" description="Build the call graph to compute execution statistics." /> )} {/* Graph View */} {activeView === 'graph' && (
{/* Command Search & Analysis Filters */}
{/* Search functions */}
handleSearch(e.target.value)} placeholder="Search functions, methods, symbols…" className="w-full bg-zinc-900/90 border border-zinc-800 rounded-md pl-8 pr-12 py-1 text-xs font-mono focus:outline-none focus:border-indigo-500 text-zinc-100 placeholder:text-zinc-500/70" aria-label="Search call graph" /> {searchQuery ? ( ) : ( / )}
{/* Filters */}
{/* Color selector */}
Color Nodes:
{/* Hide External */} {/* Hide Recursive */}
{/* Minimal Legend */}
{colorBy === 'category' ? ( [ { color: CAT_COLOR.entry_point, label: 'Entry point' }, { color: CAT_COLOR.core_module, label: 'High fan-in' }, { color: CAT_COLOR.high_coupling,label: 'Recursive' }, { color: CAT_COLOR.regular, label: 'Regular' }, ].map(({ color, label }) => ( )) ) : ( Object.entries(LANG_COLOR).map(([lang, color]) => ( )) )}
{/* Canvas + Side Panel Drawer */}
{ setSelectedNode(node); setBlastRadius(null); }} />
{/* Function Details Inspector Drawer */} {selectedNode && ( { setSelectedNode(null); setBlastRadius(null); }} onBlastRadius={loadBlastRadius} onNeighbors={loadNeighbors} onTrace={loadTrace} /> )}
{/* Blast radius panel — shown below graph when active */} {brLoading && ( )} {blastRadius && !brLoading && ( setBlastRadius(null)} /> )}
)}
)}
); }; export default CallGraphAnalyzer;