mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 04:50:59 +00:00
feat(dashboard): drop the broad Insights CTA and deep-link the briefing signals
The scoreDrop/briefing verdict button only opened the Insights overview, which the health-score card already links — gone. The briefing-spotlight rows now deep-link to their metric's sub-page via the shared METRIC_HREF mapping; metrics without a routed page fall back to the overview.
This commit is contained in:
1 parent
093a87e19e
commit
2d73e70dd4
3 files changed
+11
-5
No files matched your search
@@ -49,6 +49,7 @@ import {
|
||||
Zap,
|
||||
} from "lucide-react";
|
||||
import { ListRow } from "@/components/ui/list-row";
|
||||
import { METRIC_HREF } from "@/components/insights/daily-briefing";
|
||||
import { useTranslations } from "@/lib/i18n/context";
|
||||
import { stripChartTokens } from "@/lib/insights/chart-tokens";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -178,7 +179,10 @@ export function BriefingSpotlight({
|
||||
"focus-visible:ring-ring/50 focus-visible:ring-2 focus-visible:outline-none",
|
||||
)}
|
||||
>
|
||||
<Link href="/insights">
|
||||
{/* Deep-link each signal to its metric sub-page (the same
|
||||
mapping the briefing card's finding rows use); metrics
|
||||
without a routed sub-page fall back to the overview. */}
|
||||
<Link href={METRIC_HREF[row.sourceMetric] ?? "/insights"}>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={cn(
|
||||
|
||||
@@ -83,7 +83,11 @@ const VERDICT_MESSAGE_KEY: Record<
|
||||
allQuiet: "dashboard.hero.verdict.allQuiet",
|
||||
};
|
||||
|
||||
/** Variant → CTA label key. `allQuiet` carries no CTA (cta: null). */
|
||||
/** Variant → CTA label key. `allQuiet` carries no CTA (cta: null).
|
||||
* `scoreDrop` / `briefing` carry none either: their only destination was
|
||||
* the Insights overview, which the health-score card already links — a
|
||||
* second broad "open Insights" button on the hero was redundant. Only
|
||||
* verdicts with a SPECIFIC destination or action keep a button. */
|
||||
const CTA_LABEL_KEY: Partial<Record<DashboardVerdictVariant, string>> = {
|
||||
doseOverdue: "dashboard.hero.action.takeDose",
|
||||
doseUpcoming: "dashboard.hero.action.takeDose",
|
||||
@@ -91,8 +95,6 @@ const CTA_LABEL_KEY: Partial<Record<DashboardVerdictVariant, string>> = {
|
||||
weightDrift: "dashboard.hero.action.viewWeight",
|
||||
shortNights: "dashboard.hero.action.viewSleep",
|
||||
silence: "dashboard.hero.action.logMeasurement",
|
||||
scoreDrop: "dashboard.hero.action.viewInsights",
|
||||
briefing: "dashboard.hero.action.viewInsights",
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,7 @@ import type { BriefingFailureClass } from "@/lib/insights/briefing-failure-marke
|
||||
* dedicated routed sub-page yet (hrv, resting_hr, steps, …) fall
|
||||
* through to `null` and render as a plain row (no link wrap).
|
||||
*/
|
||||
const METRIC_HREF: Record<
|
||||
export const METRIC_HREF: Record<
|
||||
DailyBriefingKeyFinding["sourceMetric"],
|
||||
string | null
|
||||
> = {
|
||||
|
||||
Reference in new issue
Block a user