"use client"; import { useEffect, useState } from "react"; const TYPE_STYLES: Record = { Function: { color: "var(--accent)", bg: "var(--accent-glow)" }, Class: { color: "var(--green)", bg: "var(--green-dim)" }, Method: { color: "var(--yellow)", bg: "var(--yellow-dim)" }, }; export function ProcessPanel() { const [processes, setProcesses] = useState([]); const [loading, setLoading] = useState(true); const [expanded, setExpanded] = useState(null); const [detail, setDetail] = useState(null); useEffect(() => { fetch("/api/processes") .then((r) => r.json()) .then((data) => { setProcesses(data.processes || []); setLoading(false); }) .catch(() => setLoading(false)); }, []); const loadDetail = async (uid: string) => { if (expanded === uid) { setExpanded(null); setDetail(null); return; } setExpanded(uid); const res = await fetch(`/api/process/${encodeURIComponent(uid)}`); const data = await res.json(); setDetail(data); }; if (loading) { return (
{[1, 2, 3, 4].map((i) => (
))}
); } return (

Execution Flows

{processes.length}
{processes.map((proc, i) => { const isOpen = expanded === proc.uid; return (
{isOpen && detail?.steps && (
{detail.steps.map((step: any, j: number) => { const style = TYPE_STYLES[step.type] || TYPE_STYLES.Function; return (
{step.type} {step.name} {step.file}:{step.line}
); })}
)} {isOpen && detail?.step_symbols && !detail?.steps && (
{detail.step_symbols.map((step: any, j: number) => { const style = TYPE_STYLES[step.type] || TYPE_STYLES.Function; return (
{step.type} {step.name} {step.file}
); })}
)}
); })}
); }