Files
office_translator/office-translator-landing-page/components/admin-header.tsx
Sepehr Ramezani 26bd096a06 feat: production deployment - full update with providers, admin, glossaries, pricing, tests
Major changes across backend, frontend, infrastructure:
- Provider system with model selection (Google, DeepL, OpenAI, Ollama, Google Cloud)
- Admin panel: user management, pricing, settings
- Glossary system with CSV import/export
- Subscription and tier quota management
- Security hardening (rate limiting, API key auth, path traversal fixes)
- Docker compose for dev, prod, and IONOS deployment
- Alembic migrations for new tables
- Frontend: dashboard, pricing page, landing page, i18n (en/fr)
- Test suite and verification scripts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-25 15:01:47 +02:00

117 lines
3.9 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,
LayoutDashboard,
Users,
Activity,
Settings,
ChevronLeft,
Shield,
} from "lucide-react"
import Link from "next/link"
import { usePathname } from "next/navigation"
import { useState } from "react"
import { cn } from "@/lib/utils"
const navItems = [
{ label: "System Overview", href: "/admin", icon: LayoutDashboard },
{ label: "User Management", href: "/admin", icon: Users },
{ label: "Provider Status", href: "/admin", icon: Activity },
{ label: "Settings", href: "/admin/settings", icon: Settings },
]
export function AdminHeader() {
const [mobileOpen, setMobileOpen] = useState(false)
const pathname = usePathname()
return (
<>
<header className="flex h-12 shrink-0 items-center justify-between border-b border-border bg-card px-3 lg:px-4">
{/* Mobile menu */}
<Button
variant="ghost"
size="icon-sm"
className="lg:hidden"
onClick={() => setMobileOpen(!mobileOpen)}
aria-label="Toggle menu"
>
{mobileOpen ? <X className="size-3.5" /> : <Menu className="size-3.5" />}
</Button>
{/* Mobile brand */}
<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>
{/* Desktop title */}
<div className="hidden items-center gap-2 lg:flex">
<h1 className="text-xs font-semibold text-foreground">System Administration</h1>
<Separator orientation="vertical" className="h-3" />
<span className="text-xs text-muted-foreground">Monitor infrastructure and manage users</span>
</div>
{/* Right side */}
<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="mr-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>
{/* Mobile nav */}
{mobileOpen && (
<div className="border-b border-border bg-card px-3 py-2 lg:hidden">
<nav className="flex flex-col gap-0.5">
{navItems.map((item) => {
const isActive = pathname === item.href
return (
<Link
key={item.label}
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" />
{item.label}
</Link>
)
})}
<Separator className="my-1" />
<Link
href="/dashboard"
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>
</nav>
</div>
)}
</>
)
}