'use client' import { useState, type ReactNode } from 'react' import Link from 'next/link' import { usePathname } from 'next/navigation' import { BarChart3, Brain, Camera, ChevronRight, Coins, Cpu, FileText, FolderOpen, GitBranch, HeartPulse, Key, LayoutDashboard, ListTree, Puzzle, Settings, Sparkles, Terminal, Wrench, } from 'lucide-react' import type { ComponentType } from 'react' import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarFooter, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarRail, } from '@/components/ui/sidebar' import { getPlugins } from '@/lib/plugins' import '@/plugins' interface NavItem { title: ReactNode icon: ComponentType<{ className?: string }> href: string } interface NavGroup { title: string icon: ComponentType<{ className?: string }> items: NavItem[] } const topItems: NavItem[] = [ { title: 'Dashboard', icon: LayoutDashboard, href: '/' }, { title: 'CRAFT Coach', icon: HeartPulse, href: '/coach' }, ] const navGroups: NavGroup[] = [ { title: 'Projects', icon: FolderOpen, items: [ { title: 'Overview', icon: FolderOpen, href: '/projects' }, { title: 'Sessions', icon: ListTree, href: '/sessions' }, ], }, { title: 'Usage', icon: BarChart3, items: [ { title: 'Daily Usage', icon: BarChart3, href: '/daily' }, { title: 'Token Breakdown', icon: Coins, href: '/tokens' }, { title: 'Tool Usage', icon: Wrench, href: '/tools' }, { title: 'Command Usage', icon: Terminal, href: '/commands' }, { title: 'Model Usage', icon: Cpu, href: '/models' }, ], }, { title: 'Insights', icon: Brain, items: [ { title: 'Personality Fit', icon: Brain, href: '/personality' }, { title: 'Session Flow', icon: GitBranch, href: '/flow' }, { title: 'AI Insights', icon: Sparkles, href: '/ai-insights' }, { title: 'Image Analysis', icon: Camera, href: '/images' }, { title: 'Reports', icon: FileText, href: '/reports' }, ], }, ] function CollapsibleGroup({ group, pathname }: { group: NavGroup; pathname: string }) { const isActive = group.items.some((item) => pathname === item.href) const [open, setOpen] = useState(isActive) return ( setOpen(!open)}> {group.title} {open && ( {group.items.map((item) => ( } isActive={pathname === item.href} > {item.title} ))} )} ) } export function AppSidebar() { const pathname = usePathname() const plugins = getPlugins() return (
AgentFit
AgentFit
Navigation {topItems.map((item) => ( } isActive={pathname === item.href} > {item.title} ))} {navGroups.map((group) => ( ))} {plugins.length > 0 && ( } isActive={pathname.startsWith('/community')} > Community )} } isActive={pathname === '/data-management'} > Data Management } isActive={pathname === '/settings'} > Settings
GitHub
) }