'use client'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { cn } from '@/lib/utils'; import { useSidebarStore } from '@/lib/stores/use-sidebar-store'; import { LayoutDashboard, ListTodo, Flame, FolderKanban, NotebookPen, BookOpen, Share2, LayoutGrid, CalendarDays, Search, Bot, Settings, ChevronLeft, ChevronRight, } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { ScrollArea } from '@/components/ui/scroll-area'; import { Separator } from '@/components/ui/separator'; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip'; import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, } from '@/components/ui/sheet'; const navItems = [ { href: '/dashboard', label: 'Dashboard', icon: LayoutDashboard }, { href: '/tasks', label: 'Tasks', icon: ListTodo }, { href: '/habits', label: 'Habits', icon: Flame }, { href: '/projects', label: 'Projects', icon: FolderKanban }, { href: '/notes', label: 'Notes', icon: NotebookPen }, { href: '/daily-notes', label: 'Daily Note', icon: BookOpen }, { href: '/graph', label: 'Graph', icon: Share2 }, { href: '/canvas', label: 'Canvas', icon: LayoutGrid }, { href: '/calendar', label: 'Calendar', icon: CalendarDays }, { href: '/search', label: 'Search', icon: Search }, ]; const workspaceItems = [ { href: '/agents', label: 'Agent Activity', icon: Bot }, { href: '/settings', label: 'Settings', icon: Settings }, ]; export function Sidebar() { const pathname = usePathname(); const { collapsed, toggle, mobileOpen, setMobileOpen } = useSidebarStore(); const navigation = (isCollapsed: boolean, onNavigate?: () => void) => ( {navItems.map((item) => { const isActive = pathname === item.href || pathname.startsWith(item.href + '/'); const link = ( {!isCollapsed && {item.label}} ); if (isCollapsed) { return ( {link} {item.label} ); } return link; })} {!isCollapsed && ( Workspace )} {workspaceItems.map((item) => { const isActive = pathname === item.href || pathname.startsWith(item.href + '/'); const link = ( {!isCollapsed && {item.label}} ); if (isCollapsed) { return ( {link} {item.label} ); } return link; })} ); return ( Project E Navigate your workspace. {navigation(false, () => setMobileOpen(false))} ); }
Workspace