diff --git a/inventory/src/components/layout/AppSidebar.tsx b/inventory/src/components/layout/AppSidebar.tsx index 9af2f25..f1417a9 100644 --- a/inventory/src/components/layout/AppSidebar.tsx +++ b/inventory/src/components/layout/AppSidebar.tsx @@ -1,16 +1,26 @@ -import { Home, Package, ShoppingCart, BarChart2, Settings, Box, ClipboardList } from "lucide-react"; +import { + Home, + Package, + ShoppingCart, + BarChart2, + Settings, + Box, + ClipboardList, + LogOut, +} from "lucide-react"; import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarHeader, + SidebarFooter, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarSeparator, } from "@/components/ui/sidebar"; -import { useLocation } from "react-router-dom"; +import { useLocation, useNavigate } from "react-router-dom"; const items = [ { @@ -38,18 +48,26 @@ const items = [ icon: BarChart2, url: "/analytics", }, - ]; export function AppSidebar() { const location = useLocation(); - + const navigate = useNavigate(); + + const handleLogout = () => { + sessionStorage.removeItem('isLoggedIn'); + sessionStorage.removeItem('token'); + navigate('/login'); + }; + return (
-

Inventory Manager

+

+ Inventory Manager +

@@ -58,14 +76,21 @@ export function AppSidebar() { {items.map((item) => { - const isActive = location.pathname === item.url || + const isActive = + location.pathname === item.url || (item.url !== "/" && location.pathname.startsWith(item.url)); return ( - + - {item.title} + + {item.title} + @@ -76,25 +101,39 @@ export function AppSidebar() { - - + + + + + + + + + Settings + + + + + + + + + - - - - Settings - + + - - - +
); -} \ No newline at end of file +}