Files
t5de-hub/apps/web/app/console/console-nav.tsx
dhkatzandClaude Opus 5.5 51d5bb5ff3 Website: products, library, catalogs and their console page
/products (search), product pages with revisions, getting and staying on a
revision, retracting; /products/:id/edit; /create and new revisions upload
from the browser straight to the catalog with a token from the hub;
/library; /catalogs (directory, registering with a once-shown key);
/console/catalogs to approve or reject. Every page now sends a nonce-based
CSP (proxy.ts), so product descriptions can't run scripts.

buttonVariants now merges classes, so outline links get their border.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 19:06:08 -07:00

24 lines
795 B
TypeScript

import { notFound, redirect } from "next/navigation";
import { NavLink } from "@/components/header-client";
import { getMe, isModerator, type Person } from "@/lib/api";
/** The signed-in moderator, or off to sign in; others get not found (the console isn't for them). */
export async function requireModerator(path: string): Promise<Person> {
const me = await getMe();
if (!me) redirect(`/signin?next=${encodeURIComponent(path)}`);
if (!isModerator(me)) notFound();
return me;
}
export function ConsoleNav() {
return (
<nav className="mb-8 flex gap-1 border-b pb-3 text-sm">
<NavLink href="/console" exact>
Overview
</NavLink>
<NavLink href="/console/people">People</NavLink>
<NavLink href="/console/catalogs">Catalogs</NavLink>
</nav>
);
}