/* ═══════════════════════════════════════════════════════════════ ADMIN HOME Where login lands. Two columns: the cards are the navigation — the header deliberately drops its tab row here so the same links aren't drawn twice — and a standing info panel on the right. The cards come from adminNav.js, the same list the CMS header reads, so a new entity shows up here the moment it's registered. Forms sit in their own block below: they're submissions coming in rather than content going out, and there'll be more of them than the feedback queue eventually. The Panel block below that only exists for superadmins. The right-hand panel is deliberately inert. Nothing here fetches, so the landing page can't be slow or half-broken on arrival; anything live (open feedback count, last-edited record) wants to be a separate component that fails on its own. ═══════════════════════════════════════════════════════════════ */ import { Link } from "react-router-dom"; import { useAuth } from "../../lib/auth.tsx"; import { SITE_VERSION } from "../../lib/version.ts"; import { ROLE_LABELS, isSuper } from "../../lib/roles.ts"; import { CMS_NAV, FORMS_NAV, PANEL_NAV, target } from "./adminNav.js"; /* One card. The title link is stretched over the whole card with `after:absolute`, which makes the card clickable without nesting an anchor inside an anchor; the sub-links sit above it on z-10 so they stay separately clickable. */ function NavCard({ item }) { const to = target(item); // Drop the child that just repeats the card's own destination — // "All organizations" under Organizations. const extras = (item.children ?? []).filter((child) => child.to !== to); return (

{item.label}

{item.blurb && (

{item.blurb}

)} {extras.length > 0 && (
{extras.map((child) => ( {child.label} ))}
)}
); } function CardBlock({ title, blurb, children }) { return (

{title}

{blurb &&

{blurb}

}
{children}
); } function PanelSection({ title, children }) { return (

{title}

{children}
); } const QUICK_ADD = [ { to: "/admin/events/new", label: "New event" }, { to: "/admin/people/new", label: "New person" }, { to: "/admin/organizations/new", label: "New organization" }, { to: "/admin/timeline/new", label: "New timeline entry" }, ]; export default function AdminHome() { const { user } = useAuth(); const role = ROLE_LABELS[user?.role] ?? user?.role; return (

{user?.name ? `Welcome back, ${user.name.split(" ")[0]}.` : "Welcome back."}

Pick a section to work in.

{CMS_NAV.map((item) => ( ))}
{FORMS_NAV.children.map((form) => ( ))} {isSuper(user) && ( )}
{/* Sticky so it stays put once the card column outgrows it. */}
); }