import { useState, useEffect } from "react"; import { Outlet, Link, useLocation } from "react-router-dom"; import { Terminal } from "../components/terminal/Terminal"; import { useWebSocket } from "../hooks/useWebSocket"; import { useTheme } from "../hooks/useTheme"; const NAV_ITEMS = [ { path: "/", label: "Home" }, { path: "/editor", label: "Editor" }, { path: "/build", label: "Build" }, { path: "/server", label: "Server" }, { path: "/toolset", label: "Toolset" }, { path: "/repos", label: "Repos" }, ]; export function IDELayout({ sidebar }: { sidebar?: React.ReactNode }) { const [terminalOpen, setTerminalOpen] = useState(false); const [upstreamBehind, setUpstreamBehind] = useState(0); const location = useLocation(); const { subscribe } = useWebSocket(); const { theme, toggleTheme } = useTheme(); useEffect(() => { return subscribe("git:upstream-update", (event) => { const data = event.data as { behind: number }; if (data.behind > 0) { setUpstreamBehind((prev) => prev + data.behind); } }); }, [subscribe]); useEffect(() => { if (location.pathname === "/repos") { setUpstreamBehind(0); } }, [location.pathname]); return (

Layonara Forge

{sidebar && ( )}
{terminalOpen && (
)}
); }