30 lines
718 B
TypeScript
30 lines
718 B
TypeScript
import Link from "next/link";
|
|||
|
|
|
||
|
|
import type { Me } from "@/lib/types";
|
||
|
|
|
||
|
|
import { LogoutButton } from "./LogoutButton";
|
||
|
|
import { NavLinks } from "./NavLinks";
|
||
|
|
|
||
|
|
export function Logo() {
|
||
|
|
return (
|
||
|
|
<Link href="/" className="logo">
|
||
|
|
sors<span>fonalak</span>
|
||
|
|
</Link>
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
export function SiteHeader({ me }: { me: Me }) {
|
||
|
|
const links = [{ href: "/profil", label: "Profil" }];
|
||
|
|
if (me.user.roles.includes("admin")) links.push({ href: "/admin", label: "Admin" });
|
||
|
|
return (
|
||
|
|
<header className="site-header">
|
||
|
|
<Logo />
|
||
|
|
<NavLinks links={links} />
|
||
|
|
<div className="who">
|
||
|
|
<span>{me.user.display_name || me.user.email}</span>
|
||
|
|
<LogoutButton />
|
||
|
|
</div>
|
||
|
|
</header>
|
||
|
|
);
|
||
|
|
}
|