import { useState } from 'react' import { Link, Outlet, useLocation } from 'react-router-dom' import Brand from '@/components/brand/Brand' import LanguageSwitcher from '@/components/brand/LanguageSwitcher' import Icon from '@/components/ui/Icon' import MobileDrawer from './MobileDrawer' import SidebarNav, { NAV_ITEMS } from './SidebarNav' import SignOutButton from './SignOutButton' import UserBadge from './UserBadge' import { useT } from '@/i18n/useT' /** Title of the current /app page for the top bar, from the nav table. */ function pageTitleKey(pathname: string): string { const match = NAV_ITEMS.find((item) => item.end ? item.to === pathname : pathname.startsWith(item.to) && item.to !== '/', ) return match?.labelKey ?? 'shell.nav.dashboard' } /** * Authenticated shell: fixed sidebar on large screens, light top bar with a * drawer button below. The page content scrolls on its own. */ export default function AppLayout() { const t = useT() const location = useLocation() const [drawerOpen, setDrawerOpen] = useState(false) return (

{t(pageTitleKey(location.pathname))}

setDrawerOpen(false)} />
) }