diff --git a/src/components/clinician/history-sections.tsx b/src/components/clinician/history-sections.tsx index 308f74ea4..dd6a25138 100644 --- a/src/components/clinician/history-sections.tsx +++ b/src/components/clinician/history-sections.tsx @@ -26,6 +26,7 @@ import { type LeafScope, type Translate, } from "./report-sections"; +import { withLabUnit } from "@/lib/labs/dimensionless"; /** Join the parts of a composed value, dropping the ones with nothing in. */ function compose(parts: Array): string { @@ -73,7 +74,7 @@ export function LabResultsSection({ const qualitative = lab.value === null; const reading = qualitative ? lab.valueText - : `${fmtLab(lab.value as number, lab.sourceValue)} ${lab.unit}`.trim(); + : withLabUnit(fmtLab(lab.value as number, lab.sourceValue), lab.unit); const range = ( low: number | null, high: number | null, diff --git a/src/components/insights/labs-changes-card.tsx b/src/components/insights/labs-changes-card.tsx index 8ed2a69dc..30a8e146a 100644 --- a/src/components/insights/labs-changes-card.tsx +++ b/src/components/insights/labs-changes-card.tsx @@ -11,6 +11,7 @@ import { queryKeys } from "@/lib/query-keys"; import { SectionHeading } from "@/components/ui/section-heading"; import type { LabChange } from "@/lib/insights/labs-changes"; import { InsightSectionCard } from "./insight-section-card"; +import { withLabUnit } from "@/lib/labs/dimensionless"; /** * v1.25 — "what changed since your last panel" card. @@ -81,7 +82,7 @@ export function LabsChangesCard({ const signedDelta = c.direction === "flat" ? t("insights.labsChanges.directionFlat") - : `${c.delta > 0 ? "+" : ""}${c.delta} ${c.unit}`.trim(); + : withLabUnit(`${c.delta > 0 ? "+" : ""}${c.delta}`, c.unit); return (

- {`${c.latest} ${c.unit}`.trim()} + {withLabUnit(String(c.latest), c.unit)} {labelKey ? ` · ${t(labelKey)}` : ""}

diff --git a/src/components/labs/biomarker-manager.tsx b/src/components/labs/biomarker-manager.tsx index f204f0842..c69d11aba 100644 --- a/src/components/labs/biomarker-manager.tsx +++ b/src/components/labs/biomarker-manager.tsx @@ -24,6 +24,8 @@ import { BiomarkerForm } from "./biomarker-form"; import { BiomarkerMergeSheet } from "./biomarker-merge-sheet"; import type { BiomarkerDto, BiomarkerListResponse } from "./types"; import { useLabNumber } from "./use-lab-format"; +import { withLabUnit } from "@/lib/labs/dimensionless"; +import { LabUnitName } from "./lab-unit-input"; /** * v1.18.1 — the Biomarker catalog manager. v1.22 — compact editable rows. @@ -124,11 +126,11 @@ export function BiomarkerManager() {
{marker.name} - {marker.unit} +

{range - ? `${t("labs.referenceLabel")} ${range} ${marker.unit}` + ? `${t("labs.referenceLabel")} ${withLabUnit(range, marker.unit)}` : t("labs.biomarker.noRange")} {marker.panel ? ` · ${marker.panel}` : ""}

diff --git a/src/components/labs/biomarker-merge-sheet.tsx b/src/components/labs/biomarker-merge-sheet.tsx index 0853b410b..721af3157 100644 --- a/src/components/labs/biomarker-merge-sheet.tsx +++ b/src/components/labs/biomarker-merge-sheet.tsx @@ -28,6 +28,7 @@ import { useTranslations } from "@/lib/i18n/context"; import { queryKeys } from "@/lib/query-keys"; import type { BiomarkerDto, BiomarkerMergeResultDto } from "./types"; +import { labUnitLabel } from "@/lib/labs/dimensionless"; /** The most sources one merge takes, matching the server. */ const MAX_SOURCES = 10; @@ -166,7 +167,7 @@ export function BiomarkerMergeSheet({

{tCount("labs.merge.previewSummary", preview.movedReadings, { name: preview.target.name, - unit: preview.target.unit, + unit: labUnitLabel(preview.target.unit, t), })}