import { Link, useLocation } from "react-router"; import { Logo } from "./Logo"; import { ThemeToggle } from "./ThemeToggle"; import { useSession } from "@/lib/use-session"; import { ADMIN_ENTRY_PATH } from "@/lib/admin-entry"; const nav = [ { href: "/kampanyok", label: "Projektek" }, { href: "/sikersztorik", label: "Sikersztorik" }, { href: "/hogyan-mukodik", label: "Hogyan működik?" }, ]; export function SiteHeader() { const { isAdmin: admin } = useSession(); const onAdminEntry = useLocation().pathname === ADMIN_ENTRY_PATH; return (
{/* Signing in does nothing for a visitor: a session only unlocks /api/admin/*, and backing a campaign is planned to need no account at all. So the link is offered to an admin, or on the admin entry page, and to nobody else. */} {(admin || onAdminEntry) && ( {admin ? "Admin" : "Belépés"} )}
); }