import type { ReactNode } from "react"; import { useShallow } from "zustand/react/shallow"; import { useAppState } from "../../store/appState"; import ProjectList from "../projects/ProjectList"; import McpPanel from "../mcp/McpPanel"; import SettingsPanel from "../settings/SettingsPanel"; type SidebarView = "projects" | "mcp" | "settings"; const RAIL_ICONS: { view: SidebarView; label: string; icon: ReactNode }[] = [ { view: "projects", label: "Projects", icon: ( ), }, { view: "mcp", label: "MCP", icon: ( ), }, { view: "settings", label: "Settings", icon: ( ), }, ]; export default function Sidebar() { const { sidebarView, setSidebarView, sidebarCollapsed, setSidebarCollapsed, toggleSidebarCollapsed } = useAppState( useShallow(s => ({ sidebarView: s.sidebarView, setSidebarView: s.setSidebarView, sidebarCollapsed: s.sidebarCollapsed, setSidebarCollapsed: s.setSidebarCollapsed, toggleSidebarCollapsed: s.toggleSidebarCollapsed, })) ); if (sidebarCollapsed) { const railBtn = (view: SidebarView, label: string, icon: ReactNode) => { const active = sidebarView === view; return ( ); }; return (
{RAIL_ICONS.map(({ view, label, icon }) => railBtn(view, label, icon))}
); } const tabCls = (view: SidebarView) => `flex-1 px-3 py-2 text-sm font-medium transition-colors ${ sidebarView === view ? "text-[var(--accent)] border-b-2 border-[var(--accent)]" : "text-[var(--text-secondary)] hover:text-[var(--text-primary)]" }`; return (
{/* Nav tabs */}
{/* Content */}
{sidebarView === "projects" ? ( ) : sidebarView === "mcp" ? ( ) : ( )}
); }