import { CaretDownIcon, CaretRightIcon, CubeIcon, ChatDotsIcon, HardDrivesIcon, GitBranchIcon, EnvelopeIcon, DatabaseIcon, LightningIcon, ClockIcon, UsersIcon, CpuIcon, WrenchIcon, KeyIcon, PlayCircleIcon, CheckCircleIcon, SunIcon, MoonIcon, MonitorIcon, SignpostIcon, TreeStructureIcon, ChatCircleIcon, StackIcon, GitMergeIcon, MicrophoneIcon, ShieldIcon, ArrowsClockwiseIcon, XIcon } from "@phosphor-icons/react"; import { useState, useEffect } from "react"; import { NavLink, useLocation } from "react-router-dom"; import { Button, Link } from "@cloudflare/kumo"; import { PoweredByAgents } from "@cloudflare/agents-ui"; import { useTheme } from "../hooks/useTheme"; interface NavItem { label: string; path: string; icon: React.ReactNode; } interface NavCategory { label: string; icon: React.ReactNode; items: NavItem[]; } const navigation: NavCategory[] = [ { label: "Core", icon: , items: [ { label: "State", path: "/core/state", icon: }, { label: "Callable", path: "/core/callable", icon: }, { label: "Streaming", path: "/core/streaming", icon: }, { label: "Schedule", path: "/core/schedule", icon: }, { label: "Connections", path: "/core/connections", icon: }, { label: "SQL", path: "/core/sql", icon: }, { label: "Routing", path: "/core/routing", icon: }, { label: "Readonly", path: "/core/readonly", icon: }, { label: "Retry", path: "/core/retry", icon: } ] }, { label: "AI", icon: , items: [ { label: "Chat", path: "/ai/chat", icon: }, { label: "Tools", path: "/ai/tools", icon: }, { label: "Codemode", path: "/ai/codemode", icon: } ] }, { label: "MCP", icon: , items: [ { label: "Server", path: "/mcp/server", icon: }, { label: "Client", path: "/mcp/client", icon: }, { label: "OAuth", path: "/mcp/oauth", icon: } ] }, { label: "Workflows", icon: , items: [ { label: "Basic", path: "/workflow/basic", icon: }, { label: "Approval", path: "/workflow/approval", icon: } ] }, { label: "Multi-Agent", icon: , items: [ { label: "Supervisor", path: "/multi-agent/supervisor", icon: }, { label: "Chat Rooms", path: "/multi-agent/rooms", icon: }, { label: "Workers", path: "/multi-agent/workers", icon: }, { label: "Pipeline", path: "/multi-agent/pipeline", icon: } ] }, { label: "Voice", icon: , items: [ { label: "Voice Chat", path: "/voice/chat", icon: } ] }, { label: "Email", icon: , items: [ { label: "Receive", path: "/email/receive", icon: }, { label: "Secure Replies", path: "/email/secure", icon: } ] } ]; function CategorySection({ category, onNavigate }: { category: NavCategory; onNavigate?: () => void; }) { const [isOpen, setIsOpen] = useState(true); return (
{isOpen && (
{category.items.map((item) => ( `flex items-center gap-2 px-3 py-2 text-sm rounded-md transition-colors ${ isActive ? "bg-kumo-control text-kumo-default font-medium" : "text-kumo-subtle hover:bg-kumo-tint hover:text-kumo-default" }` } > {item.icon} {item.label} ))}
)}
); } function ModeToggle() { const { mode, setMode } = useTheme(); const cycleMode = () => { if (mode === "system") setMode("light"); else if (mode === "light") setMode("dark"); else setMode("system"); }; const icon = mode === "system" ? ( ) : mode === "light" ? ( ) : ( ); return ( ); } function SidebarContent({ onNavigate }: { onNavigate?: () => void }) { return ( <>
{onNavigate && (
GitHub {" ยท "} Docs
); } interface SidebarProps { open: boolean; onClose: () => void; } export function Sidebar({ open, onClose }: SidebarProps) { const location = useLocation(); useEffect(() => { onClose(); }, [location.pathname, onClose]); return ( <> {/* Desktop: static sidebar */} {/* Mobile: overlay drawer */} {open && (
{/* Backdrop */}
)} ); }