diff --git a/inventory/src/components/layout/AppSidebar.tsx b/inventory/src/components/layout/AppSidebar.tsx index da72243..ba464f5 100644 --- a/inventory/src/components/layout/AppSidebar.tsx +++ b/inventory/src/components/layout/AppSidebar.tsx @@ -10,6 +10,7 @@ import { ShoppingBag, Truck, MessageCircle, + LayoutDashboard, } from "lucide-react"; import { IconCrystalBall } from "@tabler/icons-react"; import { @@ -17,6 +18,7 @@ import { SidebarContent, SidebarGroup, SidebarGroupContent, + SidebarGroupLabel, SidebarHeader, SidebarFooter, SidebarMenu, @@ -28,12 +30,21 @@ import { import { useLocation, useNavigate, Link } from "react-router-dom"; import { Protected } from "@/components/auth/Protected"; -const items = [ +const dashboardItems = [ + { + title: "Dashboard", + icon: LayoutDashboard, + url: "", + permission: "access:dashboard" + } +]; + +const inventoryItems = [ { title: "Overview", icon: Home, url: "/", - permission: "access:dashboard" + permission: "access:overview" }, { title: "Products", @@ -76,15 +87,21 @@ const items = [ icon: IconCrystalBall, url: "/forecasting", permission: "access:forecasting" - }, + } +]; + +const productSetupItems = [ { title: "Create Products", icon: Plus, url: "/import", permission: "access:import" - }, + } +]; + +const chatItems = [ { - title: "Chat", + title: "Chat Archive", icon: MessageCircle, url: "/chat", permission: "access:chat" @@ -102,6 +119,46 @@ export function AppSidebar() { navigate('/login'); }; + const renderMenuItems = (items: typeof inventoryItems) => { + return items.map((item) => { + const isActive = + location.pathname === item.url || + (item.url !== "/" && item.url !== "#" && location.pathname.startsWith(item.url)); + return ( + + + + {item.url === "#" ? ( +
+ + + {item.title} + +
+ ) : ( + + + + {item.title} + + + )} +
+
+
+ ); + }); + }; + return ( @@ -122,42 +179,53 @@ export function AppSidebar() { + {/* Dashboard Section */} + Dashboard - {items.map((item) => { - const isActive = - location.pathname === item.url || - (item.url !== "/" && location.pathname.startsWith(item.url)); - return ( - - - - - - - {item.title} - - - - - - ); - })} + {renderMenuItems(dashboardItems)} + + + + + + {/* Inventory Section */} + + Inventory + + + {renderMenuItems(inventoryItems)} + + + + + + {/* Product Setup Section */} + + Product Setup + + + {renderMenuItems(productSetupItems)} + + + + + + {/* Chat Section */} + + Chat + + + {renderMenuItems(chatItems)} + {/* Settings Section */} +