mirror of
https://github.com/tiennm99/llmapikey.git
synced 2026-07-10 13:03:34 +00:00
8fcc705e2c
- replace stale plan-reference comments with intent-describing ones - move inline nav style to a .site-nav CSS class - drop dummy placeholder return in generate-key resolveConflict
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
import Link from "next/link";
|
|
|
|
import { createServerAuthClient } from "@/lib/supabase/server-client";
|
|
|
|
/**
|
|
* Session-aware header (server component). Shows Dashboard + sign-out when
|
|
* authenticated; just Docs otherwise. Display only — `user_name` is fine here.
|
|
*/
|
|
export async function SiteHeader() {
|
|
let username = null;
|
|
try {
|
|
const supabase = await createServerAuthClient();
|
|
const {
|
|
data: { user },
|
|
} = await supabase.auth.getUser();
|
|
username = user?.user_metadata?.user_name ?? null;
|
|
} catch {
|
|
username = null; // auth not configured (no env) — render signed-out header
|
|
}
|
|
|
|
return (
|
|
<header className="site-header">
|
|
<Link href="/" className="brand">
|
|
llmapikey
|
|
</Link>
|
|
<nav className="site-nav">
|
|
<Link href="/docs">Docs</Link>
|
|
{username ? (
|
|
<>
|
|
<Link href="/dashboard">Dashboard</Link>
|
|
<span className="muted">@{username}</span>
|
|
<form action="/auth/sign-out" method="post">
|
|
<button className="btn secondary" type="submit">
|
|
Sign out
|
|
</button>
|
|
</form>
|
|
</>
|
|
) : null}
|
|
</nav>
|
|
</header>
|
|
);
|
|
}
|