diff --git a/src/food-market.web/src/components/AppLayout.tsx b/src/food-market.web/src/components/AppLayout.tsx index f1f5821..64a32d0 100644 --- a/src/food-market.web/src/components/AppLayout.tsx +++ b/src/food-market.web/src/components/AppLayout.tsx @@ -1,4 +1,5 @@ -import { NavLink, Outlet } from 'react-router-dom' +import { useState, useEffect } from 'react' +import { NavLink, Outlet, useLocation } from 'react-router-dom' import { useQuery } from '@tanstack/react-query' import { api } from '@/lib/api' import { logout } from '@/lib/auth' @@ -6,7 +7,7 @@ import { cn } from '@/lib/utils' import { LayoutDashboard, Package, FolderTree, Ruler, Tag, Users, Warehouse, Store as StoreIcon, Globe, Coins, LogOut, Download, - Boxes, History, TruckIcon, ShoppingCart, Settings, + Boxes, History, TruckIcon, ShoppingCart, Settings, Menu, X, } from 'lucide-react' import { Logo } from './Logo' @@ -64,54 +65,98 @@ export function AppLayout() { staleTime: 5 * 60 * 1000, }) + const [drawerOpen, setDrawerOpen] = useState(false) + const location = useLocation() + // Закрывать drawer при смене маршрута. + useEffect(() => { setDrawerOpen(false) }, [location.pathname]) + + const sidebar = ( + <> +
+ + +
+ + + +
+ {me && ( +
+
{me.name}
+
{me.roles.join(', ')}
+
+ )} + +
+ + ) + return ( -
-