diff --git a/src/app/insights/page.tsx b/src/app/insights/page.tsx index 7fe79a53e..e7bdaf870 100644 --- a/src/app/insights/page.tsx +++ b/src/app/insights/page.tsx @@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from "react"; import { useQuery } from "@tanstack/react-query"; import { useAuth } from "@/hooks/use-auth"; -import { useTranslations, useFormatters } from "@/lib/i18n/context"; +import { useTranslations } from "@/lib/i18n/context"; import { cn } from "@/lib/utils"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; @@ -27,14 +27,12 @@ const MoodChart = dynamic( })), { ssr: false }, ); -import { TrendCard } from "@/components/charts/trend-card"; import { ComplianceHeatmap } from "@/components/charts/compliance-heatmap"; import { Activity, Heart, HeartPulse, Loader2, - Percent, Pill, Ruler, Scale, @@ -79,7 +77,7 @@ import { getAgeFromDateOfBirth, getPersonalizedPulseTarget, } from "@/lib/analytics/pulse-targets"; -import type { DataSummary, TrendSlope } from "@/lib/analytics/trends"; +import type { DataSummary } from "@/lib/analytics/trends"; import { resolveDashboardLayout, type DashboardLayout, @@ -223,60 +221,12 @@ interface MedicationComplianceDailyResponse { dailyCompliance: Record; } -interface RangeDisplayConfig { - range: TrafficRange | null; -} - -function getRangeColorClass( - value: number | null | undefined, - config: RangeDisplayConfig, -): string | undefined { - const range = config.range; - if (value == null || !range) return undefined; - const inGreen = value >= range.greenMin && value <= range.greenMax; - const inOrange = - !inGreen && value >= range.orangeMin && value <= range.orangeMax; - - if (inGreen) return "text-green-400"; - if (inOrange) return "text-orange-400"; - return "text-red-400"; -} - -function getRangeHint( - unit: string, - config: RangeDisplayConfig, - t: (key: string) => string, - formatNumber: (value: number, fractionDigits?: number) => string, -): React.ReactNode | undefined { - const range = config.range; - if (!range) return undefined; - - const format = (value: number) => formatNumber(value, 1); - - return ( - <> -

- - {t("charts.colorGreen")} - {" "} - {format(range.greenMin)}-{format(range.greenMax)} {unit} -

-

- - {t("charts.colorOrange")} - {" "} - {format(range.orangeMin)}-{format(range.greenMin)} {t("common.or")}{" "} - {format(range.greenMax)}-{format(range.orangeMax)} {unit} -

-

- {t("charts.colorRed")}{" "} - {"< "} - {format(range.orangeMin)} {t("common.or")} {"> "} - {format(range.orangeMax)} {unit} -

- - ); -} +/** + * v1.4.19 A3 — `getRangeColorClass` / `getRangeHint` / + * `RangeDisplayConfig` removed alongside the `` tile-strip + * deletion. Those helpers were only used by the duplicate-of-dashboard + * tile grid; every other call site lives on the dashboard surface. + */ /** * v1.4.16 phase B1b — pick the freshest ISO timestamp from a list so the @@ -544,7 +494,6 @@ function getMedicationComplianceSectionStatus(input: { export default function InsightsPage() { const { isAuthenticated, user } = useAuth(); const { t, locale } = useTranslations(); - const fmt = useFormatters(); const STRENGTH_LABELS: Record = { stark: t("insights.strengthStrong"), @@ -696,10 +645,10 @@ export default function InsightsPage() { const sys = analytics?.summaries?.BLOOD_PRESSURE_SYS; const dia = analytics?.summaries?.BLOOD_PRESSURE_DIA; const p = analytics?.summaries?.PULSE; - const bf = analytics?.summaries?.BODY_FAT; - const showBodyFatCard = (bf?.count ?? 0) > 0; - const moodSummary = data?.moodSummary; - const showMoodCard = (moodSummary?.count ?? 0) > 0; + // v1.4.19 A3 — `bf` / `showBodyFatCard` / `moodSummary` / + // `showMoodCard` were bookkeeping for the now-removed duplicate + // tile strip (Marc said those tiles duplicate the dashboard). + // Remaining mood references read `data?.moodSummary` inline below. const bmiDivisor = user?.heightCm ? (user.heightCm / 100) ** 2 : null; // bmiAvg30 and bmiSlope30 still used for overallStatus + bmiSectionStatus const bmiAvg30 = bmiDivisor && w?.avg30 != null ? w.avg30 / bmiDivisor : null; @@ -948,100 +897,14 @@ export default function InsightsPage() { -
- - - - - {showBodyFatCard ? ( - - ) : null} - {showMoodCard ? ( - - ) : null} -
+ {/* v1.4.19 A3 — duplicate per-metric `` strip removed. + Up to v1.4.18 the page led with a 5-column grid of weight / + BP-sys / BP-dia / pulse / body-fat / mood tiles — exact + duplicates of the dashboard tile-strip. They added zero + information beyond what's already on the dashboard. The + recommendations grid + per-section detail cards below are + the actual value on `/insights`; the tiles only consumed + scroll height. */}