"use client"; import { LogOut } from "lucide-react"; import { usePathname } from "next/navigation"; import { logout } from "@/actions/auth"; import { NewHireButton } from "./NewHireButton"; const TITLES: Record = { "/": "Übersicht", "/employees": "Mitarbeiter:innen", "/orgchart": "Organigramm", "/positions": "Positionen & Bereiche", "/reports": "Berichte", "/audit": "Audit-Log", }; function titleFor(pathname: string): string { if (TITLES[pathname]) return TITLES[pathname]; const match = Object.keys(TITLES).find((key) => key !== "/" && pathname.startsWith(key)); return match ? TITLES[match] : "Alpenwerk HR"; } type TopbarProps = { userLabel: string; role?: string; canEdit: boolean; }; export function Topbar({ userLabel, role, canEdit }: TopbarProps) { const pathname = usePathname(); return (

{titleFor(pathname)}

{canEdit && }
{userLabel} {role && ({role === "hr_admin" ? "HR-Admin" : "Manager"})}
); }