"use client" import { Activity, BarChart3, ChevronsLeft, ChevronsRight, ClipboardList, Code, ComputerIcon, DollarSign, Home, KeyRound, type LucideIcon, Package, Shield, Users, } from "lucide-react" import Link from "next/link" import { usePathname } from "next/navigation" import { createContext, type ReactNode, useContext, useState } from "react" import { twJoin } from "tailwind-merge" 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" // Navigation Context interface NavigationContextType { collapsed: boolean pathname: string isActive: (path: string) => boolean } const NavigationContext = createContext( undefined, ) const useNavigation = () => { const context = useContext(NavigationContext) if (!context) { throw new Error("Navigation components must be used within Navigation") } return context } // NavGroup Component interface NavGroupProps { title: string children: ReactNode } function NavGroup({ title, children }: NavGroupProps) { const { collapsed } = useNavigation() return (
{!collapsed && (

{title}

)}
) } // NavItem Component interface NavItemProps { href: string icon: LucideIcon label: string } function NavItem({ href, icon: Icon, label }: NavItemProps) { const { collapsed, isActive } = useNavigation() const active = isActive(href) const linkContent = ( {!collapsed && {label}} ) if (collapsed) { return (
  • {linkContent}

    {label}

  • ) } return
  • {linkContent}
  • } // NavSeparator Component function NavSeparator() { const { collapsed } = useNavigation() if (collapsed) return null return (
    ) } // Main Navigation Component export default function Navigation() { const [collapsed, setCollapsed] = useState(false) const pathname = usePathname() const isActive = (path: string) => { return path === "/" ? pathname === path : pathname.startsWith(path) } const contextValue: NavigationContextType = { collapsed, pathname, isActive, } return ( ) }