diff --git a/src/app/admin/[section]/renderer.tsx b/src/app/admin/[section]/renderer.tsx index 4adc26c77..4e87add9e 100644 --- a/src/app/admin/[section]/renderer.tsx +++ b/src/app/admin/[section]/renderer.tsx @@ -224,21 +224,16 @@ export function AdminSectionRenderer({ } interface SectionFrameProps { - title: string; + // v1.18.6.1 — the visible heading + subtitle moved to ``, which + // places them in their own grid row so the left nav lines up with the first + // card. `title` / `subtitle` are still passed by every call site (and remain + // the i18n source of truth the shell reads), but the frame no longer paints + // them — it is now just the `space-y-6` card-stack wrapper. + title?: string; subtitle?: string; children: React.ReactNode; } -function SectionFrame({ title, subtitle, children }: SectionFrameProps) { - return ( -
-
-

{title}

- {subtitle && ( -

{subtitle}

- )} -
- {children} -
- ); +function SectionFrame({ children }: SectionFrameProps) { + return
{children}
; } diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index f9ec57245..3cc1eb594 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -30,13 +30,8 @@ export default function AdminOverviewPage() { return (
-
-

- {t("admin.title")} -

-

{t("admin.subtitle")}

-
- + {/* v1.18.6.1 — the console title + subtitle render in `` + now (its own grid row, so the nav lines up with the first card). */} {settingsError && (
` exposes a -// `topSlot` for exactly this; the link lives here so the section bodies stay -// pure card content. -const HUB_CHILD_SLUGS: ReadonlySet = new Set([ - "dashboard", - "insights", -]); - -/** Optional content rendered above the canonical heading, per slug. */ -function frameTopSlot(slug: SettingsSectionSlug): ReactNode { - if (HUB_CHILD_SLUGS.has(slug)) { - return ( - - ); - } - return undefined; -} - -/** Optional inline content rendered at the top-right of the heading row. */ -function frameHeadingAccessory(slug: SettingsSectionSlug): ReactNode { - // v1.18.6 (W9) — the module guided-tour re-entry triggers used to live in - // a `justify-end` header inside the section body; they move to the frame's - // heading row so the heading itself is the spotlight anchor. - if (slug === "gesundheitsakte") { - return ( - - - - ); - } - if (slug === "integrations") { - return ( - - - - ); - } - return undefined; -} - interface PageProps { // Next.js 16 made route `params` an async Promise. We `await` it before use. params: Promise<{ section: string }>; @@ -138,17 +91,19 @@ export default async function SettingsSectionPage({ params }: PageProps) { // guards the slug, but a future slug added to `SETTINGS_SECTION_SLUGS` // without a wired component would otherwise crash silently — placeholder // surfaces the gap visually instead. - // v1.18.6 (W9) — every section now renders inside the shared - // ``, which emits the one visible heading + subtitle - // each page must show (the section bodies no longer carry their own). + // v1.18.6.1 — the heading + subtitle (and the Layout-hub "← back" link) + // now live in ``, which places them in their own grid row + // spanning only the content column so the left nav's first item lines up + // with the top of the first card. The page body is pure card content, + // wrapped in the labelled `
` so the historic + // `settings-section--title` `aria-labelledby` linkage still resolves. const body = SectionComponent ? ( - - +
) : ( ); diff --git a/src/components/admin/admin-shell.tsx b/src/components/admin/admin-shell.tsx index 4b44785cf..28e54b689 100644 --- a/src/components/admin/admin-shell.tsx +++ b/src/components/admin/admin-shell.tsx @@ -40,7 +40,6 @@ import { cn } from "@/lib/utils"; import { scrollBehaviorForUser } from "@/lib/motion"; import { useAuth } from "@/hooks/use-auth"; import { useTranslations } from "@/lib/i18n/context"; -import { SectionNavHeadingSpacer } from "@/components/settings/section-nav-heading-spacer"; import { isAdminSectionSlug, type AdminSectionSlug } from "./section-slugs"; interface AdminSection { @@ -208,6 +207,24 @@ export function AdminShell({ active, children }: AdminShellProps) { // children — until the role is confirmed ADMIN. if (!user || user.role !== "ADMIN") return null; + // v1.18.6.1 — the heading lives in the shell so it can occupy its own grid + // row spanning only the content column; the nav's first item then lines up + // with the top of the first card by construction. `/admin` overview + // (activeSlug === null) shows the console title; each section shows its own. + const headingTitle = + activeSlug === null ? t("admin.title") : t(`admin.section.${activeSlug}.title`); + const headingSubtitle = + activeSlug === null + ? t("admin.subtitle") + : t(`admin.section.${activeSlug}.subtitle`); + + const headingBlock = ( +
+

{headingTitle}

+

{headingSubtitle}

+
+ ); + // v1.4.25 W8 — AuthShell wraps the page in `px-4 py-6 md:px-6` // already, so this inner shell only carries the wider max-width. // Previously the duplicate `px-4 py-6 md:px-6 md:py-8` here was @@ -215,6 +232,10 @@ export function AdminShell({ active, children }: AdminShellProps) { // pages than on Dashboard/Insights/Measurements. return (
+ {/* v1.18.6.1 — heading above the chip strip on mobile; on desktop it + renders inside the grid (row 1 / content column). */} +
{headingBlock}
+ {/* Mobile section strip — horizontal scroll, hidden on md+. `no-scrollbar` (defined in `globals.css`) suppresses the painted scrollbar at the top of every admin page; the @@ -278,16 +299,22 @@ export function AdminShell({ active, children }: AdminShellProps) { -
- {/* Desktop sticky sidebar */} + {/* v1.18.6.1 — two-row grid: heading in row 1 / col 2, nav in row 2 / + col 1, cards in row 2 / col 2. The nav's first item starts the same + grid row as the first card, so they align by construction across + locales and however the heading wraps — no fixed-height spacer. */} +
+ {/* Heading — desktop only (mobile renders it above the strip). */} +
+ {headingBlock} +
+ + {/* Desktop sticky sidebar — starts at the cards row (row 2). */} - {/* Main column — page renders its own h1 + subtitle. Same + {/* Main column (cards) — row 2 / col 2. Same `min-h-[calc(100dvh-12rem)]` reserve as `` so navigating between admin sub-pages (e.g. system-status → login-overview) does not jump the page height while the new section is still fetching. */} -
{children}
+
+ {children} +
); diff --git a/src/components/settings/section-nav-heading-spacer.tsx b/src/components/settings/section-nav-heading-spacer.tsx deleted file mode 100644 index e8d7c13e6..000000000 --- a/src/components/settings/section-nav-heading-spacer.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/** - * `` — invisible spacer that reserves exactly the - * height of a section's heading block (h1 + subtitle) plus the `space-y-6` - * gap that separates the heading from the first card. - * - * v1.18.6 (W9) — Marc's symmetry ask: the left settings / admin menu's first - * item must line up with the TOP OF THE FIRST CARD, not with the page - * heading. The page heading lives in the content column above the first card, - * so the sidebar needs to start one heading-block lower. Replicating the - * exact heading markup (same `text-2xl` h1 + `text-sm` subtitle) as a hidden, - * `aria-hidden` block keeps the offset pixel-accurate across locales and - * line-wrapping — a hard-coded `pt-[…]` would drift the moment a title or - * subtitle wraps to a second line. - * - * It is only rendered on `md+` (the desktop sticky sidebar); the mobile chip - * strip has no heading-to-align-with. - * - * v1.18.6 (L11) — pass the active section's resolved `title` so the h1 line - * wraps identically when a locale's title runs to two lines, rather than - * reserving a single ` ` line. The subtitle copy lives per-page in the - * section frame and is not threaded up here, so the spacer reserves one - * subtitle line; a subtitle that wraps to two lines in a given locale is the - * residual known limitation the original comment called out. - */ -export function SectionNavHeadingSpacer({ title }: { title?: string }) { - return ( - - ); -} diff --git a/src/components/settings/settings-shell.tsx b/src/components/settings/settings-shell.tsx index fd6c3464e..5b4ee1a18 100644 --- a/src/components/settings/settings-shell.tsx +++ b/src/components/settings/settings-shell.tsx @@ -48,7 +48,7 @@ import { isSettingsSectionSlug, type SettingsSectionSlug, } from "./section-slugs"; -import { SectionNavHeadingSpacer } from "./section-nav-heading-spacer"; +import { SettingsHubBackLink } from "./settings-hub-back-link"; // Re-export so existing call-sites importing from this module keep working. // New server-side call-sites (e.g. `generateStaticParams()`) should import @@ -211,6 +211,28 @@ export interface SettingsShellProps { * pass an explicit value so they don't need to mock the router. */ active?: SettingsSectionSlug; + /** + * v1.18.6.1 — the page heading + subtitle now live in the shell, not in + * the section body. The shell places them in their own grid row that + * spans ONLY the content column, so the left nav's first item lines up + * with the top of the first card by construction — no fixed-height + * spacer to drift across locales or subtitle line-wraps. + * + * Title comes from `settings.sections..title` when omitted; pass + * an explicit value for the per-module pages (Vorsorge / Illness / Labs) + * that stay out of the slug registry. `headingId` keeps the historic + * `settings-section--title` anchor for `aria-labelledby` and the + * spotlight tour. + */ + heading?: { + title: string; + subtitle: string; + headingId: string; + /** Rendered above the heading (e.g. a "← back to hub" link). */ + topSlot?: React.ReactNode; + /** Rendered inline at the top-right of the heading row. */ + headingAccessory?: React.ReactNode; + }; children: React.ReactNode; } @@ -246,7 +268,11 @@ function deriveActiveSlug( return isSettingsSectionSlug(candidate) ? candidate : "account"; } -export function SettingsShell({ active, children }: SettingsShellProps) { +export function SettingsShell({ + active, + heading, + children, +}: SettingsShellProps) { const pathname = usePathname(); const { t } = useTranslations(); const { user } = useAuth(); @@ -300,6 +326,53 @@ export function SettingsShell({ active, children }: SettingsShellProps) { }); }, [activeSlug]); + // v1.18.6.1 — resolve the heading once. Pages pass an explicit `heading` + // (the canonical path); the slug fallback keeps the shell renderable on + // its own (and in tests that mount it without a heading) by deriving the + // title from the active section. The heading lives in the shell so it can + // occupy its own grid row spanning only the content column — see the grid + // below. + const resolvedHeading = + heading ?? + (activeSection + ? { + title: t(activeSection.titleKey), + subtitle: t(`settings.sections.${activeSection.slug}.subtitle`), + headingId: `settings-section-${activeSection.slug}-title`, + topSlot: LAYOUT_CHILD_SLUGS.has(activeSection.slug) ? ( + + ) : undefined, + headingAccessory: undefined, + } + : null); + + const headingBlock = resolvedHeading ? ( +
+ {resolvedHeading.topSlot ?
{resolvedHeading.topSlot}
: null} +
+
+

+ {resolvedHeading.title} +

+ {resolvedHeading.subtitle ? ( +

+ {resolvedHeading.subtitle} +

+ ) : null} +
+ {resolvedHeading.headingAccessory ? ( +
{resolvedHeading.headingAccessory}
+ ) : null} +
+
+ ) : null; + // v1.4.25 W8 — AuthShell wraps the page in `px-4 py-6 md:px-6` // already, so this inner shell only carries the wider max-width. // Previously the duplicate `px-4 py-6 md:px-6 md:py-8` here was @@ -307,6 +380,11 @@ export function SettingsShell({ active, children }: SettingsShellProps) { // pages than on Dashboard/Insights/Measurements. return (
+ {/* v1.18.6.1 — on mobile the heading sits above the chip strip; on + desktop it is rendered inside the grid (row 1 / content column) so + it does not paint twice. */} + {headingBlock ?
{headingBlock}
: null} + {/* Mobile section strip — horizontal scroll, hidden on md+. `no-scrollbar` (defined in `globals.css`) suppresses the painted scrollbar; the horizontal swipe + keyboard arrow @@ -354,22 +432,28 @@ export function SettingsShell({ active, children }: SettingsShellProps) { -
- {/* Desktop sticky sidebar */} + {/* v1.18.6.1 — two-row grid on desktop: + row 1 / col 2 = heading (content column only) + row 2 / col 1 = nav row 2 / col 2 = cards + The nav's first item lines up with the top of the first card BY + CONSTRUCTION — both start the grid's second row — so the alignment + holds across locales and however the title or subtitle wraps. No + fixed-height spacer to guess. The `gap-6` between rows reproduces + the `space-y-6` the heading-to-first-card gap used to carry. */} +
+ {/* Heading — desktop only here (mobile renders it above the strip). */} + {headingBlock ? ( +
+ {headingBlock} +
+ ) : null} + + {/* Desktop sticky sidebar — starts at the cards row (row 2). */}