"use client"; import { Building2, ClipboardCheck, ClipboardPlus, FileArchive, FileCog, Gauge, LayoutDashboard, LogOut, MapPin, Shield, Stethoscope, UserRound } from "lucide-react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useEffect } from "react"; import { useAuth } from "@/components/auth"; import { BrandLogo } from "@/components/brand/brand-logo"; const QUICKSTART_HREF = "/validations/quick-start"; const quickstartRoles = ["admin", "pruefer", "mitarbeiter"]; const navigation = [ { href: "/dashboard", label: "Dashboard", icon: LayoutDashboard }, { href: "/customers", label: "Kunden", icon: Building2 }, { href: "/locations", label: "Standorte", icon: MapPin }, { href: "/contacts", label: "Ansprechpartner", icon: UserRound }, { href: "/devices", label: "Geraete", icon: Stethoscope }, { href: "/equipment", label: "Pruefmittel", icon: Gauge }, { href: "/validations", label: "Validierungen", icon: ClipboardCheck }, { href: "/documents", label: "Dokumente", icon: FileArchive }, { href: "/settings/report-layout", label: "Berichtseinstellungen", icon: FileCog, adminOnly: true }, { href: "/users", label: "Benutzer", icon: Shield, adminOnly: true } ]; function canStartValidation(role?: string) { return role ? quickstartRoles.includes(role) : false; } function isActiveRoute(pathname: string, href: string) { if (href === "/validations") { return pathname === href || (pathname.startsWith(`${href}/`) && pathname !== QUICKSTART_HREF); } return pathname === href || pathname.startsWith(`${href}/`); } export function AppShell({ children }: { children: React.ReactNode }) { const pathname = usePathname(); const auth = useAuth(); const showQuickstart = canStartValidation(auth.user?.role); const quickstartActive = pathname === QUICKSTART_HREF; useEffect(() => { if (auth.user?.must_change_password && pathname !== "/profile/security") { window.location.replace("/profile/security"); } }, [auth.user?.must_change_password, pathname]); return (