mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
fix(settings): give the Layout sub-pages the back-link they were built with
Measuring the seven `/settings/layout/<child>` routes was meant to pin the back-link spacing. It found there was no back-link to pin. `SettingsHubBackLink` and `settings.sections.layout.backToHub` have existed since the sub-pages were split out, and the only thing that mounted them was the shell's slug FALLBACK — the branch that runs when a page passes no `heading`. These pages pass an explicit one, so the fallback never ran and no child route has painted a back-link since. The component was written, the string was written, the reverse-coverage guard saw a call site and was satisfied, and the way back to the hub was not on the page. Two ends, no pipe. It now comes from the page, where the heading it belongs to comes from. The geometry spec grows the seven routes and a second family. A route with a back-link carries an extra row above the title, so it is taller by construction; comparing it against a plain route would report structure as drift. Each family is checked for its own constant heading top, and the step between the back-link and the title is asserted at 6 px — `PageHeader`'s documented `space-y-1.5`, which is what the shell's hand-rolled `space-y-6` would have drifted back to. Measured, both languages: plain routes 24.0 px, back-link routes 51.0 px, spread 0.0 px in both families, step 6.0 px on all seven. The back-link is also painted twice, once per breakpoint, so the measurement picks the copy with a box — `querySelector` returns document order, which on a desktop width is the hidden mobile one, and reading it reported no back-link at all.
This commit is contained in:
1 parent
272c426bea
commit
8eb9408813
3 files changed
+94
-4
No files matched your search
@@ -8,6 +8,7 @@ import {
|
||||
isLayoutGroupId,
|
||||
} from "@/components/settings/layout-groups";
|
||||
import { SettingsShell } from "@/components/settings/settings-shell";
|
||||
import { SettingsHubBackLink } from "@/components/settings/settings-hub-back-link";
|
||||
import { resolveServerLocale } from "@/lib/i18n/server-locale";
|
||||
import { getServerTranslator } from "@/lib/i18n/server-translator";
|
||||
|
||||
@@ -67,6 +68,17 @@ export default async function SettingsLayoutModulePage({ params }: PageProps) {
|
||||
title: t(group.titleKey),
|
||||
subtitle: t(group.descriptionKey),
|
||||
headingId,
|
||||
// The way back to the hub. `SettingsHubBackLink` and its string have
|
||||
// existed since the sub-pages were split out, but the only thing that
|
||||
// mounted them was the shell's slug FALLBACK — and these pages pass an
|
||||
// explicit `heading`, so the fallback never ran and no child route
|
||||
// ever painted a back link. Both ends existed; nothing connected them.
|
||||
topSlot: (
|
||||
<SettingsHubBackLink
|
||||
href="/settings/layout"
|
||||
labelKey="settings.sections.layout.backToHub"
|
||||
/>
|
||||
),
|
||||
}}
|
||||
>
|
||||
<RecordSettingsSectionGate section="layout">
|
||||
|
||||
@@ -28,6 +28,7 @@ export function SettingsHubBackLink({
|
||||
return (
|
||||
<Link
|
||||
href={href}
|
||||
data-slot="settings-hub-back-link"
|
||||
className={cn(
|
||||
"text-muted-foreground hover:text-foreground -mx-1 inline-flex w-fit items-center gap-1 rounded-md px-1 py-0.5 text-xs font-medium transition-colors",
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user