fix(insights): add scores drill-down back-link and unify back-link styling

The composite-score detail page (/insights/scores/[metric]) gains a leading
back-link to the Insights overview, matching the other drill-down surfaces.
Align the medication detail + history back-links onto the canonical ghost
recipe (-ml-2 w-fit, mr-1 size-4 icon) used by the values and workout-detail
pages, replacing the divergent -ml-2 gap-1 variant.
This commit is contained in:
Marc-André Bombeck committed 2026-06-03 08:56:20 +02:00
1 parent 692b091637
commit 732e85e4df
9 files changed
+41 -27

No files matched your search

+17
View File
@@ -1,8 +1,11 @@
"use client";
import Link from "next/link";
import { useParams } from "next/navigation";
import { ArrowLeft } from "lucide-react";
import { useTranslations } from "@/lib/i18n/context";
import { Button } from "@/components/ui/button";
import { SubPageShell } from "@/components/insights/sub-page-shell";
import {
CompositeScoreAnatomy,
@@ -68,6 +71,20 @@ export default function CompositeScorePage() {
<SubPageShell
title={t(header.title)}
description={t(header.description)}
backLink={
<Button
asChild
variant="ghost"
size="sm"
data-slot="composite-score-back"
className="-ml-2 w-fit"
>
<Link href="/insights">
<ArrowLeft className="mr-1 size-4" aria-hidden="true" />
{t("insights.subPage.scoresBack")}
</Link>
</Button>
}
coachLaunch
>
<CompositeScoreAnatomy metric={metric} />
+2 -7
View File
@@ -84,14 +84,9 @@ export default function IntakeHistoryPage({
<div className="space-y-6">
{/* Back to the medication detail page — history is a drill-down
OF the medication, not a sibling of the list. */}
<Button
variant="ghost"
size="sm"
className="text-muted-foreground -ml-2 gap-1"
asChild
>
<Button variant="ghost" size="sm" className="-ml-2 w-fit" asChild>
<Link href={`/medications/${id}`}>
<ArrowLeft aria-hidden="true" className="h-4 w-4" />
<ArrowLeft aria-hidden="true" className="mr-1 size-4" />
{t("medications.detail.history.back")}
</Link>
</Button>
+4 -14
View File
@@ -165,14 +165,9 @@ export default function MedicationDetailPage({
if (isError || !medication) {
return (
<div className="space-y-6">
<Button
variant="ghost"
size="sm"
className="text-muted-foreground -ml-2 gap-1"
asChild
>
<Button variant="ghost" size="sm" className="-ml-2 w-fit" asChild>
<Link href="/medications">
<ArrowLeft className="h-4 w-4" />
<ArrowLeft className="mr-1 size-4" aria-hidden="true" />
{t("medications.back")}
</Link>
</Button>
@@ -198,14 +193,9 @@ export default function MedicationDetailPage({
return (
<div className="space-y-6" data-slot="medication-detail-page">
<Button
variant="ghost"
size="sm"
className="text-muted-foreground -ml-2 gap-1"
asChild
>
<Button variant="ghost" size="sm" className="-ml-2 w-fit" asChild>
<Link href="/medications">
<ArrowLeft aria-hidden="true" className="h-4 w-4" />
<ArrowLeft aria-hidden="true" className="mr-1 size-4" />
{t("medications.back")}
</Link>
</Button>