From ee845946fa625ba0b862fc2fdd2dad30d3b66557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Tue, 2 Jun 2026 13:21:16 +0200 Subject: [PATCH] fix(insights): place metric detail back-nav above the heading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The metric values subpage (/insights/values/[type]) and the workout detail page rendered the back link as the first child of SubPageShell, which paints it below the page heading. Add an optional backLink slot to SubPageShell that renders above the header — the standard back-nav placement — and move both pages' back links into it. Co-Authored-By: Claude Opus 4.8 (1M context) (cherry picked from commit 72a73a52eb8295c9e70a3456972476b8c4469f07) --- src/app/insights/values/[type]/page.tsx | 27 ++++++++++--------- src/app/insights/workouts/[id]/page.tsx | 26 +++++++++--------- src/app/settings/sources/page.tsx | 23 ---------------- .../__tests__/sub-page-shell.test.tsx | 17 ++++++++++++ src/components/insights/sub-page-shell.tsx | 12 +++++++++ 5 files changed, 57 insertions(+), 48 deletions(-) delete mode 100644 src/app/settings/sources/page.tsx diff --git a/src/app/insights/values/[type]/page.tsx b/src/app/insights/values/[type]/page.tsx index e1915e2a3..fd1ff6556 100644 --- a/src/app/insights/values/[type]/page.tsx +++ b/src/app/insights/values/[type]/page.tsx @@ -47,20 +47,21 @@ export default function InsightsMetricValuesPage({ + + ); diff --git a/src/app/insights/workouts/[id]/page.tsx b/src/app/insights/workouts/[id]/page.tsx index d648a8b06..f55155ff5 100644 --- a/src/app/insights/workouts/[id]/page.tsx +++ b/src/app/insights/workouts/[id]/page.tsx @@ -40,19 +40,21 @@ export default function InsightsWorkoutDetailPage({ + + + {t("insights.workouts.detail.backToList")} + + + } > - - {isLoading ? (
diff --git a/src/app/settings/sources/page.tsx b/src/app/settings/sources/page.tsx deleted file mode 100644 index 198bb3d30..000000000 --- a/src/app/settings/sources/page.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { permanentRedirect } from "next/navigation"; - -/** - * v1.4.34 IW-D — `/settings/sources` permanent redirect. - * - * The Sources settings section was merged into `/settings/thresholds` - * (now titled "Targets & Sources" / "Zielwerte & Quellen"). The two - * editors share the same per-metric configuration shelf and reading - * them side-by-side on one page matches how a user actually thinks - * about metric configuration ("for this metric, which sources do I - * trust AND what range counts as healthy?"). Per - * `.planning/research/v1434-r-2-carryover-scope.md` §7 and - * `.planning/round-v1433-audit-menu.md` §7.1 (item 3). - * - * 308 (`permanentRedirect`) keeps the request method intact so any - * external system that POSTs (none today, but cheap insurance) follows - * through with its original method. Existing bookmarks, iOS Settings - * deep-links, and any docs that referenced `/settings/sources` - * continue to resolve. - */ -export default function SettingsSourcesRedirect(): never { - permanentRedirect("/settings/thresholds"); -} diff --git a/src/components/insights/__tests__/sub-page-shell.test.tsx b/src/components/insights/__tests__/sub-page-shell.test.tsx index 46394c46d..07653ce87 100644 --- a/src/components/insights/__tests__/sub-page-shell.test.tsx +++ b/src/components/insights/__tests__/sub-page-shell.test.tsx @@ -92,6 +92,23 @@ describe("", () => { expect(probeIdx).toBeLessThan(headerEnd); }); + it("renders the back link above the heading when supplied", () => { + const html = render( + back} + > + + , + ); + // v1.8.7.1 — the back-nav leads the page, above the heading. + const backIdx = html.indexOf('data-slot="back-probe"'); + const headerIdx = html.indexOf(" { const html = render( diff --git a/src/components/insights/sub-page-shell.tsx b/src/components/insights/sub-page-shell.tsx index e12d34a60..d4b108dab 100644 --- a/src/components/insights/sub-page-shell.tsx +++ b/src/components/insights/sub-page-shell.tsx @@ -31,6 +31,15 @@ import { cn } from "@/lib/utils"; export interface SubPageShellProps { title: string; + /** + * v1.8.7.1 — optional back-navigation control rendered ABOVE the page + * heading, the standard back-nav placement. Detail/values sub-pages + * (`/insights/values/[type]`, `/insights/workouts/[id]`) pass their + * "back to …" link here so it leads the page rather than trailing the + * content. Omitted on the mother page and category pages reached via the + * tab strip. + */ + backLink?: ReactNode; /** Optional accent badge (status, dataset coverage, …). */ badge?: ReactNode; /** @@ -108,6 +117,7 @@ export interface SubPageShellProps { export function SubPageShell({ title, + backLink, badge, description, explainerMetric, @@ -142,6 +152,8 @@ export function SubPageShell({ return (
+ {/* v1.8.7.1 — back-nav leads the page, above the heading. */} + {backLink}
{/* v1.8.6 — the heading row pins the Coach icon top-right while the title / nudge / badge wrap together on the left.