- Restructured docker-compose for Nginx Proxy Manager (no custom nginx) - Added domain wordly.art configuration - Added Prometheus + Grafana monitoring stack with pre-configured dashboards - Added PostgreSQL backup script to NAS (daily/weekly/monthly rotation) - Added alert rules for backend, system, and Docker metrics - Updated deployment guide for NPM + IONOS DNS homelab setup - Added marketing plan document - PDF translator and watermark support - Enhanced middleware, routes, and translator modules Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
113 lines
4.1 KiB
TypeScript
113 lines
4.1 KiB
TypeScript
"use client";
|
|
|
|
import { Badge } from "@/components/ui/badge";
|
|
import { Button } from "@/components/ui/button";
|
|
import { Separator } from "@/components/ui/separator";
|
|
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
|
|
import { Languages, Menu, X, ChevronLeft, Shield, LogOut } from "lucide-react";
|
|
import Link from "next/link";
|
|
import { usePathname } from "next/navigation";
|
|
import { useState } from "react";
|
|
import { cn } from "@/lib/utils";
|
|
import { useAdminLogin } from "./login/useAdminLogin";
|
|
import { adminNavItems } from "./constants";
|
|
import { useI18n } from "@/lib/i18n";
|
|
|
|
export function AdminHeader() {
|
|
const [mobileOpen, setMobileOpen] = useState(false);
|
|
const pathname = usePathname();
|
|
const { logout } = useAdminLogin();
|
|
const { t } = useI18n();
|
|
|
|
return (
|
|
<>
|
|
<header className="flex h-12 shrink-0 items-center justify-between border-b border-border bg-card px-3 lg:px-4">
|
|
<Button
|
|
variant="ghost"
|
|
size="icon"
|
|
className="lg:hidden h-8 w-8"
|
|
onClick={() => setMobileOpen(!mobileOpen)}
|
|
aria-label="Toggle menu"
|
|
>
|
|
{mobileOpen ? <X className="size-4" /> : <Menu className="size-4" />}
|
|
</Button>
|
|
|
|
<div className="flex items-center gap-1.5 lg:hidden">
|
|
<div className="flex size-5 items-center justify-center rounded bg-foreground">
|
|
<Languages className="size-2.5 text-background" />
|
|
</div>
|
|
<span className="text-xs font-semibold text-foreground">Admin</span>
|
|
</div>
|
|
|
|
<div className="hidden items-center gap-2 lg:flex">
|
|
<h1 className="text-xs font-semibold text-foreground">{t('admin.dashboard.title')}</h1>
|
|
<Separator orientation="vertical" className="h-3" />
|
|
<span className="text-xs text-muted-foreground">{t('admin.dashboard.subtitle')}</span>
|
|
</div>
|
|
|
|
<div className="flex items-center gap-2">
|
|
<Badge
|
|
variant="outline"
|
|
className="border-destructive/30 bg-destructive/5 text-destructive text-[10px] px-1.5 py-0"
|
|
>
|
|
<Shield className="me-1 size-2.5" />
|
|
Superadmin
|
|
</Badge>
|
|
<Avatar className="size-6">
|
|
<AvatarFallback className="bg-foreground text-background text-[10px] font-semibold">
|
|
SA
|
|
</AvatarFallback>
|
|
</Avatar>
|
|
</div>
|
|
</header>
|
|
|
|
{mobileOpen && (
|
|
<div className="border-b border-border bg-card px-3 py-2 lg:hidden">
|
|
<nav className="flex flex-col gap-0.5">
|
|
{adminNavItems.map((item) => {
|
|
const isActive = pathname === item.href;
|
|
return (
|
|
<Link
|
|
key={item.href}
|
|
href={item.href}
|
|
onClick={() => setMobileOpen(false)}
|
|
className={cn(
|
|
"flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors",
|
|
isActive
|
|
? "bg-secondary text-foreground"
|
|
: "text-muted-foreground hover:bg-secondary/60 hover:text-foreground"
|
|
)}
|
|
>
|
|
<item.icon className="size-3.5 shrink-0" />
|
|
{t(item.labelKey)}
|
|
</Link>
|
|
);
|
|
})}
|
|
<Separator className="my-1" />
|
|
<Link
|
|
href="/dashboard"
|
|
onClick={() => setMobileOpen(false)}
|
|
className="flex items-center gap-2.5 rounded-md px-2.5 py-1.5 text-xs font-medium text-muted-foreground hover:bg-secondary/60 hover:text-foreground"
|
|
>
|
|
<ChevronLeft className="size-3.5 shrink-0" />
|
|
User Dashboard
|
|
</Link>
|
|
<Button
|
|
variant="ghost"
|
|
size="sm"
|
|
className="h-7 justify-start gap-2 text-xs text-muted-foreground hover:text-destructive"
|
|
onClick={() => {
|
|
setMobileOpen(false);
|
|
logout();
|
|
}}
|
|
>
|
|
<LogOut className="size-3.5 shrink-0" />
|
|
Logout
|
|
</Button>
|
|
</nav>
|
|
</div>
|
|
)}
|
|
</>
|
|
);
|
|
}
|