diff --git a/src/app/api/insights/general-status/route.ts b/src/app/api/insights/general-status/route.ts index f44a34eea..80585dfd4 100644 --- a/src/app/api/insights/general-status/route.ts +++ b/src/app/api/insights/general-status/route.ts @@ -10,6 +10,23 @@ import { resolveServerLocale } from "@/lib/i18n/server-locale"; export const dynamic = "force-dynamic"; +/** + * @deprecated since v1.4.25 — the `/insights` page no longer mounts the + * `` that drove this endpoint; the polished + * `` block above the per-metric sections covers + * the same surface with severity-ordered recommendations + rationale. + * + * The route + underlying `generateGeneralStatusForUser` lib remain + * live because the reminder worker (`src/lib/jobs/reminder-worker.ts`) + * still pre-warms the daily general-status cache for users opted in to + * the briefing notification. Removing the route would break the + * warm-cache job's HTTP-style coverage tests; removing the lib would + * break the worker. Both stay; this comment is for new callers. + * + * New surfaces should consume `` via + * `useInsightsAdvisorQuery()` (`@/components/insights/use-insights-advisor`) + * instead of fetching this endpoint directly. + */ export const GET = apiHandler(async (request: NextRequest) => { const { user } = await requireAuth(); diff --git a/src/app/insights/page.tsx b/src/app/insights/page.tsx index 882ade284..3f4b42cde 100644 --- a/src/app/insights/page.tsx +++ b/src/app/insights/page.tsx @@ -189,13 +189,6 @@ interface AnalyticsData { } | null; } -interface GeneralStatusData { - hasProvider: boolean; - text: string | null; - cached: boolean; - updatedAt: string | null; -} - interface BloodPressureStatusData { hasProvider: boolean; text: string | null; @@ -594,18 +587,6 @@ export default function InsightsPage() { enabled: isAuthenticated, }); - const { data: generalStatus, isLoading: isGeneralStatusLoading } = useQuery({ - queryKey: ["insights", "general-status", locale], - queryFn: async () => { - const res = await fetch(`/api/insights/general-status?locale=${locale}`); - if (!res.ok) throw new Error("Failed"); - const json = await res.json(); - return json.data as GeneralStatusData; - }, - enabled: isAuthenticated, - staleTime: 60 * 1000, - }); - const { data: bloodPressureStatus, isLoading: isBloodPressureStatusLoading } = useQuery({ queryKey: ["insights", "blood-pressure-status", locale], @@ -882,7 +863,6 @@ export default function InsightsPage() { // expand every card. Falls back to null when no section has shipped a // payload yet (the hero just hides the caption). const heroUpdatedAt = freshestUpdatedAt([ - generalStatus?.updatedAt, bloodPressureStatus?.updatedAt, weightStatus?.updatedAt, pulseStatus?.updatedAt, @@ -1018,29 +998,6 @@ export default function InsightsPage() { legacyPayload={advisor.payload?.legacyPayload ?? false} /> -
-
-

- {t("insights.generalStatusTitle")} -

- - {t(`insights.generalStatusBadge.${overallStatus.level}`)} - -
- } - text={generalStatus?.text ?? null} - hasProvider={generalStatus?.hasProvider ?? false} - cached={generalStatus?.cached ?? false} - updatedAt={generalStatus?.updatedAt ?? null} - loading={isGeneralStatusLoading} - /> -
- {/* Section 3: Blood pressure */}
@@ -1703,8 +1660,12 @@ function MedicationComplianceCalendar({ // ── Section Navigation ─────────────────────────────────────────────────────── +// v1.4.25 W3 — "section-general" pill dropped alongside the +// `` it scrolled to. The general status was +// superseded by the always-on `` block above the +// per-metric sections, so the pill had nothing to scroll to once the +// status mount was removed. const SECTION_IDS = [ - "section-general", "section-bp", "section-weight", "section-pulse", @@ -1714,7 +1675,6 @@ const SECTION_IDS = [ ] as const; const SECTION_LABEL_KEYS: Record<(typeof SECTION_IDS)[number], string> = { - "section-general": "insights.navGeneral", "section-bp": "insights.navBloodPressure", "section-weight": "insights.navWeight", "section-pulse": "insights.navPulse",