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

+3 -1
View File
@@ -2047,7 +2047,9 @@
"weekday": "Die meisten deiner {metric}-Werte fallen auf einen Wochentag. Messungen an anderen Tagen ergeben ein vollständigeres Bild.",
"timeOfDay": "Die meisten deiner {metric}-Werte fallen auf eine ähnliche Tageszeit. Unterschiedliche Zeiten ergeben ein vollständigeres Bild."
},
"valuesBack": "Zurück zu Insights"
"valuesBack": "Zurück zu Insights",
"valuesBackToMetric": "Zurück zu {metric}",
"scoresBack": "Zurück zu Insights"
},
"sleep": {
"title": "Schlaf",
+3 -1
View File
@@ -2047,7 +2047,9 @@
"weekday": "Most of your {metric} readings land on one weekday. Logging on other days gives a fuller picture.",
"timeOfDay": "Most of your {metric} readings land at a similar time of day. Varying the time gives a fuller picture."
},
"valuesBack": "Back to insights"
"valuesBack": "Back to insights",
"valuesBackToMetric": "Back to {metric}",
"scoresBack": "Back to insights"
},
"sleep": {
"title": "Sleep",
+3 -1
View File
@@ -2047,7 +2047,9 @@
"weekday": "La mayoría de tus mediciones de {metric} caen en un mismo día de la semana. Registrar en otros días ofrece una imagen más completa.",
"timeOfDay": "La mayoría de tus mediciones de {metric} caen a una hora similar del día. Variar la hora ofrece una imagen más completa."
},
"valuesBack": "Volver a Insights"
"valuesBack": "Volver a Insights",
"valuesBackToMetric": "Volver a {metric}",
"scoresBack": "Volver a Insights"
},
"sleep": {
"title": "Sueño",
+3 -1
View File
@@ -2047,7 +2047,9 @@
"weekday": "La plupart de vos mesures de {metric} tombent le même jour de la semaine. Enregistrer d'autres jours donne une image plus complète.",
"timeOfDay": "La plupart de vos mesures de {metric} tombent à une heure similaire de la journée. Varier l'heure donne une image plus complète."
},
"valuesBack": "Retour aux Insights"
"valuesBack": "Retour aux Insights",
"valuesBackToMetric": "Retour à {metric}",
"scoresBack": "Retour aux Insights"
},
"sleep": {
"title": "Sommeil",
+3 -1
View File
@@ -2047,7 +2047,9 @@
"weekday": "La maggior parte delle tue misurazioni di {metric} cade in un solo giorno della settimana. Registrare in altri giorni offre un quadro più completo.",
"timeOfDay": "La maggior parte delle tue misurazioni di {metric} cade in un orario simile della giornata. Variare l'orario offre un quadro più completo."
},
"valuesBack": "Torna a Insights"
"valuesBack": "Torna a Insights",
"valuesBackToMetric": "Torna a {metric}",
"scoresBack": "Torna a Insights"
},
"sleep": {
"title": "Sonno",
+3 -1
View File
@@ -2047,7 +2047,9 @@
"weekday": "Większość Twoich pomiarów {metric} przypada na jeden dzień tygodnia. Pomiary w inne dni dają pełniejszy obraz.",
"timeOfDay": "Większość Twoich pomiarów {metric} przypada o podobnej porze dnia. Różne pory dają pełniejszy obraz."
},
"valuesBack": "Powrót do Insights"
"valuesBack": "Powrót do Insights",
"valuesBackToMetric": "Powrót do {metric}",
"scoresBack": "Powrót do Insights"
},
"sleep": {
"title": "Sen",
+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>