import { NavLink, Outlet, useLocation, useNavigate } from "react-router-dom"; import { useSession } from "../lib/session"; const PAGE_TITLES: Record = { "/home": "Startseite", "/admin/dashboard": "Admin Dashboard", "/samples/new": "Neuanlage einer Probe", "/portal": "MUH-Portal", "/report-template": "Bericht", }; function resolvePageTitle(pathname: string) { if (pathname.includes("/anamnesis")) { return "Anamnese"; } if (pathname.includes("/antibiogram")) { return "Antibiogramm"; } if (pathname.includes("/therapy")) { return "Therapieempfehlung"; } if (pathname.includes("/registration")) { return "Probe bearbeiten"; } if (pathname.startsWith("/admin/landwirte")) { return "Die Verwaltung der Landwirte"; } if (pathname.startsWith("/admin/benutzer")) { return "Verwaltung | Benutzer"; } if (pathname.startsWith("/admin/medikamente")) { return "Die Verwaltung der Medikamente"; } if (pathname.startsWith("/admin/erreger")) { return "Die Verwaltung der Erreger"; } if (pathname.startsWith("/admin/antibiogramm")) { return "Die Verwaltung der Antibiogramme"; } if (pathname.startsWith("/search/landwirt")) { return "Suche | Landwirt"; } if (pathname.startsWith("/search/probe")) { return "Suche | Probe"; } if (pathname.startsWith("/search/kalendar")) { return "Suche | Kalendar"; } return PAGE_TITLES[pathname] ?? "MUH App"; } export default function AppShell() { const { user, setSession } = useSession(); const location = useLocation(); const navigate = useNavigate(); return (

{resolvePageTitle(location.pathname)}

); }