diff --git a/src/components/SidebarNav.tsx b/src/components/SidebarNav.tsx index e597ac0..b389edc 100644 --- a/src/components/SidebarNav.tsx +++ b/src/components/SidebarNav.tsx @@ -1,73 +1,61 @@ -import { Link, useLocation } from 'react-router-dom'; -import { cn } from '@/lib/utils'; +"use client" -interface SidebarNavProps extends React.HTMLAttributes { - onLinkClick?: () => void; +import React from "react" +import { Link, useLocation } from "react-router-dom" +import { cn } from "@/lib/utils" +import { Button } from "@/components/ui/button" +import { ScrollArea } from "@/components/ui/scroll-area" + +// Define the structure for navigation items +interface NavItem { + href: string + title: string + icon: React.ElementType // Using React.ElementType for the icon component } -export function SidebarNav({ className, onLinkClick, ...props }: SidebarNavProps) { - const { pathname } = useLocation(); +// Navigation items for the sidebar +const navItems: NavItem[] = [ + { + href: "/dashboard", + title: "Dashboard", + icon: React.lazy(() => import("lucide-react").then(mod => ({ default: mod.LayoutDashboard }))), + }, + { + href: "/suppliers", + title: "Suppliers", + icon: React.lazy(() => import("lucide-react").then(mod => ({ default: mod.Building2 }))), + }, +] - const navItems = [ - { - title: 'Dashboard', - href: '/', - }, - { - title: 'Stock', - href: '/stock', - }, - { - title: 'Book Out Stock', - href: '/book-out', - }, - { - title: 'Customers', - href: '/customers', - }, - { - title: 'Suppliers', // New nav item - href: '/suppliers', - }, - { - title: 'Reports', - href: '/reports', - }, - { - title: 'Purchase Orders', - href: '/purchase-orders', - }, - { - title: 'Products', - href: '/products', - }, - { - title: 'Orders', - href: '/orders', - }, - { - title: 'Settings', - href: '/settings', - }, - ]; +interface SidebarNavProps { + className?: string + onLinkClick?: () => void // Added onLinkClick prop +} + +export function SidebarNav({ className, onLinkClick }: SidebarNavProps) { + const location = useLocation() return ( -