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 : } );