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>
113 lines
3.9 KiB
TypeScript
113 lines
3.9 KiB
TypeScript
"use client"
|
|
|
|
import { Avatar, AvatarFallback } from "@/components/ui/avatar"
|
|
import { Badge } from "@/components/ui/badge"
|
|
import { Button } from "@/components/ui/button"
|
|
import { Separator } from "@/components/ui/separator"
|
|
import { Languages, Menu, X } from "lucide-react"
|
|
import Link from "next/link"
|
|
import { useState } from "react"
|
|
import { usePathname } from "next/navigation"
|
|
import { cn } from "@/lib/utils"
|
|
import {
|
|
LayoutDashboard,
|
|
Key,
|
|
BookText,
|
|
CreditCard,
|
|
ChevronLeft,
|
|
} from "lucide-react"
|
|
|
|
const navItems = [
|
|
{ label: "Overview", href: "/dashboard", icon: LayoutDashboard },
|
|
{ label: "API Keys", href: "/dashboard/api-keys", icon: Key },
|
|
{ label: "Glossaries & Context", href: "/dashboard/glossaries", icon: BookText },
|
|
{ label: "Billing", href: "/dashboard/billing", icon: CreditCard },
|
|
]
|
|
|
|
export function DashboardHeader() {
|
|
const [mobileOpen, setMobileOpen] = useState(false)
|
|
const pathname = usePathname()
|
|
|
|
return (
|
|
<>
|
|
<header className="flex h-14 shrink-0 items-center justify-between border-b border-border bg-card px-4 lg:px-6">
|
|
{/* Mobile menu button */}
|
|
<Button
|
|
variant="ghost"
|
|
size="icon-sm"
|
|
className="lg:hidden"
|
|
onClick={() => setMobileOpen(!mobileOpen)}
|
|
aria-label="Toggle menu"
|
|
>
|
|
{mobileOpen ? <X className="size-4" /> : <Menu className="size-4" />}
|
|
</Button>
|
|
|
|
{/* Mobile brand */}
|
|
<div className="flex items-center gap-2 lg:hidden">
|
|
<div className="flex size-6 items-center justify-center rounded-md bg-foreground">
|
|
<Languages className="size-3 text-background" />
|
|
</div>
|
|
<span className="text-sm font-semibold text-foreground">Office Translator</span>
|
|
</div>
|
|
|
|
{/* Page title - desktop */}
|
|
<div className="hidden items-center gap-3 lg:flex">
|
|
<h1 className="text-sm font-semibold text-foreground">Dashboard</h1>
|
|
<Separator orientation="vertical" className="h-4" />
|
|
<span className="text-sm text-muted-foreground">Manage your API and translation settings</span>
|
|
</div>
|
|
|
|
{/* Right side */}
|
|
<div className="flex items-center gap-3">
|
|
<Badge
|
|
variant="secondary"
|
|
className="border border-accent/20 bg-accent/10 text-accent"
|
|
>
|
|
Pro Plan
|
|
</Badge>
|
|
<Avatar className="size-8">
|
|
<AvatarFallback className="bg-accent text-accent-foreground text-xs font-semibold">
|
|
JD
|
|
</AvatarFallback>
|
|
</Avatar>
|
|
</div>
|
|
</header>
|
|
|
|
{/* Mobile navigation drawer */}
|
|
{mobileOpen && (
|
|
<div className="border-b border-border bg-card px-4 py-3 lg:hidden">
|
|
<nav className="flex flex-col gap-1">
|
|
{navItems.map((item) => {
|
|
const isActive = pathname === item.href
|
|
return (
|
|
<Link
|
|
key={item.href}
|
|
href={item.href}
|
|
onClick={() => setMobileOpen(false)}
|
|
className={cn(
|
|
"flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors",
|
|
isActive
|
|
? "bg-secondary text-foreground"
|
|
: "text-muted-foreground hover:bg-secondary/60 hover:text-foreground"
|
|
)}
|
|
>
|
|
<item.icon className="size-4 shrink-0" />
|
|
{item.label}
|
|
</Link>
|
|
)
|
|
})}
|
|
<Separator className="my-2" />
|
|
<Link
|
|
href="/"
|
|
className="flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground hover:bg-secondary/60 hover:text-foreground"
|
|
>
|
|
<ChevronLeft className="size-4 shrink-0" />
|
|
Back to home
|
|
</Link>
|
|
</nav>
|
|
</div>
|
|
)}
|
|
</>
|
|
)
|
|
}
|