diff --git a/src/app/insights/page.tsx b/src/app/insights/page.tsx index 50017c932..3e0596001 100644 --- a/src/app/insights/page.tsx +++ b/src/app/insights/page.tsx @@ -48,6 +48,7 @@ import { TrendsRow } from "@/components/insights/trends-row"; import { CorrelationRow } from "@/components/insights/correlation-row"; import { useInsightsAdvisorQuery } from "@/components/insights/use-insights-advisor"; import type { CorrelationResult } from "@/lib/insights/correlations"; +import { toWeekISO } from "@/lib/insights/week-iso"; import { CompareToggle } from "@/components/comparison/compare-toggle"; // Recharts is ~108 KiB Brotli — defer-load it via a self-contained scatter // wrapper so the bundle only lands once a correlation card actually renders. @@ -906,6 +907,10 @@ export default function InsightsPage() { href: `/insights/report/${weeklyReport.weekISO}`, } : undefined; + // v1.4.20 phase D reconcile — the action-row "Generate weekly report" + // button links into the current ISO week's report (B4 shipped the + // route, so the disabled-primary placeholder no longer makes sense). + const currentWeekHref = `/insights/report/${toWeekISO(new Date())}`; // v1.4.20 phase B4 — storyboard annotations for the 90-day BP chart. // The advisor payload may carry up to 20 entries; we transform them @@ -955,6 +960,7 @@ export default function InsightsPage() { setCoachOpen(true); }} weeklyReportReady={weeklyReportReady} + weeklyReportHref={currentWeekHref} healthScore={analytics?.healthScore ?? undefined} /> diff --git a/src/components/insights/hero-strip.tsx b/src/components/insights/hero-strip.tsx index 04c140695..68430dcef 100644 --- a/src/components/insights/hero-strip.tsx +++ b/src/components/insights/hero-strip.tsx @@ -89,6 +89,13 @@ interface HeroStripProps { weekISO: string; href: string; }; + /** + * v1.4.20 phase D reconcile — href to the current week's report. When + * supplied, the action-row "Generate weekly report" button becomes a + * real link instead of the disabled placeholder. B4 shipped the + * route, so the button should not paint as disabled-primary anymore. + */ + weeklyReportHref?: string; /** * Now() override for tests so the greeting bucket is deterministic. * Defaults to `new Date()`. Production callers omit this. @@ -156,6 +163,7 @@ export function HeroStrip({ onPickPrompt, onAskCoach, weeklyReportReady, + weeklyReportHref, now, healthScore, }: HeroStripProps) { @@ -237,24 +245,38 @@ export function HeroStrip({
{/* - * v1.4.20 phase B4 ships the weekly-report route. Disabled - * here so the affordance lives in the hero from B1 onwards - * without dead links — title= surfaces the "Coming soon" - * caption on hover/focus without dragging in a Radix - * tooltip provider for a single static label. + * v1.4.20 phase B4 shipped /insights/report/[week]; phase D + * reconcile enables this button as a real link to the + * current ISO week. Older parents that haven't adopted the + * weeklyReportHref prop still get the disabled affordance. */} - + {weeklyReportHref ? ( + + ) : ( + + )} {/* B2b wires this into the Coach drawer. The button is enabled whenever the parent supplies an `onAskCoach` handler; older parents that haven't adopted B2b yet