import { AppBar, Box, Drawer, List, ListItemButton, ListItemText, Toolbar, Typography, } from "@mui/material"; import type { ReactNode } from "react"; import { useLocation } from "react-router"; import { useNavigate, type Path } from "@/router"; const DRAWER_WIDTH = 240; type NavItem = { label: string; to: Path; testId: string; }; const navItems: NavItem[] = [ { label: "Dashboard", to: "/", testId: "nav-dashboard" }, { label: "Approvals", to: "/approvals", testId: "nav-approvals" }, { label: "Settings", to: "/settings", testId: "nav-settings" }, ]; type AppShellProps = { children: ReactNode; }; export function AppShell({ children }: AppShellProps) { const location = useLocation(); const navigate = useNavigate(); return ( theme.zIndex.drawer + 1, borderBottom: 1, borderColor: "divider", bgcolor: "background.paper", color: "text.primary", }} > Sea Haven AP {navItems.map((item) => { const selected = item.to === "/" ? location.pathname === "/" : location.pathname === item.to || location.pathname.startsWith(`${item.to}/`); return ( navigate(item.to)} > ); })} {children} ); }