Epic 20 (UI-Redesign) angelegt, Stufe 1: CSS-Variablen für Dark Mode (System-Präferenz + manueller Schalter via ThemeToggle, localStorage- persistiert) und eigene Farbtokens für Einsatzbereitschaft (ready/ limited/not-ready/unknown), Basis für ReadinessBadge in UI-003. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVgbozhYmuEhiEJHffRXCV
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
import type { ReactNode } from "react";
|
|
import { NavLink, useNavigate } from "react-router-dom";
|
|
|
|
import { useAuth } from "../auth/AuthContext";
|
|
import { ThemeToggle } from "./ThemeToggle";
|
|
|
|
/** Gemeinsamer Rahmen (Kopfzeile + Navigation) für alle eingeloggten Screens. */
|
|
export function AppShell({ children }: { children: ReactNode }) {
|
|
const { istAdmin, istVerantwortlich, logout } = useAuth();
|
|
const navigate = useNavigate();
|
|
|
|
function handleLogout() {
|
|
logout();
|
|
navigate("/login");
|
|
}
|
|
|
|
return (
|
|
<div className="app-shell">
|
|
<header className="topbar">
|
|
<NavLink to="/objekte" className="topbar-brand">
|
|
MABEA
|
|
</NavLink>
|
|
<nav className="topbar-nav">
|
|
<NavLink to="/objekte" className={({ isActive }) => (isActive ? "active" : "")}>
|
|
Objekte
|
|
</NavLink>
|
|
<NavLink to="/maengel" className={({ isActive }) => (isActive ? "active" : "")}>
|
|
Mängel
|
|
</NavLink>
|
|
{istVerantwortlich && (
|
|
<NavLink to="/dashboard" className={({ isActive }) => (isActive ? "active" : "")}>
|
|
Dashboard
|
|
</NavLink>
|
|
)}
|
|
{istVerantwortlich && (
|
|
<NavLink to="/fehlbestaende" className={({ isActive }) => (isActive ? "active" : "")}>
|
|
Fehlbestände
|
|
</NavLink>
|
|
)}
|
|
{istVerantwortlich && (
|
|
<NavLink to="/admin" className={({ isActive }) => (isActive ? "active" : "")}>
|
|
{istAdmin ? "Administration" : "Verwaltung"}
|
|
</NavLink>
|
|
)}
|
|
<ThemeToggle />
|
|
<button className="btn btn-secondary" onClick={handleLogout}>
|
|
Abmelden
|
|
</button>
|
|
</nav>
|
|
</header>
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|