"use client"; import { useEffect, useState } from "react"; import { GraphViewer } from "@/components/GraphViewer"; import { SearchBar } from "@/components/SearchBar"; import { SymbolDetail } from "@/components/SymbolDetail"; import { StatsPanel } from "@/components/StatsPanel"; import { ClusterPanel } from "@/components/ClusterPanel"; import { ProcessPanel } from "@/components/ProcessPanel"; type Tab = "graph" | "clusters" | "processes"; const TAB_CONFIG: { key: Tab; label: string; icon: string }[] = [ { key: "graph", label: "Graph", icon: "⬡" }, { key: "clusters", label: "Clusters", icon: "◎" }, { key: "processes", label: "Flows", icon: "⇢" }, ]; export default function Home() { const [selectedUid, setSelectedUid] = useState(null); const [activeTab, setActiveTab] = useState("graph"); const [stats, setStats] = useState(null); const [error, setError] = useState(null); useEffect(() => { fetch("/api/stats") .then((r) => { if (!r.ok) throw new Error("Backend not running"); return r.json(); }) .then(setStats) .catch(() => setError("Cannot connect to backend. Run: codegraph serve")); }, []); if (error) { return (

Connection Error

{error}

codegraph serve ./your-project
); } return (
{/* Header */}
CG

CodeGraph

Intelligence Engine

{/* Tabs */} {/* Main content */}
{/* Left: Visualization */}
{activeTab === "graph" && } {activeTab === "clusters" && } {activeTab === "processes" && }
{/* Right: Detail panel */} {selectedUid && (

Symbol Detail

)}
); }