From 146867b09f59ac3450043e2cbf38d0313115d878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Mon, 1 Jun 2026 21:04:25 +0200 Subject: [PATCH] fix(insights): show one adjust-target link for the glucose panel group MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The blood-glucose reference panel fans out to up to four per-context panels (fasting / postprandial / random / bedtime), each previously emitting its own identical "Adjust target range" link to /targets — so the page stacked up to four copies of the same link. Lift the link to the group wrapper and render it once; keep the per-panel link for the non-glucose single-panel path. --- .../insights/metric-target-summary.tsx | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/components/insights/metric-target-summary.tsx b/src/components/insights/metric-target-summary.tsx index 9508ff34a..c444dc25c 100644 --- a/src/components/insights/metric-target-summary.tsx +++ b/src/components/insights/metric-target-summary.tsx @@ -169,6 +169,9 @@ export function MetricTargetSummary({ slug }: MetricTargetSummaryProps) { if (panels.length === 0) return null; + // Glucose fans out to up to four per-context panels. The + // "Adjust target range" link is identical on every one, so render + // it once for the whole group rather than repeating it per panel. return (
{panels.map((panel) => ( @@ -176,8 +179,12 @@ export function MetricTargetSummary({ slug }: MetricTargetSummaryProps) { key={panel.type} target={panel} heading={panel.label} + hideAdjustLink /> ))} +
+ +
); } @@ -200,6 +207,25 @@ interface TargetReferencePanelProps { bpDiastolic?: TargetsResponse["bpDiastolic"]; /** Optional sub-heading shown above the panel (used for glucose contexts). */ heading?: string; + /** + * Suppress the per-panel "Adjust target range" link. Glucose stacks + * up to four panels and lifts a single link to the group wrapper, so + * each panel omits its own to avoid repeating the same link. + */ + hideAdjustLink?: boolean; +} + +/** The shared "Adjust target range" link to the `/targets` editing surface. */ +function AdjustTargetLink() { + const { t } = useTranslations(); + return ( + + {t("insights.subPage.target.adjustLink")} + + ); } /** @@ -213,6 +239,7 @@ function TargetReferencePanel({ target, bpDiastolic, heading, + hideAdjustLink, }: TargetReferencePanelProps) { const { t } = useTranslations(); @@ -368,12 +395,7 @@ function TargetReferencePanel({ {t("targets.sourceLabel", { source: target.source })} )} - - {t("insights.subPage.target.adjustLink")} - + {hideAdjustLink ? null : } );