From 2e27c3c4415e2cc361430cca5a0ede192dd5ba2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Fri, 19 Jun 2026 20:35:25 +0200 Subject: [PATCH] refactor(insights): share the briefing row layout KeyFindingRow and SignalRow rendered an identical tone bar + metric icon + headline/body/delta and the same link-when-routed behaviour, differing only in their data-slot and body copy. Extract a single BriefingRow and have both delegate to it. --- src/components/insights/daily-briefing.tsx | 135 +++++++++------------ 1 file changed, 56 insertions(+), 79 deletions(-) diff --git a/src/components/insights/daily-briefing.tsx b/src/components/insights/daily-briefing.tsx index f62aa1cfc..27bc08591 100644 --- a/src/components/insights/daily-briefing.tsx +++ b/src/components/insights/daily-briefing.tsx @@ -179,40 +179,51 @@ function DeltaBadge({ ); } -function KeyFindingRow({ finding }: { finding: DailyBriefingKeyFinding }) { - const Icon = METRIC_ICON[finding.sourceMetric]; - const href = METRIC_HREF[finding.sourceMetric]; - // v1.4.27 MB7 / CF-68 — when the briefing's `sourceMetric` maps to - // a routed sub-page, wrap the entire row in a `` so the - // whole card is tappable on mobile instead of the user having to - // hit the small headline text. Hover + focus paint a subtle bg - // shift; metrics that don't have a sub-page yet render the - // original static row. +/** + * v1.18.7 — shared row layout for the key-finding row and the signal-of-the-day + * row. Both render the same tone bar + metric icon + headline/body/delta and + * the same "wrap in a `` when the metric owns a sub-page" behaviour; the + * two only differ in their `data-slot` and the body copy they pass. + */ +function BriefingRow({ + sourceMetric, + tone, + headline, + body, + delta, + dataSlot, +}: { + sourceMetric: DailyBriefingKeyFinding["sourceMetric"]; + tone: DailyBriefingKeyFinding["tone"]; + headline: string; + body: string; + delta: string | null; + dataSlot: "daily-briefing-finding" | "daily-briefing-signal"; +}) { + const Icon = METRIC_ICON[sourceMetric]; + const href = METRIC_HREF[sourceMetric]; const rowContent = ( <>