diff --git a/src/components/measurements/__tests__/measurement-list-bp-badge.test.tsx b/src/components/measurements/__tests__/measurement-list-bp-badge.test.tsx index 242b4d84a..0ecc09a48 100644 --- a/src/components/measurements/__tests__/measurement-list-bp-badge.test.tsx +++ b/src/components/measurements/__tests__/measurement-list-bp-badge.test.tsx @@ -131,4 +131,11 @@ describe("MeasurementList — Sys/Dia disambiguation badge (mobile list)", () => expect(countOccurrences(mobile, ">Sys<")).toBe(1); expect(countOccurrences(mobile, ">Dia<")).toBe(1); }); + + it("names the type on every mobile row, not only blood pressure", () => { + vi.mocked(useIsMobile).mockReturnValue(true); + expect( + countOccurrences(render("en"), 'data-slot="measurement-row-type"'), + ).toBe(baseMeasurements.length); + }); }); diff --git a/src/components/measurements/__tests__/measurement-list-meta.test.ts b/src/components/measurements/__tests__/measurement-list-meta.test.ts index f64070e04..c2ea28c44 100644 --- a/src/components/measurements/__tests__/measurement-list-meta.test.ts +++ b/src/components/measurements/__tests__/measurement-list-meta.test.ts @@ -56,4 +56,8 @@ describe("measurementUnitLabel", () => { it("passes every other unit through", () => { expect(measurementUnitLabel("WEIGHT", "kg", t)).toBe("kg"); }); + it("drops the score and rating tokens", () => { + expect(measurementUnitLabel("RECOVERY_SCORE", "score", t)).toBe(""); + expect(measurementUnitLabel("VISCERAL_FAT", "rating", t)).toBe(""); + }); }); diff --git a/src/components/measurements/measurement-list-meta.ts b/src/components/measurements/measurement-list-meta.ts index 8598c3111..0f228e9e4 100644 --- a/src/components/measurements/measurement-list-meta.ts +++ b/src/components/measurements/measurement-list-meta.ts @@ -417,5 +417,11 @@ export function measurementUnitLabel( t: (key: string) => string, ): string { const key = MEASUREMENT_UNIT_LABEL_KEYS[type]; - return key ? t(key) : unit; + if (key) return t(key); + // A score or a rating is a bare number; "72 score" reads as a stray + // English token next to the German label, not as a unit. + if (UNITLESS_TOKENS.has(unit)) return ""; + return unit; } + +const UNITLESS_TOKENS: ReadonlySet = new Set(["score", "rating"]); diff --git a/src/components/measurements/measurement-list.tsx b/src/components/measurements/measurement-list.tsx index f0f859f59..1521a11f7 100644 --- a/src/components/measurements/measurement-list.tsx +++ b/src/components/measurements/measurement-list.tsx @@ -1462,15 +1462,19 @@ export function MeasurementList({ token `text-xs` (12 px, the mobile legibility baseline) instead of an arbitrary per-site size, so the row tracks the type scale. */} - {(m.type === "BLOOD_PRESSURE_SYS" || - m.type === "BLOOD_PRESSURE_DIA") && ( - - {t(TYPE_LABEL_KEYS[m.type])} - - )} + {/* The type names the row: without it two + readings in the same unit ("55 ms" HRV and + "63 ms" RMSSD) could not be told apart on a + phone, where the desktop table's type column + does not exist. */} +

+ {TYPE_LABEL_KEYS[m.type] + ? t(TYPE_LABEL_KEYS[m.type]) + : m.type} +