mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-18 16:12:11 +00:00
perf(dashboard): compute chart band/target math server-side
Move the BP/pulse/body-fat/weight band + target derivation out of the dashboard client component and into the snapshot DTO. The page recomputed every band from the user profile on each render via the analytics band helpers; the snapshot builder now resolves the same numeric structures once server-side under a new targetBands block, calling the identical helpers. Emit only the i18n-free numbers — the label-bearing BP target zones stay client-assembled from the server numbers. Add a parity test asserting buildTargetBands matches the prior client derivation for a male, a female, and a no-profile user.
This commit is contained in:
1 parent
dd44ddeb70
commit
bd80557749
5 files changed
+372
-1
No files matched your search
@@ -6,6 +6,7 @@ import { join } from "node:path";
|
||||
import { I18nProvider } from "@/lib/i18n/context";
|
||||
import { makeFormatters } from "@/lib/format-locale";
|
||||
import type { DashboardSnapshot } from "@/lib/dashboard/snapshot";
|
||||
import { buildTargetBands } from "@/lib/dashboard/snapshot";
|
||||
import type { MedsTodayBlock } from "@/lib/dashboard/meds-today";
|
||||
import type { DataSummary } from "@/lib/analytics/trends";
|
||||
import { DashboardHero } from "../dashboard-hero";
|
||||
@@ -92,6 +93,11 @@ function baseSnapshot(
|
||||
layout: { version: 1, widgets: [] },
|
||||
layoutCatalogue: [],
|
||||
metricStates: {},
|
||||
targetBands: buildTargetBands({
|
||||
dateOfBirth: null,
|
||||
gender: null,
|
||||
heightCm: null,
|
||||
}),
|
||||
tiles: {
|
||||
summaries: {},
|
||||
lastSeenByType: {},
|
||||
|
||||
Reference in new issue
Block a user