diff --git a/frontend/src/components/AppSidebar.tsx b/frontend/src/components/AppSidebar.tsx index 746990b..6083e8a 100644 --- a/frontend/src/components/AppSidebar.tsx +++ b/frontend/src/components/AppSidebar.tsx @@ -27,6 +27,7 @@ import { SidebarGroup, SidebarGroupContent, SidebarGroupLabel, + useSidebar, } from "./ui/sidebar"; const navigation = [ @@ -39,6 +40,7 @@ const navigation = [ export function AppSidebar({ ...props }: React.ComponentProps) { const location = useLocation(); const [accountsExpanded, setAccountsExpanded] = useState(false); + const { isMobile, setOpenMobile } = useSidebar(); const { data: accounts } = useQuery({ queryKey: ["accounts"], @@ -51,6 +53,13 @@ export function AppSidebar({ ...props }: React.ComponentProps) { return sum + primaryBalance; }, 0) || 0; + // Handler to close mobile sidebar when navigation item is clicked + const handleNavigationClick = () => { + if (isMobile) { + setOpenMobile(false); + } + }; + return ( @@ -60,7 +69,7 @@ export function AppSidebar({ ...props }: React.ComponentProps) { asChild className="data-[slot=sidebar-menu-button]:!p-1.5" > - + Leggen @@ -80,7 +89,7 @@ export function AppSidebar({ ...props }: React.ComponentProps) { tooltip={item.name} isActive={location.pathname === item.to} > - + {item.name}