feat(PROJ-17): Admin Dashboard Systemauslastung immer anzeigen
- Systemauslastungs-Sektion wird immer gerendert (nicht nur bei Erfolg) - Fehlermeldung wenn /api/admin/system/stats nicht erreichbar ist - Feature-Status auf In Review gesetzt Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { logout } from "@/lib/api";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
|
||||
interface NavbarProps {
|
||||
username: string;
|
||||
role: string;
|
||||
}
|
||||
|
||||
export function Navbar({ username, role }: NavbarProps) {
|
||||
const router = useRouter();
|
||||
|
||||
async function handleLogout() {
|
||||
try {
|
||||
await logout();
|
||||
} catch {
|
||||
// ignore logout errors
|
||||
}
|
||||
localStorage.removeItem("archivmail_token");
|
||||
router.push("/");
|
||||
}
|
||||
|
||||
return (
|
||||
<nav
|
||||
className="border-b bg-background"
|
||||
aria-label="Hauptnavigation"
|
||||
>
|
||||
<div className="mx-auto flex h-14 max-w-7xl items-center justify-between px-4">
|
||||
<div className="flex items-center gap-6">
|
||||
<Link
|
||||
href="/search"
|
||||
className="text-lg font-bold tracking-tight"
|
||||
>
|
||||
archivmail
|
||||
</Link>
|
||||
<Link
|
||||
href="/search"
|
||||
className="text-sm text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
Suche
|
||||
</Link>
|
||||
<Link
|
||||
href="/imap"
|
||||
className="text-sm text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
IMAP Import
|
||||
</Link>
|
||||
{role === "admin" && (
|
||||
<Link
|
||||
href="/admin"
|
||||
className="text-sm text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
Admin
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<span className="text-sm">{username}</span>
|
||||
<Badge variant="secondary">{role}</Badge>
|
||||
<Button variant="outline" size="sm" onClick={handleLogout}>
|
||||
Abmelden
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user