"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useEffect, useState } from "react"; import { LayoutDashboard, LayoutGrid, Package, Building2, Users, UsersRound, Activity, BarChart3, Settings, PanelLeftClose, PanelLeftOpen, ChevronDown, } from "lucide-react"; import type { LucideIcon } from "lucide-react"; import { cn } from "@/lib/utils"; import { Logo } from "@/components/Logo"; import { useSidebarCollapsed } from "@/hooks/use-sidebar-collapsed"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; type NavItem = { label: string; href: string; icon: LucideIcon; children?: { label: string; href: string }[]; }; const NAV: NavItem[] = [ { label: "Dashboard", href: "/", icon: LayoutDashboard }, { label: "Pipeline", href: "/pipeline", icon: LayoutGrid }, { label: "Products", href: "/products", icon: Package }, { label: "Accounts", href: "/accounts", icon: Building2 }, { label: "Contacts", href: "/contacts", icon: Users }, { label: "Team", href: "/team", icon: UsersRound }, { label: "Reports", href: "/reports", icon: BarChart3, children: [ { label: "Weekly Reports", href: "/reports/weekly" }, { label: "Team Reports", href: "/reports/team" }, ], }, { label: "Activity", href: "/activity", icon: Activity }, ]; export function NavRail() { const pathname = usePathname(); const { collapsed, toggle } = useSidebarCollapsed(); const [reportsOpen, setReportsOpen] = useState(() => pathname.startsWith("/reports"), ); // Keep the Reports group open whenever the user is on one of its pages. useEffect(() => { if (pathname.startsWith("/reports")) setReportsOpen(true); }, [pathname]); return ( ); }