mc-dashboard/components/Navbar.tsx
hurkicorgi 6c91f7fef0 UX/UI/perf pass: admin tabs, theme toggle, log polish, mod search, JAR cache
- Admin page split into tabs (Server/Players/Chat/Mods/Backups/Logs) with
  hash + localStorage persistence; inactive tabs no longer mount.
- Log viewer: level color-coding, search, level filter chips, auto-scroll
  toggle, copy button, visible-line count.
- Installed mods list: search field + side filter (all/both/server/client)
  with live count; public ModList gets skeleton + empty states and search.
- Theme toggle with no-flash inline init, localStorage + system preference.
- Layout: full OG / Twitter metadata, title template, keywords,
  dual-theme themeColor, metadataBase.
- lib/mods.ts: per-jar mtime+size parse cache (cold 6s -> warm ~45ms on
  /api/mods for the full mod list); cache eviction on mod removal.
- ChatBridge polling eased 3s -> 5s with 2s stale window.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 04:58:25 -06:00

42 lines
1.3 KiB
TypeScript

"use client";
import { useSession, signOut } from "next-auth/react";
import Link from "next/link";
import { Button } from "@/components/ui/button";
import { ThemeToggle } from "@/components/ThemeToggle";
export function Navbar() {
const { data: session } = useSession();
return (
<header className="border-b border-border bg-card">
<div className="max-w-5xl mx-auto flex items-center justify-between px-3 sm:px-6 py-2.5 sm:py-3">
<Link href="/" className="font-bold text-primary text-base sm:text-lg tracking-tight">
HurkiCorgi MC
</Link>
<div className="flex items-center gap-1 sm:gap-2">
<ThemeToggle />
{session ? (
<>
<Button variant="ghost" size="sm" render={<Link href="/admin" />}>
Admin
</Button>
<Button
variant="ghost"
size="sm"
onClick={() => signOut({ callbackUrl: "/" })}
className="text-muted-foreground"
>
Logout
</Button>
</>
) : (
<Button variant="ghost" size="sm" render={<Link href="/login" />}>
Login
</Button>
)}
</div>
</div>
</header>
);
}