feat: unify admin dashboard shell, add logout button

Admin used an undefined `.portal-shell` class plus the landing-page `.masthead`
markup, so the layout had no background/min-height and CSS "kackte rein".
Generalize PortalShell to take brand/nav props, switch admin/layout.tsx to it
(dark portal masthead + BrandLogo + admin nav), and pass the editorial nav from
redaktion/layout.tsx so both surfaces share one shell.

Add a LogoutButton client component (Better Auth signOut → hard navigate to
/anmelden) rendered into the masthead.

Style the admin content that had no rules: `.content-section dl/dt/dd` mirrors
`.editorial-section dl` (admin detail page), `.editorial-list` mirrors
`.billing-editorial-list` (Redaktionen index, replacing browser bullets),
`.portal-signout` for the dark masthead. Mobile: meta wraps, dl goes single
column.

Update logo.test.tsx to PortalShell's new required props.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Leon TonhäuserandClaude committed 2026-08-11 01:54:59 +02:00
1 parent 23b251be7c
commit 7aeceee078
7 files changed
+187 -31

No files matched your search

+7 -2
View File
@@ -21,12 +21,17 @@ test("uses each supplied logo's true intrinsic dimensions", () => {
test("keeps masthead controls keyboard-focusable with a paper-coloured focus outline", () => {
render(
<PortalShell>
<PortalShell
brandHref="/redaktion/alben"
sectionLabel="Redaktionsarchiv"
nav={[{ href: "/redaktion/alben", label: "Alben" }]}
>
<p>Archiv</p>
</PortalShell>,
);
expect(screen.getByRole("link", { name: /zur albenübersicht/i }).tagName).toBe("A");
// The brand link's accessible name is the section label (aria-label).
expect(screen.getByRole("link", { name: /redaktionsarchiv/i }).tagName).toBe("A");
expect(screen.getByRole("link", { name: "Alben" }).tagName).toBe("A");
const styles = readFileSync("src/app/globals.css", "utf8");
expect(styles).toContain(".portal-masthead :focus-visible");
+27
View File
@@ -0,0 +1,27 @@
"use client";
import { useState } from "react";
import { authClient } from "@/modules/auth/client";
// Renders into the portal masthead. Better Auth's signOut clears the session
// cookie server-side; we then hard-navigate to the login page so no stale
// session remains in the client router cache.
export function LogoutButton() {
const [pending, setPending] = useState(false);
async function signOut() {
setPending(true);
try {
await authClient.signOut();
} finally {
window.location.assign("/anmelden");
}
}
return (
<button className="portal-signout" disabled={pending} onClick={signOut} type="button">
{pending ? "…" : "Abmelden"}
</button>
);
}
+33 -9
View File
@@ -3,24 +3,48 @@ import type { ReactNode } from "react";
import Link from "next/link";
import { BrandLogo } from "@/components/brand/logo";
import { LogoutButton } from "@/components/layout/logout-button";
export function PortalShell({ children }: Readonly<{ children: ReactNode }>) {
export type NavItem = { href: string; label: string };
type PortalShellProps = {
brandHref: string;
sectionLabel: string;
nav: NavItem[];
// Editorial pages are wrapped in `.editorial-work-surface` (width + padding),
// so their content uses `.editorial-section` (max-width: 100%). Admin pages
// bring their own `.content-section` container (width + padding), so the
// shell must not add a second width wrapper — pass an empty string here.
mainClassName?: string;
children: ReactNode;
};
export function PortalShell({
brandHref,
sectionLabel,
nav,
mainClassName = "editorial-work-surface",
children,
}: Readonly<PortalShellProps>) {
return (
<div className="editorial-shell">
<header className="portal-masthead">
<Link aria-label="Zur Albenübersicht" className="portal-brand" href="/redaktion/alben">
<Link aria-label={sectionLabel} className="portal-brand" href={brandHref}>
<BrandLogo variant="white" />
</Link>
<div className="portal-masthead-meta">
<span>Redaktionsarchiv</span>
<nav aria-label="Redaktion">
<Link href="/redaktion/alben">Alben</Link>
<Link href="/redaktion/nutzungen">Nutzungen</Link>
<Link href="/redaktion/profil">Profil</Link>
<span>{sectionLabel}</span>
<nav aria-label={sectionLabel}>
{nav.map((item) => (
<Link key={item.href} href={item.href}>
{item.label}
</Link>
))}
</nav>
<LogoutButton />
</div>
</header>
<main className="editorial-work-surface">{children}</main>
<main className={mainClassName}>{children}</main>
</div>
);
}
}