From 5de309c19a1492154f33c719839d94ea6da7e836 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?=
Date: Mon, 23 Nov 2026 11:19:24 +0100
Subject: [PATCH 01/14] feat(nav): let the navigation counts be switched off
(#1113)
The counts on Medications and Checkups in the sidebar and the More sheet
can now be turned off under Settings > Account > Display. On by default,
which is how they behaved before.
User.showNavCounts (migration 0559, BOOLEAN NOT NULL DEFAULT true) is
written by PATCH /api/auth/me/show-nav-counts and published on
/api/auth/me, so the account seed carries it into the first paint.
useNavCounts reads it: while it is off no count is drawn and
GET /api/nav/counts is never asked.
The setting travels with the account settings backup in both purposes,
is restored like the other interface preferences, and is kept by the data
wipe. The settings round trip covers write, /me, backup and restore; the
backup parity goldens gain the column.
---
CHANGELOG.md | 4 +-
docs/api/openapi.yaml | 78 +++++++++++++
docs/ops/deploy.md | 7 +-
messages/de.json | 4 +-
messages/en.json | 4 +-
messages/es.json | 4 +-
messages/fr.json | 4 +-
messages/it.json | 4 +-
messages/ko.json | 4 +-
messages/nl.json | 4 +-
messages/pl.json | 4 +-
messages/pt-BR.json | 4 +-
messages/ru.json | 4 +-
.../0559_show_nav_counts/migration.sql | 21 ++++
prisma/schema.prisma | 6 +
src/app/api/auth/me/show-nav-counts/route.ts | 72 ++++++++++++
.../__tests__/modules-section.test.tsx | 1 +
.../__tests__/time-format-select.test.tsx | 1 +
.../__tests__/unit-preference-select.test.tsx | 1 +
.../settings/account-section/index.tsx | 3 +
src/components/settings/nav-counts-switch.tsx | 64 +++++++++++
src/hooks/__tests__/use-nav-counts.test.tsx | 104 ++++++++++++++++++
src/hooks/use-auth.ts | 9 ++
src/hooks/use-nav-counts.ts | 11 +-
src/lib/auth/account-seed.ts | 1 +
src/lib/auth/me-payload.ts | 8 +-
src/lib/auth/session-user.ts | 1 +
src/lib/data-wipe/wipe-plan.ts | 2 +
.../export/account-settings-backup-schema.ts | 1 +
src/lib/export/account-settings-backup.ts | 2 +
src/lib/openapi/routes/account-sharing.ts | 5 +
src/lib/openapi/routes/profile.ts | 38 +++++++
src/lib/validations/user-prefs.ts | 5 +
tests/browser/render.tsx | 1 +
.../export-disaster-recovery.json | 2 +
.../backup-parity/export-portable.json | 2 +
.../restore-disaster-recovery-over-live.json | 2 +-
.../restore-disaster-recovery.json | 4 +-
.../backup-parity/restore-portable.json | 4 +-
.../backup-parity/restore-skips.json | 1 +
.../backup-parity/restore-version-1.json | 2 +
.../backup-parity/seeded-account.json | 1 +
tests/integration/settings-round-trip.test.ts | 15 +++
43 files changed, 497 insertions(+), 22 deletions(-)
create mode 100644 prisma/migrations/0559_show_nav_counts/migration.sql
create mode 100644 src/app/api/auth/me/show-nav-counts/route.ts
create mode 100644 src/components/settings/nav-counts-switch.tsx
create mode 100644 src/hooks/__tests__/use-nav-counts.test.tsx
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f5b0870ba1..ecca875d50 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -45,7 +45,7 @@
- Capture menu: most-used types as rows, "Save and next", the last reading under the field; the save receipt has Undo and Edit.
- Biomarker page lists its five newest values under the chart.
- Time zone per reading from the iPhone; the Day view, list and daily charts follow it.
-- The sidebar and the More sheet sort their entries under Tracking, Health record and Analysis. Medications and Checkups show a small number when a dose or a check-up is due. No address changes. Thanks to @Cnote43 for the sketch it follows. ([#1113](https://github.com/MBombeck/HealthLog/discussions/1113))
+- The sidebar and the More sheet sort their entries under Tracking, Health record and Analysis. Medications and Checkups show a small number when a dose or a check-up is due; the numbers can be switched off under Settings > Account > Display. No address changes. Thanks to @Cnote43 for the sketch it follows. ([#1113](https://github.com/MBombeck/HealthLog/discussions/1113))
- The search finds every page and every settings card, in every language also by keyword ("snooze", "dark mode", "Nextcloud", "ICE").
- Settings > Notifications has an "Alerts" group with account security and lasting change in a vital, visible before any channel is set up.
- Settings > Data & privacy opens with "Who can reach your record": accounts and guardians, clinician links, the emergency card link, the care and cycle calendars, API tokens, MCP and sign-ins, each with its link.
@@ -200,7 +200,7 @@
### Updating
- Take a backup first. With the `backups` volume the container writes a pre-migration dump before it migrates; without it, run `pg_dump` yourself. `docs/ops/deploy.md`, "v1.49.0 notes", has the operator detail.
-- Thirty-six migrations, 0514 to 0558 (0516, 0523, 0527, 0528, 0541, 0548, 0550, 0552 and 0555 do not exist); the boot log says `36 database migrations pending`. Seven touch existing data:
+- Thirty-seven migrations, 0514 to 0559 (0516, 0523, 0527, 0528, 0541, 0548, 0550, 0552 and 0555 do not exist); the boot log says `37 database migrations pending`. Seven touch existing data:
- 0515 merges dose rows recorded twice for one slot (take, then skip, then the oldest pending row; the rest soft-deleted), refunds the stock of a merged take, clears the auto-miss mark on taken or skipped doses, and rewrites legacy single-time schedules into dose windows.
- 0517 makes e-mail and username unique regardless of case. On a clash it stops, changes nothing, and the container does not start: list the accounts with the query in `docs/ops/deploy.md` ("Accounts that differ only in case"), ideally before the update, rename one of each pair, run `prisma migrate resolve --rolled-back 0517_case_insensitive_identity_and_retention_indexes` as shown there, and start again. It also drops six duplicate indexes, builds four retention indexes (bounded to five minutes) and checks the shape of text day keys, `NOT VALID` with a warning where old rows do not fit.
- 0529 lowers APNs tokens; where two devices held one token in different case, the most recently seen keeps it and the other registers again on its next launch.
diff --git a/docs/api/openapi.yaml b/docs/api/openapi.yaml
index 52f0ef9ec2..d080f506d0 100644
--- a/docs/api/openapi.yaml
+++ b/docs/api/openapi.yaml
@@ -12196,6 +12196,43 @@ paths:
"415": *a30
"422": *a4
"429": *a5
+ /api/auth/me/show-nav-counts:
+ patch:
+ tags:
+ - Auth
+ summary: Show or hide the navigation counts
+ description: >-
+ Whether the sidebar and the More sheet show their counts: the doses due on Medications and the check-ups due on
+ Checkups. On by default. While it is off a client shows no count and does not call `GET /api/nav/counts`. The
+ current value is `showNavCounts` on `/api/auth/me`.
+
+
+ Hard-set, idempotent, audit-logged. Rate-limited 60 / min per user. The caller's own setting: under a switched
+ session it is still the caller's.
+
+
+ The body is capped at 1 KB and must carry `Content-Type: application/json`. Anything larger is 413, a wrong
+ content type is 415, and a body that is not JSON at all is 400.
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ShowNavCountsPatchRequest"
+ responses:
+ "200":
+ description: The stored flag.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/PatchShowNavCountsEnvelope"
+ "400": *a28
+ "401": *a1
+ "403": *a9
+ "413": *a29
+ "415": *a30
+ "422": *a4
+ "429": *a5
/api/auth/me/use-central-codex:
get:
tags:
@@ -35824,6 +35861,14 @@ components:
required:
- storeWorkoutRoutes
description: Keep or stop keeping the GPS track of new workouts. Off by default.
+ ShowNavCountsPatchRequest:
+ type: object
+ properties:
+ showNavCounts:
+ type: boolean
+ required:
+ - showNavCounts
+ description: Show or hide the counts in the navigation (doses due, check-ups due). On by default.
UseCentralCodexPatchRequest:
type: object
properties:
@@ -48916,6 +48961,8 @@ components:
type:
- string
- "null"
+ showNavCounts:
+ type: boolean
timeFormat:
type: string
dateFormat:
@@ -71705,6 +71752,31 @@ components:
- data
- error
additionalProperties: false
+ PatchShowNavCountsEnvelope:
+ type: object
+ properties:
+ data:
+ $ref: "#/components/schemas/ShowNavCountsResponse"
+ error:
+ type: "null"
+ meta:
+ type: object
+ properties:
+ requestId:
+ type: string
+ additionalProperties: false
+ required:
+ - data
+ - error
+ additionalProperties: false
+ ShowNavCountsResponse:
+ type: object
+ properties:
+ showNavCounts:
+ type: boolean
+ required:
+ - showNavCounts
+ additionalProperties: false
GetUseCentralCodexEnvelope:
type: object
properties:
@@ -100064,6 +100136,11 @@ components:
two agree on one registry, otherwise `NONE`, and stored, so a later change of language does not move it. Set
it with `PATCH /api/auth/me/medicine-registry`. Clients show and edit it; the link itself comes ready-built
on the medication list and detail as `leafletSearch`.'
+ showNavCounts:
+ type: boolean
+ description: "#1113 — whether the navigation shows its counts (doses due on Medications, check-ups due on Checkups).
+ `true` by default. When `false`, show no count and do not call `GET /api/nav/counts`. Set it with `PATCH
+ /api/auth/me/show-nav-counts`."
features:
type: object
properties:
@@ -100160,6 +100237,7 @@ components:
- timezone
- glucoseUnit
- medicineRegistry
+ - showNavCounts
- features
- push
- accountAccess
diff --git a/docs/ops/deploy.md b/docs/ops/deploy.md
index da9dd86033..4ed9555c0e 100644
--- a/docs/ops/deploy.md
+++ b/docs/ops/deploy.md
@@ -214,9 +214,9 @@ always did, and finds nothing in the queue schema it did not create.
### v1.49.0 notes
The sequence above covers this release, with one possible stop (`0517`, see
-below). It brings thirty-six migrations, `0514` to `0558` (`0516`, `0523`,
+below). It brings thirty-seven migrations, `0514` to `0559` (`0516`, `0523`,
`0527`, `0528`, `0541`, `0548`, `0550`, `0552` and `0555` do not exist), so
-the boot log says `36 database migrations pending`. Copy the pre-migration
+the boot log says `37 database migrations pending`. Copy the pre-migration
dump of step 0 off the host before you start: it is the way back.
Seven migrations touch data you already have:
@@ -338,7 +338,8 @@ quantities (`0514`, `0519`), nullable columns or columns with a default
`devices.local_runway_until` in `0542`, `push_data_changes.intake_sync_owed_at`
in `0544`, `live_activity_tokens.relay_started BOOLEAN NOT NULL DEFAULT false`
in `0545`, `measurements.stats_computed_at` in `0547`, `users.medicine_registry`
-and `medications.leaflet_url` in `0549`), and new tables (`0522`, `0524`,
+and `medications.leaflet_url` in `0549`, `users.show_nav_counts BOOLEAN NOT
+NULL DEFAULT true` in `0559`), and new tables (`0522`, `0524`,
`0531`, `0532`, `0534`, `0535`, and `ai_job_failures` in `0553`, which holds
why background AI work last stopped for a record: closed reason codes only,
cleared by the next success, cascading with the account).
diff --git a/messages/de.json b/messages/de.json
index 821cf2e2be..512ef76c71 100644
--- a/messages/de.json
+++ b/messages/de.json
@@ -8200,7 +8200,9 @@
"displayCard": {
"title": "Darstellung",
"description": "Sprache, Einheiten und Formate, gespeichert, sobald du sie änderst.",
- "themeDescription": "System folgt deinem Gerät zwischen hell und dunkel. Die Wahl gilt auf diesem Gerät."
+ "themeDescription": "System folgt deinem Gerät zwischen hell und dunkel. Die Wahl gilt auf diesem Gerät.",
+ "navCountsLabel": "Zahlen in der Navigation",
+ "navCountsDescription": "Zeigt in der Seitenleiste und im Menü „Mehr“ neben den Einträgen, wie viele Einnahmen und Vorsorgetermine fällig sind."
},
"integrationCard": {
"state": {
diff --git a/messages/en.json b/messages/en.json
index c2d230594f..80bae34e3c 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -8200,7 +8200,9 @@
"displayCard": {
"title": "Display",
"description": "Language, units and formats, saved as soon as you change them.",
- "themeDescription": "System follows your device between light and dark. The choice is kept on this device."
+ "themeDescription": "System follows your device between light and dark. The choice is kept on this device.",
+ "navCountsLabel": "Counts in the navigation",
+ "navCountsDescription": "Shows how many doses and check-ups are due beside their entries in the sidebar and the More menu."
},
"integrationCard": {
"state": {
diff --git a/messages/es.json b/messages/es.json
index 1ab6d4155d..41befe9600 100644
--- a/messages/es.json
+++ b/messages/es.json
@@ -8200,7 +8200,9 @@
"displayCard": {
"title": "Visualización",
"description": "Idioma, unidades y formatos; se guardan en cuanto los cambias.",
- "themeDescription": "Sistema sigue a tu dispositivo entre claro y oscuro. La elección se guarda en este dispositivo."
+ "themeDescription": "Sistema sigue a tu dispositivo entre claro y oscuro. La elección se guarda en este dispositivo.",
+ "navCountsLabel": "Contadores en la navegación",
+ "navCountsDescription": "Muestra junto a sus entradas, en la barra lateral y en el menú Más, cuántas tomas y revisiones están pendientes."
},
"integrationCard": {
"state": {
diff --git a/messages/fr.json b/messages/fr.json
index 64a4e58050..fb2706b900 100644
--- a/messages/fr.json
+++ b/messages/fr.json
@@ -8200,7 +8200,9 @@
"displayCard": {
"title": "Affichage",
"description": "Langue, unités et formats, enregistrés dès que vous les modifiez.",
- "themeDescription": "Système suit votre appareil entre clair et sombre. Le choix est gardé sur cet appareil."
+ "themeDescription": "Système suit votre appareil entre clair et sombre. Le choix est gardé sur cet appareil.",
+ "navCountsLabel": "Compteurs dans la navigation",
+ "navCountsDescription": "Affiche, à côté des entrées de la barre latérale et du menu Plus, le nombre de prises et de bilans à faire."
},
"integrationCard": {
"state": {
diff --git a/messages/it.json b/messages/it.json
index f71342cbd8..0ef578569c 100644
--- a/messages/it.json
+++ b/messages/it.json
@@ -8200,7 +8200,9 @@
"displayCard": {
"title": "Visualizzazione",
"description": "Lingua, unità e formati, salvati appena li modifichi.",
- "themeDescription": "Sistema segue il dispositivo tra chiaro e scuro. La scelta resta su questo dispositivo."
+ "themeDescription": "Sistema segue il dispositivo tra chiaro e scuro. La scelta resta su questo dispositivo.",
+ "navCountsLabel": "Conteggi nella navigazione",
+ "navCountsDescription": "Mostra accanto alle voci della barra laterale e del menu Altro quante dosi e quanti controlli sono in scadenza."
},
"integrationCard": {
"state": {
diff --git a/messages/ko.json b/messages/ko.json
index cac8d3cb5c..82cc648c9f 100644
--- a/messages/ko.json
+++ b/messages/ko.json
@@ -8200,7 +8200,9 @@
"displayCard": {
"title": "표시",
"description": "언어, 단위, 형식은 바꾸는 즉시 저장돼요.",
- "themeDescription": "시스템은 기기 설정에 따라 밝은 테마와 어두운 테마를 오갑니다. 선택은 이 기기에 저장됩니다."
+ "themeDescription": "시스템은 기기 설정에 따라 밝은 테마와 어두운 테마를 오갑니다. 선택은 이 기기에 저장됩니다.",
+ "navCountsLabel": "내비게이션 숫자",
+ "navCountsDescription": "사이드바와 더 보기 메뉴의 항목 옆에 복용할 약과 받아야 할 검진이 몇 개인지 보여줘요."
},
"integrationCard": {
"state": {
diff --git a/messages/nl.json b/messages/nl.json
index 524f993c25..10d4e5a923 100644
--- a/messages/nl.json
+++ b/messages/nl.json
@@ -8200,7 +8200,9 @@
"displayCard": {
"title": "Weergave",
"description": "Taal, eenheden en notaties, opgeslagen zodra je ze wijzigt.",
- "themeDescription": "Systeem volgt je apparaat tussen licht en donker. De keuze blijft op dit apparaat."
+ "themeDescription": "Systeem volgt je apparaat tussen licht en donker. De keuze blijft op dit apparaat.",
+ "navCountsLabel": "Aantallen in de navigatie",
+ "navCountsDescription": "Toont naast de items in de zijbalk en het menu Meer hoeveel innames en controles er openstaan."
},
"integrationCard": {
"state": {
diff --git a/messages/pl.json b/messages/pl.json
index df8f16b9ce..ae8791fc15 100644
--- a/messages/pl.json
+++ b/messages/pl.json
@@ -8200,7 +8200,9 @@
"displayCard": {
"title": "Wyświetlanie",
"description": "Język, jednostki i formaty zapisywane od razu po zmianie.",
- "themeDescription": "Systemowy podąża za urządzeniem między jasnym a ciemnym. Wybór zostaje na tym urządzeniu."
+ "themeDescription": "Systemowy podąża za urządzeniem między jasnym a ciemnym. Wybór zostaje na tym urządzeniu.",
+ "navCountsLabel": "Liczniki w nawigacji",
+ "navCountsDescription": "Pokazuje przy pozycjach na pasku bocznym i w menu Więcej, ile dawek i badań kontrolnych jest do zrobienia."
},
"integrationCard": {
"state": {
diff --git a/messages/pt-BR.json b/messages/pt-BR.json
index 5a289542d2..b61e56bec7 100644
--- a/messages/pt-BR.json
+++ b/messages/pt-BR.json
@@ -8200,7 +8200,9 @@
"displayCard": {
"title": "Exibição",
"description": "Escolha como os dados são exibidos no HealthLog.",
- "themeDescription": "Sistema acompanha o seu dispositivo entre claro e escuro. A escolha fica salva neste dispositivo."
+ "themeDescription": "Sistema acompanha o seu dispositivo entre claro e escuro. A escolha fica salva neste dispositivo.",
+ "navCountsLabel": "Contadores na navegação",
+ "navCountsDescription": "Mostra ao lado das entradas, na barra lateral e no menu Mais, quantas doses e consultas preventivas estão pendentes."
},
"integrationCard": {
"state": {
diff --git a/messages/ru.json b/messages/ru.json
index 9313884b5f..0bc1aac54e 100644
--- a/messages/ru.json
+++ b/messages/ru.json
@@ -8200,7 +8200,9 @@
"displayCard": {
"title": "Отображение",
"description": "Язык, единицы и форматы, сохраняются сразу при изменении.",
- "themeDescription": "Системная следует за устройством между светлой и тёмной. Выбор хранится на этом устройстве."
+ "themeDescription": "Системная следует за устройством между светлой и тёмной. Выбор хранится на этом устройстве.",
+ "navCountsLabel": "Счётчики в навигации",
+ "navCountsDescription": "Показывает рядом с пунктами на боковой панели и в меню «Ещё», сколько приёмов и профилактических осмотров предстоит."
},
"integrationCard": {
"state": {
diff --git a/prisma/migrations/0559_show_nav_counts/migration.sql b/prisma/migrations/0559_show_nav_counts/migration.sql
new file mode 100644
index 0000000000..0818d4694b
--- /dev/null
+++ b/prisma/migrations/0559_show_nav_counts/migration.sql
@@ -0,0 +1,21 @@
+-- The switch for the navigation counts (#1113): whether the sidebar and the
+-- More sheet show the doses due on Medications and the check-ups due on
+-- Checkups.
+--
+-- `users.show_nav_counts`: on by default, which is how the counts behaved
+-- before the switch existed, so every existing account keeps them.
+--
+-- A NOT NULL column with a constant default: metadata-only since Postgres 11,
+-- no rewrite. IF NOT EXISTS keeps a replay harmless. Reversibility: drop the
+-- column.
+--
+-- @retry-on-lock-timeout
+
+DO $migration$
+BEGIN
+ PERFORM set_config('lock_timeout', '5s', true);
+
+ ALTER TABLE "users"
+ ADD COLUMN IF NOT EXISTS "show_nav_counts" BOOLEAN NOT NULL DEFAULT true;
+END
+$migration$;
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 8509efee47..fa79d210db 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -469,6 +469,12 @@ model User {
/// medication detail read, which builds the link. The server never fetches
/// anything from a registry.
medicineRegistry String? @map("medicine_registry")
+ /// #1113 — whether the navigation shows its counts (doses due on
+ /// Medications, check-ups due on Checkups) in the sidebar and the More
+ /// sheet. On by default. While it is off the client does not ask
+ /// `GET /api/nav/counts` at all. Written by
+ /// `PATCH /api/auth/me/show-nav-counts`; read through `/api/auth/me`.
+ showNavCounts Boolean @default(true) @map("show_nav_counts")
// v1.18.6 — explicit "I have diabetes / clinician glucose targets" opt-in.
// When `true`, the glucose target resolver applies the tighter ADA glycemic
// GOAL bands (fasting 80–130, postprandial < 180) instead of the general
diff --git a/src/app/api/auth/me/show-nav-counts/route.ts b/src/app/api/auth/me/show-nav-counts/route.ts
new file mode 100644
index 0000000000..9a8ef8fb1d
--- /dev/null
+++ b/src/app/api/auth/me/show-nav-counts/route.ts
@@ -0,0 +1,72 @@
+/**
+ * Whether the navigation shows its counts (#1113).
+ *
+ * PATCH /api/auth/me/show-nav-counts — body `{ showNavCounts: boolean }`.
+ *
+ * The sidebar and the More sheet show the doses due on Medications and the
+ * check-ups due on Checkups. On by default. While it is off the client shows
+ * no count and does not ask `GET /api/nav/counts`. The current value is
+ * published on `/api/auth/me` as `showNavCounts`.
+ *
+ * The per-user-scalar pattern of `medicine-registry` next door: 60/min rate
+ * limit, a 1 KB body cap, Zod safeParse with a 422, an audit row, a
+ * field-by-field write, and the resolved next state as the answer.
+ * Idempotent.
+ */
+import { apiHandler, requireAuth } from "@/lib/api-handler";
+import { apiError, apiSuccess, getClientIp } from "@/lib/api-response";
+import { parseJsonBody } from "@/lib/api/body";
+import { annotate } from "@/lib/logging/context";
+import { auditLog } from "@/lib/auth/audit";
+import { prisma } from "@/lib/db";
+import { checkRateLimit, rateLimitHeaders } from "@/lib/rate-limit";
+import { showNavCountsPatchSchema } from "@/lib/validations/user-prefs";
+
+export const dynamic = "force-dynamic";
+
+const PATCH_RATE_LIMIT = 60;
+const PATCH_WINDOW_MS = 60_000;
+
+export const PATCH = apiHandler(async (req: Request) => {
+ const { user } = await requireAuth();
+
+ const rl = await checkRateLimit(
+ `show-nav-counts:patch:${user.id}`,
+ PATCH_RATE_LIMIT,
+ PATCH_WINDOW_MS,
+ );
+ if (!rl.allowed) {
+ const response = apiError("Too many requests", 429);
+ for (const [k, v] of Object.entries(rateLimitHeaders(rl))) {
+ response.headers.set(k, v);
+ }
+ return response;
+ }
+
+ const parsed = await parseJsonBody(req, showNavCountsPatchSchema, {
+ maxBytes: 1024,
+ action: "auth.me.show-nav-counts.patch.invalid_shape",
+ });
+ if (!parsed.ok) return parsed.error;
+
+ const next = parsed.data.showNavCounts;
+ const previous = user.showNavCounts;
+
+ await prisma.user.update({
+ where: { id: user.id },
+ data: { showNavCounts: next },
+ });
+
+ await auditLog("user.show-nav-counts.update", {
+ userId: user.id,
+ ipAddress: getClientIp(req),
+ details: { previous, next },
+ });
+
+ annotate({
+ action: { name: "auth.me.show-nav-counts.patch" },
+ meta: { showNavCounts: next },
+ });
+
+ return apiSuccess({ showNavCounts: next });
+});
diff --git a/src/components/settings/__tests__/modules-section.test.tsx b/src/components/settings/__tests__/modules-section.test.tsx
index b396ccabd1..49af5cd242 100644
--- a/src/components/settings/__tests__/modules-section.test.tsx
+++ b/src/components/settings/__tests__/modules-section.test.tsx
@@ -100,6 +100,7 @@ function buildUser(
timeFormat: "AUTO",
dateFormat: "AUTO",
medicineRegistry: "NONE",
+ showNavCounts: true,
disableCoach: false,
fullName: null,
insurerName: null,
diff --git a/src/components/settings/__tests__/time-format-select.test.tsx b/src/components/settings/__tests__/time-format-select.test.tsx
index 53f260eae5..916eed5abf 100644
--- a/src/components/settings/__tests__/time-format-select.test.tsx
+++ b/src/components/settings/__tests__/time-format-select.test.tsx
@@ -48,6 +48,7 @@ function buildUser(timeFormat: TimeFormatPreference): AuthUser {
timeFormat,
dateFormat: "AUTO",
medicineRegistry: "NONE",
+ showNavCounts: true,
disableCoach: false,
fullName: null,
insurerName: null,
diff --git a/src/components/settings/__tests__/unit-preference-select.test.tsx b/src/components/settings/__tests__/unit-preference-select.test.tsx
index 2f7d572be9..3799f58d0e 100644
--- a/src/components/settings/__tests__/unit-preference-select.test.tsx
+++ b/src/components/settings/__tests__/unit-preference-select.test.tsx
@@ -51,6 +51,7 @@ function buildUser(unitPreference: "metric" | "imperial"): AuthUser {
timeFormat: "AUTO",
dateFormat: "AUTO",
medicineRegistry: "NONE",
+ showNavCounts: true,
disableCoach: false,
fullName: null,
insurerName: null,
diff --git a/src/components/settings/account-section/index.tsx b/src/components/settings/account-section/index.tsx
index 131e4555ea..da8db41cc1 100644
--- a/src/components/settings/account-section/index.tsx
+++ b/src/components/settings/account-section/index.tsx
@@ -34,6 +34,7 @@ import { TimeFormatSelect } from "@/components/settings/time-format-select";
import { DateFormatSelect } from "@/components/settings/date-format-select";
import { UnitPreferenceSelect } from "@/components/settings/unit-preference-select";
import { GlucoseUnitSelect } from "@/components/settings/glucose-unit-select";
+import { NavCountsSwitch } from "@/components/settings/nav-counts-switch";
import { detectBrowserTimezone, userDayKey } from "@/lib/tz/format";
import { apiFetchRaw, apiGet } from "@/lib/api/api-fetch";
import {
@@ -776,6 +777,8 @@ export function DisplayPreferencesCard({
{t("settings.displayCard.themeDescription")}
+ {/* #1113 — the counts on Medications and Checkups in the navigation. */}
+
);
}
diff --git a/src/components/settings/nav-counts-switch.tsx b/src/components/settings/nav-counts-switch.tsx
new file mode 100644
index 0000000000..6b17916812
--- /dev/null
+++ b/src/components/settings/nav-counts-switch.tsx
@@ -0,0 +1,64 @@
+"use client";
+
+import { useState } from "react";
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+
+import { toastWrittenOutcome } from "@/components/outcome/outcome-toast";
+import { SwitchRow } from "@/components/ui/switch-row";
+import { useAuth } from "@/hooks/use-auth";
+import { apiPatch } from "@/lib/api/api-fetch";
+import { showErrorToast } from "@/lib/errors/error-toast";
+import { useTranslations } from "@/lib/i18n/context";
+import { queryKeys } from "@/lib/query-keys";
+
+/**
+ * Settings > Account > Display: whether the sidebar and the More sheet show
+ * their counts (#1113), the doses due on Medications and the check-ups due on
+ * Checkups. On by default. Saves on change through
+ * `PATCH /api/auth/me/show-nav-counts`, then re-reads `/api/auth/me`, which
+ * `useNavCounts` reads the choice from; while it is off the counts are not
+ * asked for at all.
+ */
+export function NavCountsSwitch({
+ isAuthenticated,
+}: {
+ isAuthenticated: boolean;
+}) {
+ const { t } = useTranslations();
+ const queryClient = useQueryClient();
+ const { user } = useAuth();
+ const [optimistic, setOptimistic] = useState(null);
+ const checked = optimistic ?? user?.showNavCounts !== false;
+
+ const mutation = useMutation({
+ mutationFn: (showNavCounts: boolean) =>
+ apiPatch<{ showNavCounts: boolean }>("/api/auth/me/show-nav-counts", {
+ showNavCounts,
+ }),
+ onSuccess: async () => {
+ toastWrittenOutcome("success", t("settings.saved"));
+ await queryClient.invalidateQueries({ queryKey: queryKeys.authMe() });
+ setOptimistic(null);
+ },
+ onError: (err) => {
+ setOptimistic(null);
+ showErrorToast(t("settings.savingError"), { cause: err });
+ },
+ });
+
+ return (
+ {
+ if (next === checked || mutation.isPending || !isAuthenticated) return;
+ setOptimistic(next);
+ mutation.mutate(next);
+ }}
+ />
+ );
+}
diff --git a/src/hooks/__tests__/use-nav-counts.test.tsx b/src/hooks/__tests__/use-nav-counts.test.tsx
new file mode 100644
index 0000000000..f6139996a9
--- /dev/null
+++ b/src/hooks/__tests__/use-nav-counts.test.tsx
@@ -0,0 +1,104 @@
+/**
+ * The navigation counts follow the person's switch (#1113): on by default,
+ * and while it is off no count is drawn and `/api/nav/counts` is never asked.
+ */
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { renderToStaticMarkup } from "react-dom/server";
+import { Pill } from "lucide-react";
+
+const useAuthMock = vi.fn();
+vi.mock("@/hooks/use-auth", () => ({ useAuth: () => useAuthMock() }));
+const inSharedRecordMock = vi.fn(() => false);
+vi.mock("@/hooks/use-record-capabilities", () => ({
+ useRecordCapabilities: () => ({ inSharedRecord: inSharedRecordMock() }),
+}));
+vi.mock("@/hooks/use-mounted", () => ({ useMounted: () => true }));
+const apiGetMock = vi.fn();
+vi.mock("@/lib/api/api-fetch", () => ({
+ apiGet: (...args: unknown[]) => apiGetMock(...args),
+}));
+
+// The query layer stands in as a recorder: it hands back the server's counts
+// and runs the query function only when the options enable it, so the test
+// sees both what the hook returns and whether it asked at all.
+const queryOptions: Array<{ enabled?: boolean; queryFn: () => unknown }> = [];
+vi.mock("@tanstack/react-query", () => ({
+ useQuery: (options: { enabled?: boolean; queryFn: () => unknown }) => {
+ queryOptions.push(options);
+ if (options.enabled !== false) options.queryFn();
+ return { data: { dosesDue: 2, checkupsDue: 1 } };
+ },
+}));
+
+import { MoreHubGroups } from "@/components/layout/more-hub-groups";
+import { useNavCounts } from "@/hooks/use-nav-counts";
+import { I18nProvider } from "@/lib/i18n/context";
+
+function Probe({ enabled }: { enabled: boolean }) {
+ return {JSON.stringify(useNavCounts(enabled))};
+}
+
+function counts(enabled = true): Record {
+ const html = renderToStaticMarkup();
+ return JSON.parse(
+ html.replace(/^|<\/span>$/g, "").replace(/"/g, '"'),
+ ) as Record;
+}
+
+function moreSheet(): string {
+ return renderToStaticMarkup(
+
+ false}
+ onNavigate={() => {}}
+ />
+ ,
+ );
+}
+
+describe("useNavCounts and the switch", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ queryOptions.length = 0;
+ inSharedRecordMock.mockReturnValue(false);
+ });
+
+ it("shows the counts and asks for them by default", () => {
+ useAuthMock.mockReturnValue({ user: { showNavCounts: true } });
+ expect(counts()).toEqual({ "/medications": 2, "/checkups": 1 });
+ expect(queryOptions.at(-1)?.enabled).toBe(true);
+ expect(apiGetMock).toHaveBeenCalledWith("/api/nav/counts");
+ });
+
+ it("keeps them on before the account resolves", () => {
+ useAuthMock.mockReturnValue({ user: null });
+ expect(counts()).toEqual({ "/medications": 2, "/checkups": 1 });
+ });
+
+ it("shows nothing and never asks while the switch is off", () => {
+ useAuthMock.mockReturnValue({ user: { showNavCounts: false } });
+ expect(counts()).toEqual({});
+ expect(queryOptions.length).toBeGreaterThan(0);
+ expect(queryOptions.every((o) => o.enabled === false)).toBe(true);
+ expect(apiGetMock).not.toHaveBeenCalled();
+ });
+
+ it("draws the badge in the More sheet only while the switch is on", () => {
+ useAuthMock.mockReturnValue({ user: { showNavCounts: true } });
+ expect(moreSheet().match(/data-slot="nav-count"/g)).toHaveLength(1);
+
+ useAuthMock.mockReturnValue({ user: { showNavCounts: false } });
+ const html = moreSheet();
+ expect(html).not.toContain('data-slot="nav-count"');
+ expect(html).toContain("Medications");
+ expect(apiGetMock).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/src/hooks/use-auth.ts b/src/hooks/use-auth.ts
index 40f9b21a88..d547e28a4e 100644
--- a/src/hooks/use-auth.ts
+++ b/src/hooks/use-auth.ts
@@ -171,6 +171,12 @@ export interface AuthUser {
* server. Coerced to `NONE` against a stale /me payload.
*/
medicineRegistry: MedicineRegistryChoice;
+ /**
+ * #1113 — whether the sidebar and the More sheet show their counts. Off
+ * means no count and no `/api/nav/counts` read. Coerced to `true` (the
+ * default) against a stale /me payload.
+ */
+ showNavCounts: boolean;
/**
* v1.4.47 — the signed-in person's own stored Coach opt-out. It is
* the value the Activate-Coach switch and the module toggle edit, and
@@ -534,6 +540,9 @@ export function adoptMePayload(
medicineRegistry: isMedicineRegistryChoice(data.medicineRegistry)
? data.medicineRegistry
: "NONE",
+ // #1113 — on unless the payload says off, so a stale payload keeps the
+ // counts the way they were before the switch existed.
+ showNavCounts: data.showNavCounts !== false,
// v1.15.0 — coerce against a stale /me payload so the cycle nav entry
// stays hidden by default when the field is absent.
cycleTrackingEnabled: data.cycleTrackingEnabled === true,
diff --git a/src/hooks/use-nav-counts.ts b/src/hooks/use-nav-counts.ts
index ce6f2646a9..54444ae570 100644
--- a/src/hooks/use-nav-counts.ts
+++ b/src/hooks/use-nav-counts.ts
@@ -9,10 +9,13 @@
* (`src/lib/navigation/nav-counts.ts`). The sidebar and the More sheet share
* the cached answer; every dose write and every check-up write evicts it
* (`queryKeys.navCounts()` in the dependent-key sets). Inside somebody else's
- * record no count is shown and nothing is asked.
+ * record no count is shown and nothing is asked. Neither when the person
+ * switched the counts off (`showNavCounts`, Settings > Account > Display):
+ * no count, and no read either.
*/
import { useQuery } from "@tanstack/react-query";
+import { useAuth } from "@/hooks/use-auth";
import { useRecordCapabilities } from "@/hooks/use-record-capabilities";
import { apiGet } from "@/lib/api/api-fetch";
import type { NavCounts } from "@/lib/navigation/nav-counts";
@@ -28,7 +31,11 @@ export function navCountsByHref(
export function useNavCounts(enabled: boolean): Record {
const { inSharedRecord } = useRecordCapabilities();
- const active = enabled && !inSharedRecord;
+ const { user } = useAuth();
+ // On unless the person switched them off; the account seed carries the
+ // choice, so the first paint already knows.
+ const shown = user?.showNavCounts !== false;
+ const active = enabled && shown && !inSharedRecord;
const counts = useQuery({
queryKey: queryKeys.navCounts(),
queryFn: () => apiGet("/api/nav/counts"),
diff --git a/src/lib/auth/account-seed.ts b/src/lib/auth/account-seed.ts
index b28f6a6128..10f35bc756 100644
--- a/src/lib/auth/account-seed.ts
+++ b/src/lib/auth/account-seed.ts
@@ -45,6 +45,7 @@ export const ACCOUNT_SEED_FIELDS = [
"timeFormat",
"dateFormat",
"medicineRegistry",
+ "showNavCounts",
"notificationPrefs",
"disableCoach",
"displayName",
diff --git a/src/lib/auth/me-payload.ts b/src/lib/auth/me-payload.ts
index 1c0941c2da..cf148e9f7f 100644
--- a/src/lib/auth/me-payload.ts
+++ b/src/lib/auth/me-payload.ts
@@ -265,8 +265,9 @@ export async function buildAuthMePayload(
/**
* How the caller reads the app: the glucose unit, the unit system, the hour
- * cycle, the date order and the medicine registry the leaflet search opens.
- * Each is the caller's own preference, never the record's.
+ * cycle, the date order, the medicine registry the leaflet search opens and
+ * whether the navigation shows its counts. Each is the caller's own
+ * preference, never the record's.
*/
function displayPreferences(
user: AuthContext["user"],
@@ -291,6 +292,9 @@ function displayPreferences(
// medication list and detail reads build the link (`leafletSearch`), so a
// client only reads this to show and edit the setting.
medicineRegistry,
+ // #1113 — whether the sidebar and the More sheet show their counts. Off
+ // means no count and no `/api/nav/counts` read.
+ showNavCounts: user.showNavCounts,
};
}
diff --git a/src/lib/auth/session-user.ts b/src/lib/auth/session-user.ts
index 2629863a7c..9af3ea5b44 100644
--- a/src/lib/auth/session-user.ts
+++ b/src/lib/auth/session-user.ts
@@ -77,6 +77,7 @@ export const SESSION_USER_SELECT = {
moodTagLayoutJson: true,
glucoseUnit: true,
medicineRegistry: true,
+ showNavCounts: true,
hasDiabetes: true,
labsLocalOcrEnabled: true,
unitPreference: true,
diff --git a/src/lib/data-wipe/wipe-plan.ts b/src/lib/data-wipe/wipe-plan.ts
index 87dcf06eab..f6224948cd 100644
--- a/src/lib/data-wipe/wipe-plan.ts
+++ b/src/lib/data-wipe/wipe-plan.ts
@@ -622,6 +622,8 @@ export const USER_KEPT_FIELDS: Readonly> = {
glucoseUnit: "an interface preference — mg/dL or mmol/L rendering",
medicineRegistry:
"an interface preference — which official registry the leaflet search opens, not record content",
+ showNavCounts:
+ "an interface preference — whether the navigation shows its counts, not record content",
disclaimerAcknowledgedAt:
"the account's acknowledgement of the medical disclaimer, which is about the app and not about the record",
disclaimerAcknowledgedVersion:
diff --git a/src/lib/export/account-settings-backup-schema.ts b/src/lib/export/account-settings-backup-schema.ts
index 3f1bcc8f3b..c59ba17fc8 100644
--- a/src/lib/export/account-settings-backup-schema.ts
+++ b/src/lib/export/account-settings-backup-schema.ts
@@ -55,6 +55,7 @@ export const accountSettingsBackupSchema = z
unitPreference: z.string().nullable().optional(),
glucoseUnit: z.string().nullable().optional(),
medicineRegistry: z.string().nullable().optional(),
+ showNavCounts: z.boolean().optional(),
timeFormat: z.string().optional(),
dateFormat: z.string().optional(),
modulePreferencesJson: z.unknown().optional(),
diff --git a/src/lib/export/account-settings-backup.ts b/src/lib/export/account-settings-backup.ts
index e2aaa0f7a4..4fc68e16d1 100644
--- a/src/lib/export/account-settings-backup.ts
+++ b/src/lib/export/account-settings-backup.ts
@@ -595,6 +595,8 @@ const ACCOUNT_SETTING_CODECS = {
),
// #1430 — which medicine registry the leaflet search opens.
medicineRegistry: oneOf("medicineRegistry", MEDICINE_REGISTRY_CHOICES, true),
+ // #1113 — whether the navigation shows its counts.
+ showNavCounts: plain("showNavCounts"),
timeFormat: oneOf("timeFormat", Object.values(TimeFormatPreference), false),
dateFormat: oneOf("dateFormat", Object.values(DateFormatPreference), false),
// What is switched on, what is shown where, and what counts as in range.
diff --git a/src/lib/openapi/routes/account-sharing.ts b/src/lib/openapi/routes/account-sharing.ts
index cd3d8231b2..6cd068d275 100644
--- a/src/lib/openapi/routes/account-sharing.ts
+++ b/src/lib/openapi/routes/account-sharing.ts
@@ -541,6 +541,11 @@ const accountPayload = z
),
// #1430 — enumerated: the medication surfaces and the settings read it.
medicineRegistry: medicineRegistryField,
+ showNavCounts: z
+ .boolean()
+ .describe(
+ "#1113 — whether the navigation shows its counts (doses due on Medications, check-ups due on Checkups). `true` by default. When `false`, show no count and do not call `GET /api/nav/counts`. Set it with `PATCH /api/auth/me/show-nav-counts`.",
+ ),
features: accountFeaturesBlock,
push: accountPushBlock,
accountAccess: accountAccessBlock,
diff --git a/src/lib/openapi/routes/profile.ts b/src/lib/openapi/routes/profile.ts
index 2b61c27485..b59bf02ecc 100644
--- a/src/lib/openapi/routes/profile.ts
+++ b/src/lib/openapi/routes/profile.ts
@@ -34,6 +34,7 @@ import {
injectionSitePrefsPatchSchema,
labsLocalOcrPatchSchema,
workoutRoutesPatchSchema,
+ showNavCountsPatchSchema,
unitPreferencePatchSchema,
glucoseUnitPatchSchema,
useCentralCodexPatchSchema,
@@ -1049,6 +1050,16 @@ const workoutRoutesResponse = z
.object({ storeWorkoutRoutes: z.boolean() })
.meta({ id: "WorkoutRoutesResponse" });
+const showNavCountsPatchRequest = showNavCountsPatchSchema.meta({
+ id: "ShowNavCountsPatchRequest",
+ description:
+ "Show or hide the counts in the navigation (doses due, check-ups due). On by default.",
+});
+
+const showNavCountsResponse = z
+ .object({ showNavCounts: z.boolean() })
+ .meta({ id: "ShowNavCountsResponse" });
+
const useCentralCodexPatchRequest = useCentralCodexPatchSchema.meta({
id: "UseCentralCodexPatchRequest",
description:
@@ -2361,6 +2372,33 @@ export const profilePaths: NonNullable = {
},
},
},
+ "/api/auth/me/show-nav-counts": {
+ patch: {
+ tags: ["Auth"],
+ summary: "Show or hide the navigation counts",
+ description:
+ "Whether the sidebar and the More sheet show their counts: the doses due on Medications and the check-ups due on Checkups. On by default. While it is off a client shows no count and does not call `GET /api/nav/counts`. The current value is `showNavCounts` on `/api/auth/me`.\n\nHard-set, idempotent, audit-logged. Rate-limited 60 / min per user. The caller's own setting: under a switched session it is still the caller's.\n\nThe body is capped at 1 KB and must carry `Content-Type: application/json`. Anything larger is 413, a wrong content type is 415, and a body that is not JSON at all is 400.",
+ requestBody: {
+ required: true,
+ content: { "application/json": { schema: showNavCountsPatchRequest } },
+ },
+ responses: {
+ "200": {
+ description: "The stored flag.",
+ content: {
+ "application/json": {
+ schema: dataEnvelope(
+ showNavCountsResponse,
+ "PatchShowNavCountsEnvelope",
+ ),
+ },
+ },
+ },
+ ...cappedScalarBodyRefusals,
+ ...stdResponses,
+ },
+ },
+ },
"/api/auth/me/use-central-codex": {
get: {
tags: ["Auth"],
diff --git a/src/lib/validations/user-prefs.ts b/src/lib/validations/user-prefs.ts
index f6d3778137..dc3e5bf989 100644
--- a/src/lib/validations/user-prefs.ts
+++ b/src/lib/validations/user-prefs.ts
@@ -56,6 +56,11 @@ export const workoutRoutesPatchSchema = z.object({
storeWorkoutRoutes: z.boolean(),
});
+/** `PATCH /api/auth/me/show-nav-counts` — the counts in the navigation. */
+export const showNavCountsPatchSchema = z.object({
+ showNavCounts: z.boolean(),
+});
+
/** `PATCH /api/auth/me/use-central-codex` — the operator's shared Codex. */
export const useCentralCodexPatchSchema = z.object({
useCentralCodex: z.boolean(),
diff --git a/tests/browser/render.tsx b/tests/browser/render.tsx
index f38acb2c7a..eadefb8347 100644
--- a/tests/browser/render.tsx
+++ b/tests/browser/render.tsx
@@ -47,6 +47,7 @@ export function authUser(overrides: Partial = {}): AuthUser {
timeFormat: "AUTO",
dateFormat: "AUTO",
medicineRegistry: "NONE",
+ showNavCounts: true,
disableCoach: false,
fullName: null,
insurerName: null,
diff --git a/tests/integration/__golden__/backup-parity/export-disaster-recovery.json b/tests/integration/__golden__/backup-parity/export-disaster-recovery.json
index 9756200cb1..0b7222f205 100644
--- a/tests/integration/__golden__/backup-parity/export-disaster-recovery.json
+++ b/tests/integration/__golden__/backup-parity/export-disaster-recovery.json
@@ -81,6 +81,7 @@
"unitPreference": "imperial",
"glucoseUnit": "mmol/L",
"medicineRegistry": "GB",
+ "showNavCounts": false,
"timeFormat": "H12",
"dateFormat": "DMY",
"modulePreferencesJson": {
@@ -2811,6 +2812,7 @@
"unitPreference": "imperial",
"glucoseUnit": "mmol/L",
"medicineRegistry": "GB",
+ "showNavCounts": false,
"timeFormat": "H12",
"dateFormat": "DMY",
"modulePreferencesJson": {
diff --git a/tests/integration/__golden__/backup-parity/export-portable.json b/tests/integration/__golden__/backup-parity/export-portable.json
index 2a62256f3a..cb1e8f8bbf 100644
--- a/tests/integration/__golden__/backup-parity/export-portable.json
+++ b/tests/integration/__golden__/backup-parity/export-portable.json
@@ -29,6 +29,7 @@
"unitPreference": "imperial",
"glucoseUnit": "mmol/L",
"medicineRegistry": "GB",
+ "showNavCounts": false,
"timeFormat": "H12",
"dateFormat": "DMY",
"modulePreferencesJson": {
@@ -2020,6 +2021,7 @@
"unitPreference": "imperial",
"glucoseUnit": "mmol/L",
"medicineRegistry": "GB",
+ "showNavCounts": false,
"timeFormat": "H12",
"dateFormat": "DMY",
"modulePreferencesJson": {
diff --git a/tests/integration/__golden__/backup-parity/restore-disaster-recovery-over-live.json b/tests/integration/__golden__/backup-parity/restore-disaster-recovery-over-live.json
index 8ceb87498a..d504137194 100644
--- a/tests/integration/__golden__/backup-parity/restore-disaster-recovery-over-live.json
+++ b/tests/integration/__golden__/backup-parity/restore-disaster-recovery-over-live.json
@@ -345,7 +345,7 @@
"seizureTypes": 1,
"seizureEvents": 2
},
- "accountSettingsApplied": 67,
+ "accountSettingsApplied": 68,
"skipped": {
"catalogueKeys": [],
"links": 0
diff --git a/tests/integration/__golden__/backup-parity/restore-disaster-recovery.json b/tests/integration/__golden__/backup-parity/restore-disaster-recovery.json
index 673b158ee4..bdb49c6d78 100644
--- a/tests/integration/__golden__/backup-parity/restore-disaster-recovery.json
+++ b/tests/integration/__golden__/backup-parity/restore-disaster-recovery.json
@@ -345,7 +345,7 @@
"seizureTypes": 0,
"seizureEvents": 0
},
- "accountSettingsApplied": 67,
+ "accountSettingsApplied": 68,
"skipped": {
"catalogueKeys": [],
"links": 0
@@ -3082,6 +3082,7 @@
},
"glucoseUnit": "mmol/L",
"medicineRegistry": "GB",
+ "showNavCounts": false,
"hasDiabetes": true,
"labsLocalOcrEnabled": true,
"storeWorkoutRoutes": true,
@@ -3316,6 +3317,7 @@
"unitPreference": "imperial",
"glucoseUnit": "mmol/L",
"medicineRegistry": "GB",
+ "showNavCounts": false,
"timeFormat": "H12",
"dateFormat": "DMY",
"modulePreferencesJson": {
diff --git a/tests/integration/__golden__/backup-parity/restore-portable.json b/tests/integration/__golden__/backup-parity/restore-portable.json
index a3064ee1d5..868287e91b 100644
--- a/tests/integration/__golden__/backup-parity/restore-portable.json
+++ b/tests/integration/__golden__/backup-parity/restore-portable.json
@@ -381,7 +381,7 @@
"seizureTypes": 0,
"seizureEvents": 0
},
- "accountSettingsApplied": 67,
+ "accountSettingsApplied": 68,
"skipped": {
"catalogueKeys": [
{
@@ -2574,6 +2574,7 @@
},
"glucoseUnit": "mmol/L",
"medicineRegistry": "GB",
+ "showNavCounts": false,
"hasDiabetes": true,
"labsLocalOcrEnabled": true,
"storeWorkoutRoutes": true,
@@ -2756,6 +2757,7 @@
"unitPreference": "imperial",
"glucoseUnit": "mmol/L",
"medicineRegistry": "GB",
+ "showNavCounts": false,
"timeFormat": "H12",
"dateFormat": "DMY",
"modulePreferencesJson": {
diff --git a/tests/integration/__golden__/backup-parity/restore-skips.json b/tests/integration/__golden__/backup-parity/restore-skips.json
index 7b668b1539..fd16070fea 100644
--- a/tests/integration/__golden__/backup-parity/restore-skips.json
+++ b/tests/integration/__golden__/backup-parity/restore-skips.json
@@ -942,6 +942,7 @@
"nutrientTargetsJson": null,
"glucoseUnit": null,
"medicineRegistry": null,
+ "showNavCounts": true,
"hasDiabetes": false,
"labsLocalOcrEnabled": false,
"storeWorkoutRoutes": false,
diff --git a/tests/integration/__golden__/backup-parity/restore-version-1.json b/tests/integration/__golden__/backup-parity/restore-version-1.json
index ee5d339e85..fe91249258 100644
--- a/tests/integration/__golden__/backup-parity/restore-version-1.json
+++ b/tests/integration/__golden__/backup-parity/restore-version-1.json
@@ -1092,6 +1092,7 @@
"nutrientTargetsJson": null,
"glucoseUnit": null,
"medicineRegistry": null,
+ "showNavCounts": true,
"hasDiabetes": false,
"labsLocalOcrEnabled": false,
"storeWorkoutRoutes": false,
@@ -1298,6 +1299,7 @@
"unitPreference": null,
"glucoseUnit": null,
"medicineRegistry": null,
+ "showNavCounts": true,
"timeFormat": "AUTO",
"dateFormat": "AUTO",
"modulePreferencesJson": null,
diff --git a/tests/integration/__golden__/backup-parity/seeded-account.json b/tests/integration/__golden__/backup-parity/seeded-account.json
index 232e1173a0..8d119fe8bf 100644
--- a/tests/integration/__golden__/backup-parity/seeded-account.json
+++ b/tests/integration/__golden__/backup-parity/seeded-account.json
@@ -2679,6 +2679,7 @@
},
"glucoseUnit": "mmol/L",
"medicineRegistry": "GB",
+ "showNavCounts": false,
"hasDiabetes": true,
"labsLocalOcrEnabled": true,
"storeWorkoutRoutes": true,
diff --git a/tests/integration/settings-round-trip.test.ts b/tests/integration/settings-round-trip.test.ts
index 8e0c22edf5..4486fcdbfa 100644
--- a/tests/integration/settings-round-trip.test.ts
+++ b/tests/integration/settings-round-trip.test.ts
@@ -43,6 +43,7 @@ import * as disableCoach from "@/app/api/auth/me/disable-coach/route";
import * as unitPreference from "@/app/api/auth/me/unit-preference/route";
import * as glucoseUnit from "@/app/api/auth/me/glucose-unit/route";
import * as medicineRegistry from "@/app/api/auth/me/medicine-registry/route";
+import * as showNavCounts from "@/app/api/auth/me/show-nav-counts/route";
import * as injectionSites from "@/app/api/auth/me/injection-site-prefs/route";
import * as modules from "@/app/api/auth/me/modules/route";
import * as healthScore from "@/app/api/auth/me/health-score-config/route";
@@ -444,6 +445,20 @@ function entries(user: Pick): Entry[] {
expected: "BE",
me: { pick: (me) => at(me, "medicineRegistry"), expected: "BE" },
},
+ {
+ // #1113 — published on /me, which is also its read. Written off, the
+ // value that differs from the default.
+ columns: ["showNavCounts"],
+ write: {
+ handler: showNavCounts.PATCH,
+ method: "PATCH",
+ route: "/api/auth/me/show-nav-counts",
+ body: { showNavCounts: false },
+ },
+ read: get(getMe, "/api/auth/me", "showNavCounts"),
+ expected: false,
+ me: { pick: (me) => at(me, "showNavCounts"), expected: false },
+ },
{
columns: ["globalExcludedInjectionSites"],
write: {
From 4f6d7eeab512054f93d435a767e6c64c6f4427e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?=
Date: Mon, 23 Nov 2026 11:31:55 +0100
Subject: [PATCH 02/14] feat(care): rename the checkups page to Care and move
it to /care
The preventive-care page reads Care in English and lives at /care, with
the practitioners under /care/practitioners. German keeps Vorsorge;
Brazilian Portuguese and Russian drop their transliterations for
Prevencao and Profilaktika. Message keys, tour ids, the Arrangement
sub-page and every API path stay as they were.
/checkups and /checkups/* answer a permanent redirect to the same place
under /care with the query kept, and /vorsorge now goes there in one
hop. care-route-redirects.test.ts runs the old addresses through the
Next.js matcher and checks status and Location.
What the server sends keeps /checkups: push and webhook targets, and
the href/path fields of the digest, day, search, related-records and
onboarding answers, because released iPhone builds parse only those
shapes. visit-links.ts now has a wire and a web spelling;
care-wire-paths.test.ts pins the wire values and fails on a /care
literal in server code.
---
CHANGELOG.md | 3 +-
bundle-budget.json | 4 +-
docs/contributing/ui-standards.md | 2 +-
docs/self-hosting/notifications.md | 2 +-
docs/using/care-calendar-feed.md | 6 +-
docs/using/search.md | 2 +-
e2e/command-palette.spec.ts | 6 +-
e2e/dashboard-ssr-prefetch-hydration.spec.ts | 6 +-
e2e/tablet-shell.spec.ts | 2 +-
e2e/vaccinations.spec.ts | 6 +-
e2e/visits.spec.ts | 4 +-
messages/en.json | 18 +--
messages/pt-BR.json | 16 +--
messages/ru.json | 2 +-
next.config.ts | 24 +++-
prisma/schema.prisma | 4 +-
.../baselines/version-stamp-comments.json | 2 +-
src/__tests__/care-route-redirects.test.ts | 106 ++++++++++++++++++
src/__tests__/care-wire-paths.test.ts | 93 +++++++++++++++
.../encounter-reminder-exclusion.test.ts | 2 +-
.../prefetch-page-caching-guard.test.ts | 2 +-
src/__tests__/session-surface-guard.test.ts | 2 +-
.../shared-record-navigation.test.tsx | 22 ++--
src/__tests__/surface-registry-guard.test.ts | 2 +-
src/__tests__/visit-link-guard.test.ts | 45 ++++----
src/app/api/measurement-reminders/route.ts | 2 +-
.../api/vaccinations/[id]/booster/route.ts | 2 +-
.../__tests__/page-client-view.test.tsx | 10 +-
.../__tests__/page-prefetch.test.tsx | 18 +--
src/app/{checkups => care}/page-client.tsx | 4 +-
src/app/{checkups => care}/page.tsx | 12 +-
.../{checkups => care}/practitioners/page.tsx | 2 +-
src/app/medications/page-client.tsx | 2 +-
.../daily/__tests__/priority-card.test.tsx | 4 +-
src/components/daily/priority-card.tsx | 2 +-
src/components/daily/today-hero.tsx | 2 +-
.../__tests__/document-record-links.test.tsx | 2 +-
.../documents/document-record-links.tsx | 4 +-
.../documents/vault/use-vault-library.ts | 2 +-
.../__tests__/visits-section.test.tsx | 2 +-
src/components/encounters/visits-section.tsx | 4 +-
.../illness/episode-visits-card.tsx | 4 +-
.../illness/illness-episode-detail.tsx | 4 +-
.../__tests__/module-page-gate.test.tsx | 2 +-
.../layout/__tests__/nav-model.test.ts | 18 ++-
.../layout/__tests__/rail-nav-groups.test.tsx | 6 +-
.../layout/__tests__/sidebar-nav.test.tsx | 2 +-
src/components/layout/context-links.tsx | 2 +-
src/components/layout/nav-model.ts | 2 +-
src/components/links/related-records.tsx | 4 +-
...orsorge-dashboard-card-next-visit.test.tsx | 6 +-
.../vorsorge-dashboard-card.tsx | 12 +-
.../vorsorge-section.tsx | 4 +-
.../practitioners/practitioner-list.tsx | 4 +-
.../vaccinations/use-vaccinations.ts | 2 +-
.../__tests__/deep-linked-record.test.ts | 2 +-
src/hooks/use-deep-linked-record.ts | 2 +-
src/hooks/use-nav-counts.ts | 2 +-
src/lib/command-palette/synonyms.ts | 2 +-
src/lib/daily/digest.ts | 2 +-
src/lib/day/records.ts | 2 +-
src/lib/encounters/visit-links.ts | 35 +++++-
src/lib/measurement-reminders/due-day.ts | 2 +-
src/lib/measurement-reminders/list-read.ts | 2 +-
src/lib/navigation/shared-record.ts | 6 +-
src/lib/notifications/tap-target.ts | 1 +
src/lib/onboarding/tour-state.ts | 2 +-
src/lib/vaccinations/booster-mint.ts | 2 +-
src/lib/vaccinations/renewal.ts | 4 +-
tests/durations/unit.json | 4 +-
70 files changed, 419 insertions(+), 180 deletions(-)
create mode 100644 src/__tests__/care-route-redirects.test.ts
create mode 100644 src/__tests__/care-wire-paths.test.ts
rename src/app/{checkups => care}/__tests__/page-client-view.test.tsx (91%)
rename src/app/{checkups => care}/__tests__/page-prefetch.test.tsx (87%)
rename src/app/{checkups => care}/page-client.tsx (98%)
rename src/app/{checkups => care}/page.tsx (92%)
rename src/app/{checkups => care}/practitioners/page.tsx (98%)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f5b0870ba1..671ceb065c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -68,6 +68,7 @@
- One snooze length per person under Settings > Notifications (10 minutes to two hours, 30 by default) on every surface, Telegram's reminder keyboard included, in the person's language.
- One intake form for the medications page, the history and the capture menu, which names the dose it counts for; the medication page offers take, skip and snooze for the next dose.
- The reminder card says in words what will happen; the reminder steps are offered for every scheduled medication.
+- The preventive-care page is called Care in English and lives at `/care` (the practitioners under `/care/practitioners`). Old `/checkups` links, bookmarks and notifications already on a phone redirect there with their query intact. German keeps Vorsorge; Brazilian Portuguese and Russian name it Prevenção and Профилактика.
- Deleting a dose happens at once with an Undo; "Take all due" has one Undo for the batch.
- Dose times follow the 12 or 24 hour setting.
- The medication setup asks less: the category is optional (Other by default), the dose step asks nothing twice, a disabled Next says what is missing, and the summary says from when each dose counts as missed.
@@ -12663,7 +12664,7 @@ A feature release. The Coach reads its replies aloud, can draw the metric it is
- Insight and Coach assessments are rewritten to connect signals into a motivating narrative rather than restate figures, with substantially expanded score summaries; generated text now renders in paragraphs and carries clearer "updated" timestamps — today with the time, yesterday, and a date for anything older.
- The daily read folds in labs, preventive care, workouts, and glucose, and correlations surface emerging signals over a recent window alongside more cross-signal links.
-- The preventive-care area is now "Checkups", reached at `/checkups`; the German interface keeps "Vorsorge".
+- The preventive-care area is now "Checkups", reached at `/care`; the German interface keeps "Vorsorge".
- Settings pages share one consistent layout, and the settings and admin sidebar stays pinned while the content scrolls.
- Lab biomarkers are a compact, editable list with hide and restore.
- Local AI servers stream their replies and honour the configurable timeout, so slower self-hosted models finish cleanly.
diff --git a/bundle-budget.json b/bundle-budget.json
index cb592693b2..d6059e62e3 100644
--- a/bundle-budget.json
+++ b/bundle-budget.json
@@ -18,8 +18,8 @@
"/auth/native-return/page": 289,
"/auth/register/page": 294,
"/c/[token]/view/page": 290,
- "/checkups/page": 373,
- "/checkups/practitioners/page": 295,
+ "/care/page": 373,
+ "/care/practitioners/page": 295,
"/claim/[token]/page": 288,
"/coach/conversations/page": 299,
"/coach/page": 362,
diff --git a/docs/contributing/ui-standards.md b/docs/contributing/ui-standards.md
index 75fce4a945..202cb05e78 100644
--- a/docs/contributing/ui-standards.md
+++ b/docs/contributing/ui-standards.md
@@ -161,7 +161,7 @@ A two-column sub-shell that needs a "don't jump while loading" floor derives it
Settings + Notifications are **account utilities, not feature destinations**. They live ONLY in the user/avatar menu (mobile top-bar `DropdownMenu`; desktop sidebar avatar menu, with Settings additionally in the sidebar footer). The mobile "More" overflow hub carries **feature destinations only** (Measurements, Mood, Cycle, Labs, Coach, …), never Settings or Notifications. The hub is `mobileMoreHubDestinations()` = `visibleNavDestinations` minus the primary slots (`/`, `/medications`, `/insights`); it does **not** append the utility tail. `NAV_UTILITY_DESTINATIONS` (`visibleUtilityDestinations()`) feeds the sidebar footer + user menus, not the mobile overflow. Never surface a utility in two menus reachable from the same screen.
-The destination list is grouped by one ordered map, `NAV_GROUPS` in `nav-model.ts`: Dashboard alone on top, then **Tracking**, **Health record** and **Analysis**. The sidebar, the phone's More sheet and the search palette's page hints all read it. Headings are plain labels, never controls; collapsed, a hairline stands where a heading was and the heading stays for screen readers. A switched-off module's entry leaves no gap, and a group with no entry left has no heading. Medications and Checkups carry a count when something is due (read from the caches those pages already fill, no request of its own); nothing else does. The tab bar does not change.
+The destination list is grouped by one ordered map, `NAV_GROUPS` in `nav-model.ts`: Dashboard alone on top, then **Tracking**, **Health record** and **Analysis**. The sidebar, the phone's More sheet and the search palette's page hints all read it. Headings are plain labels, never controls; collapsed, a hairline stands where a heading was and the heading stays for screen readers. A switched-off module's entry leaves no gap, and a group with no entry left has no heading. Medications and Care carry a count when something is due (read from the caches those pages already fill, no request of its own); nothing else does. The tab bar does not change.
The rail's destination list is the one part of the rail that gives up height: the logo band, the footer group and the account row stay pinned, and the list scrolls between them (`overscroll-contain`, no native scrollbar, fades at an edge with more). A mouse gets the height-stepped row density; a finger keeps the 44 px rows, and at an edge with more destinations the rail shows a scroll cue (`sidebar-nav-scroll-cue`) that a tap follows. Guard: `e2e/tablet-shell.spec.ts`.
diff --git a/docs/self-hosting/notifications.md b/docs/self-hosting/notifications.md
index 15f1397417..9d7f10f683 100644
--- a/docs/self-hosting/notifications.md
+++ b/docs/self-hosting/notifications.md
@@ -464,7 +464,7 @@ once per event type, and every channel carries the same target:
| Mood reminder | `/mood`, with the mood entry sheet already open |
| Morning briefing | the dashboard |
| Medication reminder, low supply, shared dose | `/medications` (low supply opens the medication) |
-| Check-up and measurement reminders | `/checkups` |
+| Check-up and measurement reminders | `/care` |
| Proactive Coach nudge | the Coach conversation it started |
| Cycle reminders | `/cycle` (the dashboard with discreet notifications on) |
| New sign-in | Settings, Security |
diff --git a/docs/using/care-calendar-feed.md b/docs/using/care-calendar-feed.md
index 936a836b73..68c0540bbd 100644
--- a/docs/using/care-calendar-feed.md
+++ b/docs/using/care-calendar-feed.md
@@ -9,7 +9,7 @@ the data is kept.
## Turning it on
Open **Settings**, then **Health record**, and find **Care calendar** under
-**Calendar**. **Check-ups** and **Vaccinations** link to it from the row under
+**Calendar**. **Care** and **Vaccinations** link to it from the row under
their heading, and **Settings > Data & privacy** lists it under **Who can reach
your record**. Before the button, the card says what it
means: your calendar provider stores the dates on its servers, and turning the
@@ -30,9 +30,9 @@ Adding it works as for the cycle feed: see
- **Booked visits**: every visit you booked for the future, at its time, as a
one-hour event. A visit stores a start, not an end, so the hour is a
placeholder.
-- **Check-ups coming due**: every check-up you set up under Check-ups, as an
+- **Check-ups coming due**: every check-up you set up under Care, as an
all-day event on the day it comes due. This is the same due day the
- Check-ups page shows, so a skip, a snooze or a "done" moves it in your
+ Care page shows, so a skip, a snooze or a "done" moves it in your
calendar too.
- **Vaccination boosters coming due**, the same way. They follow the
vaccinations module: with it switched off, they are left out.
diff --git a/docs/using/search.md b/docs/using/search.md
index 5351ea92bb..d637fba431 100644
--- a/docs/using/search.md
+++ b/docs/using/search.md
@@ -30,7 +30,7 @@ entries that match what you typed:
- workouts
- notes on mood entries, readings and illness days
-Each hit opens where the entry lives: a visit on the check-ups page, a lab
+Each hit opens where the entry lives: a visit on the Care page, a lab
result on its analyte, a note on a mood entry or a reading on its day, a note
on an illness day in its illness.
diff --git a/e2e/command-palette.spec.ts b/e2e/command-palette.spec.ts
index 6b6522b46c..357be0620e 100644
--- a/e2e/command-palette.spec.ts
+++ b/e2e/command-palette.spec.ts
@@ -219,7 +219,7 @@ test.describe("command palette", () => {
const queries = await mockRecordSearch(page);
// Start on the page the hit opens, on another tab: the link has to move
// the open page, not only a fresh one.
- await page.goto("/checkups");
+ await page.goto("/care");
await shellReady(page);
await expect(
page.locator('[data-testid="checkups-tab-visits"]'),
@@ -245,7 +245,7 @@ test.describe("command palette", () => {
}
await expect(hit).toHaveAttribute("aria-selected", "true");
await page.keyboard.press("Enter");
- await expect(page).toHaveURL(/\/checkups\?visit=e2e-visit$/);
+ await expect(page).toHaveURL(/\/care\?visit=e2e-visit$/);
await expect(palette(page)).toHaveCount(0);
await expect(
page.locator('[data-testid="checkups-tab-visits"]'),
@@ -317,6 +317,6 @@ test.describe("command palette", () => {
.evaluate((el) => el.scrollWidth - el.clientWidth);
expect(overflow).toBeLessThanOrEqual(0);
await hit.click();
- await expect(page).toHaveURL(/\/checkups\?visit=e2e-visit$/);
+ await expect(page).toHaveURL(/\/care\?visit=e2e-visit$/);
});
});
diff --git a/e2e/dashboard-ssr-prefetch-hydration.spec.ts b/e2e/dashboard-ssr-prefetch-hydration.spec.ts
index bea2d3acf8..699aa72373 100644
--- a/e2e/dashboard-ssr-prefetch-hydration.spec.ts
+++ b/e2e/dashboard-ssr-prefetch-hydration.spec.ts
@@ -98,7 +98,7 @@ test.describe("dashboard hydration with the SSR prefetch on", () => {
expect(witness?.replaced).toBe(0);
});
- // The two list-page prefetch wrappers (`/checkups`, `/mood`) hand TanStack a
+ // The two list-page prefetch wrappers (`/care`, `/mood`) hand TanStack a
// server-dehydrated state through the same HydrationBoundary mechanism the
// dashboard uses. Their page-clients render behind a `useMounted` gate, so
// the streamed HTML is the auth-gate shell by design — the node-identity
@@ -108,8 +108,8 @@ test.describe("dashboard hydration with the SSR prefetch on", () => {
// mocked suite runs with the prefetch OFF and can never see it).
for (const target of [
{
- path: "/checkups",
- name: "checkups",
+ path: "/care",
+ name: "care",
readySelector: '[data-testid="checkups-tab-vorsorge"]',
},
{
diff --git a/e2e/tablet-shell.spec.ts b/e2e/tablet-shell.spec.ts
index 6f67b9cbbc..78a25f685a 100644
--- a/e2e/tablet-shell.spec.ts
+++ b/e2e/tablet-shell.spec.ts
@@ -446,7 +446,7 @@ test("a vertical swipe that starts on a tab strip is the page's", async ({
page,
}) => {
await page.setViewportSize({ width: 1180, height: 820 });
- await page.goto("/checkups", { waitUntil: "domcontentloaded" });
+ await page.goto("/care", { waitUntil: "domcontentloaded" });
const strip = page.locator('#main-content [data-slot="tabs-list"]').first();
await expect(strip).toBeVisible();
// `pan-x` here refused the vertical pan, so the page did not move.
diff --git a/e2e/vaccinations.spec.ts b/e2e/vaccinations.spec.ts
index 40b43f27cd..8048369eed 100644
--- a/e2e/vaccinations.spec.ts
+++ b/e2e/vaccinations.spec.ts
@@ -11,7 +11,7 @@
* 2. Combination — one Tdap renders a row in each of its three component
* groups, the render-only duplication the series design exists for.
* 3. Mint + satisfy — confirming the booster prompt writes an ordinary
- * Vorsorge reminder that shows on `/checkups`; logging the next dose moves
+ * Vorsorge reminder that shows on `/care`; logging the next dose moves
* its due date forward through the real satisfy matcher.
* 4. Module off — turning the module off in settings drops the nav entry and
* the direct visit lands on the module-off notice, not a crash.
@@ -226,10 +226,10 @@ test.describe("vaccinations", () => {
expect(minted!.nextDueAt).toBeTruthy();
const dueBefore = new Date(minted!.nextDueAt!).getTime();
- // It presents on /checkups like every other Vorsorge reminder — the file-a
+ // It presents on /care like every other Vorsorge reminder — the file-a
// -visit affordance only paints on a rendered reminder card, so it standing
// in for "a reminder card is here" is a stable per-card slot.
- await page.goto("/checkups");
+ await page.goto("/care");
await expect(
page.locator('[data-slot="vorsorge-file-visit"]').first(),
).toBeVisible({ timeout: 15_000 });
diff --git a/e2e/visits.spec.ts b/e2e/visits.spec.ts
index de58676dd5..543ce87c85 100644
--- a/e2e/visits.spec.ts
+++ b/e2e/visits.spec.ts
@@ -45,13 +45,13 @@ test.describe.configure({ mode: "serial" });
test.describe("visits", () => {
// The seeded account owns the visits and the document this flow drives, and
// both the `page` and the `request` fixture read them under its session.
- // Without this the whole file runs anonymous: `/checkups` redirects to login
+ // Without this the whole file runs anonymous: `/care` redirects to login
// and every `/api/*` read answers 401, which is a test-setup gap, not a
// product one.
test.use({ storageState: STORAGE_STATE_PATH });
test("a visit saves with a date and nothing else", async ({ page }) => {
- await page.goto("/checkups");
+ await page.goto("/care");
await page.getByTestId("checkups-tab-visits").click();
const add = page.locator('[data-slot="visits-add"]').first();
diff --git a/messages/en.json b/messages/en.json
index c2d230594f..02639b040b 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -628,7 +628,7 @@
"cycle": "Cycle",
"labs": "Labs",
"profile": "Profile",
- "vorsorge": "Checkups",
+ "vorsorge": "Care",
"illness": "Illness",
"documents": "Documents",
"vaccinations": "Vaccinations",
@@ -5371,8 +5371,8 @@
"body": "The illness journal records acute episodes and chronic diagnoses with their flares. Hidden: correlate an episode with your readings, and Rest Mode that pauses reminders. That’s how the Coach understands why values drift for a while."
},
"vorsorge": {
- "title": "Checkups",
- "body": "Checkups remind you of screenings and vaccinations on their own interval. Tip: “Done” can create a reading or a lab result directly. Due items appear as reminders and in the doctor report."
+ "title": "Care",
+ "body": "Care reminds you of screenings and vaccinations on their own interval. Tip: “Done” can create a reading or a lab result directly. Due items appear as reminders and in the doctor report."
},
"cycle": {
"title": "Cycle",
@@ -6003,7 +6003,7 @@
"description": "List view and episode order."
},
"checkups": {
- "title": "Checkups",
+ "title": "Care",
"description": "List view and reminder order."
},
"documents": {
@@ -11094,7 +11094,7 @@
"selectionBarLabel": "Selection actions"
},
"measurementReminders": {
- "sectionTitle": "Checkups",
+ "sectionTitle": "Care",
"sectionDescription": "Reminders for what to measure or check, when, and where.",
"markDone": "Done",
"delete": "Delete",
@@ -11198,7 +11198,7 @@
"startCheckIn": "Start check-in",
"nextDueLabel": "Next due:",
"lastDoneLabel": "Last done:",
- "customize": "Customize checkups",
+ "customize": "Customize Care",
"adherence": {
"label": "Within interval",
"onTrack": "On track",
@@ -11213,7 +11213,7 @@
},
"dashboard": {
"empty": "No upcoming checkup reminders.",
- "openLink": "Open checkups"
+ "openLink": "Open Care"
},
"showMeasurements": "Show measurements",
"loadError": "Could not load your reminders.",
@@ -13761,7 +13761,7 @@
"action": {
"logDose": "Take",
"reconnect": "Reconnect",
- "viewCheckups": "View check-ups",
+ "viewCheckups": "Open Care",
"viewAppointment": "View appointment",
"viewAppointments": "View appointments",
"checkinKeep": "Keep it",
@@ -14557,7 +14557,7 @@
},
"checkups": {
"viewSwitchLabel": "Show checkups, visits, procedures or body sites",
- "tabVorsorge": "Checkups",
+ "tabVorsorge": "Care",
"tabVisits": "Visits",
"tabProcedures": "Procedures",
"tabBodySites": "Body sites"
diff --git a/messages/pt-BR.json b/messages/pt-BR.json
index 5a289542d2..720dc4a3c9 100644
--- a/messages/pt-BR.json
+++ b/messages/pt-BR.json
@@ -628,7 +628,7 @@
"cycle": "Ciclo",
"labs": "Exames",
"profile": "Perfil",
- "vorsorge": "Check-ups",
+ "vorsorge": "Prevenção",
"illness": "Doenças",
"documents": "Documentos",
"vaccinations": "Vacinas",
@@ -5371,7 +5371,7 @@
"body": "O diário de doenças registra episódios agudos e diagnósticos crônicos com seus surtos. Oculto: correlacione um episódio com suas leituras e o Modo de Repouso que pausa lembretes. É assim que o Coach entende por que os valores oscilam por um tempo."
},
"vorsorge": {
- "title": "Checks",
+ "title": "Prevenção",
"body": "Checks lembram você de triagens e vacinas no seu próprio intervalo. Dica: “Concluído” pode criar uma leitura ou resultado laboratorial diretamente. Itens previstos aparecem como lembretes e no relatório médico."
},
"cycle": {
@@ -6003,7 +6003,7 @@
"description": "Visualização em lista e ordem dos episódios."
},
"checkups": {
- "title": "Check-ups",
+ "title": "Prevenção",
"description": "Visualização em lista e ordem dos lembretes."
},
"documents": {
@@ -11094,7 +11094,7 @@
"selectionBarLabel": "Ações de seleção"
},
"measurementReminders": {
- "sectionTitle": "Check-ups",
+ "sectionTitle": "Prevenção",
"sectionDescription": "Lembretes para o que medir ou verificar, quando e onde.",
"markDone": "Concluído",
"delete": "Excluir",
@@ -11198,7 +11198,7 @@
"startCheckIn": "Iniciar check-in",
"nextDueLabel": "Próximo vencimento:",
"lastDoneLabel": "Última conclusão:",
- "customize": "Personalizar check-ups",
+ "customize": "Personalizar prevenção",
"adherence": {
"label": "Dentro do intervalo",
"onTrack": "No caminho",
@@ -11213,7 +11213,7 @@
},
"dashboard": {
"empty": "Nenhum lembrete de check-up futuro.",
- "openLink": "Abrir check-ups"
+ "openLink": "Abrir prevenção"
},
"showMeasurements": "Mostrar medições",
"loadError": "Não foi possível carregar seus lembretes.",
@@ -13761,7 +13761,7 @@
"action": {
"logDose": "Tomar",
"reconnect": "Reconectar",
- "viewCheckups": "Ver checks",
+ "viewCheckups": "Ver prevenção",
"viewAppointment": "Ver consulta",
"viewAppointments": "Ver consultas",
"checkinKeep": "Manter",
@@ -14557,7 +14557,7 @@
},
"checkups": {
"viewSwitchLabel": "Mostrar check-ups, consultas, procedimentos ou locais do corpo",
- "tabVorsorge": "Check-ups",
+ "tabVorsorge": "Prevenção",
"tabVisits": "Consultas",
"tabProcedures": "Procedimentos",
"tabBodySites": "Locais do corpo"
diff --git a/messages/ru.json b/messages/ru.json
index 9313884b5f..3aaf67e8f4 100644
--- a/messages/ru.json
+++ b/messages/ru.json
@@ -628,7 +628,7 @@
"cycle": "Цикл",
"labs": "Анализы",
"profile": "Профиль",
- "vorsorge": "Чекапы",
+ "vorsorge": "Профилактика",
"illness": "Заболевания",
"documents": "Документы",
"vaccinations": "Вакцинации",
diff --git a/next.config.ts b/next.config.ts
index 615023b928..48286529a7 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -254,18 +254,30 @@ const nextConfig: NextConfig = {
permanent: true,
},
// v1.22.0 — the preventive-care surface moved from the German slug
- // `/vorsorge` to the English `/checkups` (the feature reads "Checkups"
- // in every non-German locale now). 301-redirect so bookmarks, the PWA's
- // cached navigation, and any push deep-link keep resolving. The
- // persisted internal id stays `vorsorge`; only the URL changes.
+ // `/vorsorge` to the English `/checkups`; it was then renamed Care and
+ // moved to `/care`. Every older address goes straight to the new one
+ // in one hop, query string kept (Next.js carries it over), so bookmarks,
+ // the PWA's cached navigation and every push notification already sitting
+ // on a phone keep resolving. `permanent` answers 308. The persisted
+ // internal id stays `vorsorge`; only the URL changes.
{
source: "/vorsorge",
- destination: "/checkups",
+ destination: "/care",
permanent: true,
},
{
source: "/vorsorge/:path*",
- destination: "/checkups/:path*",
+ destination: "/care/:path*",
+ permanent: true,
+ },
+ {
+ source: "/checkups",
+ destination: "/care",
+ permanent: true,
+ },
+ {
+ source: "/checkups/:path*",
+ destination: "/care/:path*",
permanent: true,
},
];
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 8509efee47..240101853a 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -6788,7 +6788,7 @@ model MeasurementReminder {
/// behaviour, so the published contract does not move — the `origin` enum
/// stays two-armed, the cron still fires by `nextDueAt` regardless of why a
/// row exists, and no Vorsorge surface excludes these rows. A booster
- /// belongs on `/checkups`. That is also why a fourth nullable column here
+ /// belongs on `/care`. That is also why a fourth nullable column here
/// is not the signal the appointment arm's warning described: an
/// appointment had to be bent into this engine (one-shot, no cadence,
/// excluded everywhere), whereas a booster is the engine's native case —
@@ -10658,7 +10658,7 @@ model NutrientIntakeDay {
/// than an oversight. The 18 `ModuleKey` entries have three shapes: an
/// opt-out data vertical, an egress surface, and one output format. A
/// visit is none of them — it is not a tracked signal, it egresses
-/// nothing, and it is not an output. `/checkups` sets the precedent and
+/// nothing, and it is not an output. `/care` sets the precedent and
/// states the reasoning (`src/components/layout/nav-model.ts`): gating
/// the entry would orphan reminders the user can still create. One gate
/// over an encounter would also contradict its own members, since an
diff --git a/src/__tests__/baselines/version-stamp-comments.json b/src/__tests__/baselines/version-stamp-comments.json
index 61bb042db8..03a614f411 100644
--- a/src/__tests__/baselines/version-stamp-comments.json
+++ b/src/__tests__/baselines/version-stamp-comments.json
@@ -552,7 +552,7 @@
"app/auth/register/page.tsx": 3,
"app/c/[token]/d/[id]/__tests__/route.test.ts": 1,
"app/c/[token]/d/[id]/route.ts": 1,
- "app/checkups/page-client.tsx": 4,
+ "app/care/page-client.tsx": 4,
"app/claim/[token]/page.tsx": 1,
"app/coach/__tests__/page-launch-params.test.tsx": 1,
"app/coach/__tests__/page-prefetch.test.tsx": 1,
diff --git a/src/__tests__/care-route-redirects.test.ts b/src/__tests__/care-route-redirects.test.ts
new file mode 100644
index 0000000000..387ae394d1
--- /dev/null
+++ b/src/__tests__/care-route-redirects.test.ts
@@ -0,0 +1,106 @@
+/**
+ * The preventive-care page lives at `/care`; every address it had before keeps
+ * working.
+ *
+ * It started as `/vorsorge`, became `/checkups` and then `/care`. Push
+ * notifications already delivered to a phone, the PWA's cached
+ * navigation and bookmarks still carry the older paths, usually with a query
+ * (`?visit=`, `?view=visits`). This runs each one through the redirects
+ * in `next.config.ts` with Next.js's own matcher and destination builder, so
+ * the assertion is the URL the browser is actually sent to: a permanent (308)
+ * redirect to the same place under `/care`, query string intact, in one hop.
+ */
+import { existsSync } from "node:fs";
+import { join } from "node:path";
+
+import { describe, expect, it } from "vitest";
+import { getRedirectStatus } from "next/dist/lib/redirect-status";
+import { getPathMatch } from "next/dist/shared/lib/router/utils/path-match";
+import { prepareDestination } from "next/dist/shared/lib/router/utils/prepare-destination";
+
+import nextConfig from "../../next.config";
+
+interface Redirect {
+ source: string;
+ destination: string;
+ permanent?: boolean;
+ statusCode?: number;
+}
+
+async function redirects(): Promise {
+ return ((await nextConfig.redirects?.()) ?? []) as Redirect[];
+}
+
+/** Where one request is sent, the way the Next.js router resolves it. */
+function follow(
+ all: readonly Redirect[],
+ url: string,
+): { status: number; location: string } | null {
+ const parsed = new URL(url, "https://health.example");
+ const query = Object.fromEntries(parsed.searchParams);
+ for (const route of all) {
+ const params = getPathMatch(route.source, {
+ removeUnnamedParams: true,
+ strict: true,
+ })(parsed.pathname);
+ if (!params) continue;
+ const { parsedDestination } = prepareDestination({
+ appendParamsToQuery: false,
+ destination: route.destination,
+ params,
+ query,
+ });
+ const search = new URLSearchParams(
+ parsedDestination.query as Record,
+ ).toString();
+ return {
+ status: getRedirectStatus(route),
+ location: `${parsedDestination.pathname}${search ? `?${search}` : ""}`,
+ };
+ }
+ return null;
+}
+
+const APP = join(process.cwd(), "src/app");
+
+describe("old preventive-care addresses", () => {
+ it.each([
+ ["/checkups", "/care"],
+ ["/checkups?visit=v1", "/care?visit=v1"],
+ ["/checkups?view=visits", "/care?view=visits"],
+ ["/checkups?site=Knee&side=LEFT", "/care?site=Knee&side=LEFT"],
+ ["/checkups/practitioners", "/care/practitioners"],
+ ["/vorsorge", "/care"],
+ ["/vorsorge?visit=v1", "/care?visit=v1"],
+ ["/vorsorge/practitioners", "/care/practitioners"],
+ ])("%s answers 308 to %s", async (from, to) => {
+ const all = await redirects();
+ expect(follow(all, from)).toEqual({ status: 308, location: to });
+ });
+
+ it("sends the new address nowhere", async () => {
+ const all = await redirects();
+ expect(follow(all, "/care")).toBeNull();
+ expect(follow(all, "/care?visit=v1")).toBeNull();
+ expect(follow(all, "/care/practitioners")).toBeNull();
+ });
+
+ it("leaves the API alone", async () => {
+ const all = await redirects();
+ expect(follow(all, "/api/measurement-reminders")).toBeNull();
+ expect(follow(all, "/checkupsx")).toBeNull();
+ });
+
+ it("lands on pages that exist, and the old directory is gone", () => {
+ expect(existsSync(join(APP, "care/page.tsx"))).toBe(true);
+ expect(existsSync(join(APP, "care/practitioners/page.tsx"))).toBe(true);
+ expect(existsSync(join(APP, "checkups"))).toBe(false);
+ expect(existsSync(join(APP, "vorsorge"))).toBe(false);
+ });
+
+ it("the matcher is live: a made-up address finds no redirect", async () => {
+ const all = await redirects();
+ expect(all.length).toBeGreaterThan(10);
+ expect(follow(all, "/no-such-page")).toBeNull();
+ });
+});
diff --git a/src/__tests__/care-wire-paths.test.ts b/src/__tests__/care-wire-paths.test.ts
new file mode 100644
index 0000000000..0fd34dd4d4
--- /dev/null
+++ b/src/__tests__/care-wire-paths.test.ts
@@ -0,0 +1,93 @@
+/**
+ * What leaves the server still says `/checkups`.
+ *
+ * The page moved to `/care` in the web app, but the released iPhone app
+ * parses only `/checkups`, `/checkups?visit=` and `/checkups?view=visits`
+ * in a push target and in an API `href` / `path` (the Today hero action, the
+ * next-visit line). `/checkups` stays on the wire for iOS builds before 1.7 and
+ * switches to `/care` in 1.50; the browser follows the permanent redirect.
+ *
+ * This pins the wire spellings, and walks the server code (`src/lib`,
+ * `src/app/api`) for a `/care` path literal, so a later edit cannot move a
+ * payload to `/care` ahead of the app. The few web-only modules under `src/lib`
+ * that name the page are listed with the reason.
+ */
+import { join } from "node:path";
+
+import { describe, expect, it } from "vitest";
+
+import {
+ CARE_VISITS_PATH,
+ VISITS_PATH,
+ careVisitPath,
+ visitPath,
+ visitsPath,
+} from "@/lib/encounters/visit-links";
+import { NOTIFICATION_TAP_PATHS } from "@/lib/notifications/tap-target";
+
+import {
+ readSource,
+ readSourceText,
+ walkSourceFiles,
+} from "./helpers/source-files";
+
+const SRC = join(__dirname, "..");
+
+describe("wire paths for the care page", () => {
+ it("push targets and API links keep /checkups", () => {
+ expect(NOTIFICATION_TAP_PATHS.MEASUREMENT_REMINDER).toBe("/checkups");
+ expect(visitPath("v1")).toBe("/checkups?visit=v1");
+ expect(VISITS_PATH).toBe("/checkups?view=visits");
+ expect(visitsPath(["v1"])).toBe("/checkups?visit=v1");
+ expect(visitsPath(["v1", "v2"])).toBe("/checkups?view=visits");
+ });
+
+ it("links the web renders itself use /care", () => {
+ expect(careVisitPath("v1")).toBe("/care?visit=v1");
+ expect(CARE_VISITS_PATH).toBe("/care?view=visits");
+ });
+
+ it("the digest and the day view carry the bare page as /checkups", () => {
+ // The anchor is the assertion: readSource throws when it is missing.
+ for (const file of ["src/lib/daily/digest.ts", "src/lib/day/records.ts"]) {
+ expect(readSource(file, 'href: "/checkups",')).toContain("/checkups");
+ }
+ });
+});
+
+/** Server modules that may name `/care`: none of them builds a payload. */
+const WEB_ONLY: Record = {
+ "lib/encounters/visit-links.ts": "the web spelling beside the wire one",
+ "lib/navigation/shared-record.ts": "browser route families, not links",
+ "lib/onboarding/tour-state.ts": "the tour step's route in the browser",
+};
+
+describe("server code does not send /care", () => {
+ const files = walkSourceFiles(SRC, { floor: 2500 })
+ .filter(
+ (p) =>
+ (p.startsWith("lib/") || p.startsWith("app/api/")) &&
+ !p.includes("__tests__/") &&
+ /\.tsx?$/.test(p),
+ )
+ .map((path) => ({ path, source: readSourceText(join(SRC, path)) }));
+
+ it("walks the server tree", () => {
+ expect(files.length).toBeGreaterThan(1000);
+ });
+
+ it("finds a /care path literal only in the web-only modules", () => {
+ const literal = /["'`]\/care(?:[?/"'`])/;
+ const hits = files
+ .filter(({ source }) =>
+ source
+ .split("\n")
+ .some(
+ (line) => literal.test(line) && !/^\s*(\/\/|\*|\/\*)/.test(line),
+ ),
+ )
+ .map(({ path }) => path)
+ .sort();
+ expect(hits).toEqual(Object.keys(WEB_ONLY).sort());
+ });
+});
diff --git a/src/__tests__/encounter-reminder-exclusion.test.ts b/src/__tests__/encounter-reminder-exclusion.test.ts
index 5c09d32db2..1578179a3e 100644
--- a/src/__tests__/encounter-reminder-exclusion.test.ts
+++ b/src/__tests__/encounter-reminder-exclusion.test.ts
@@ -53,7 +53,7 @@ function read(relativePath: string): string {
const VORSORGE_READ_SITES: ReadonlyArray<{ file: string; surface: string }> = [
{
// The list query moved out of the route into the shared read so the
- // `/checkups` SSR prefetch and `GET /api/measurement-reminders` cannot
+ // `/care` SSR prefetch and `GET /api/measurement-reminders` cannot
// drift; the exclusion travels with the query.
file: "src/lib/measurement-reminders/list-read.ts",
surface: "the reminder list the checkups page and its SSR prefetch render",
diff --git a/src/__tests__/prefetch-page-caching-guard.test.ts b/src/__tests__/prefetch-page-caching-guard.test.ts
index 609b32256a..b7f305c287 100644
--- a/src/__tests__/prefetch-page-caching-guard.test.ts
+++ b/src/__tests__/prefetch-page-caching-guard.test.ts
@@ -172,7 +172,7 @@ const prefetchingPages = walk(APP_DIR)
*/
const PREFETCHING_ROUTES = [
"/",
- "/checkups",
+ "/care",
"/coach",
"/insights",
"/insights/mood",
diff --git a/src/__tests__/session-surface-guard.test.ts b/src/__tests__/session-surface-guard.test.ts
index 549edbc50e..45c57a52a0 100644
--- a/src/__tests__/session-surface-guard.test.ts
+++ b/src/__tests__/session-surface-guard.test.ts
@@ -148,7 +148,7 @@ describe("S1 — the direct session-resolution set is frozen", () => {
// can only ever hold the caller's own. See
// `prefetch-page-caching-guard.test.ts` for the rule that keeps a sixth
// prefetching page from reaching for the bare helper.
- "app/checkups/page.tsx":
+ "app/care/page.tsx":
"RSC prefetch of the session user's reminder list, skipped under a switch",
"app/coach/page.tsx":
"RSC prefetch of the session user's coach state, skipped under a switch",
diff --git a/src/__tests__/shared-record-navigation.test.tsx b/src/__tests__/shared-record-navigation.test.tsx
index 93ac58b024..9e72b04b22 100644
--- a/src/__tests__/shared-record-navigation.test.tsx
+++ b/src/__tests__/shared-record-navigation.test.tsx
@@ -46,12 +46,12 @@ describe("shared-record navigation", () => {
expect(SHARED_RECORD_DOMAIN_ROUTE_FAMILIES.profile).toEqual([
"/profile",
- "/checkups",
+ "/care",
"/vaccinations",
]);
expect(navigation.destinationHrefs).toEqual([
"/profile",
- "/checkups",
+ "/care",
"/vaccinations",
]);
expect(navigation.allowsPath("/profile")).toBe(true);
@@ -66,17 +66,15 @@ describe("shared-record navigation", () => {
// not. Before the visits section the `measurements` omission was invisible,
// because a whole-record grant admits every path regardless.
expect(
- resolveSharedRecordNavigation(["measurements"]).allowsPath("/checkups"),
+ resolveSharedRecordNavigation(["measurements"]).allowsPath("/care"),
).toBe(true);
- expect(
- resolveSharedRecordNavigation(["profile"]).allowsPath("/checkups"),
- ).toBe(true);
- expect(resolveSharedRecordNavigation(null).allowsPath("/checkups")).toBe(
+ expect(resolveSharedRecordNavigation(["profile"]).allowsPath("/care")).toBe(
true,
);
- expect(
- resolveSharedRecordNavigation(["labs"]).allowsPath("/checkups"),
- ).toBe(false);
+ expect(resolveSharedRecordNavigation(null).allowsPath("/care")).toBe(true);
+ expect(resolveSharedRecordNavigation(["labs"]).allowsPath("/care")).toBe(
+ false,
+ );
// Listed twice, offered once: a grant holding both domains must not put
// two identical entries in the navigation.
@@ -84,8 +82,8 @@ describe("shared-record navigation", () => {
resolveSharedRecordNavigation([
"measurements",
"profile",
- ]).destinationHrefs.filter((href) => href === "/checkups"),
- ).toEqual(["/checkups"]);
+ ]).destinationHrefs.filter((href) => href === "/care"),
+ ).toEqual(["/care"]);
});
/**
diff --git a/src/__tests__/surface-registry-guard.test.ts b/src/__tests__/surface-registry-guard.test.ts
index 35a00ae238..bd0ba8828a 100644
--- a/src/__tests__/surface-registry-guard.test.ts
+++ b/src/__tests__/surface-registry-guard.test.ts
@@ -147,7 +147,7 @@ const NOT_DESTINATIONS = [
* always a child of its list and needs no line here.
*/
const CHILD_PAGES: Readonly> = {
- "/checkups/practitioners": "/checkups",
+ "/care/practitioners": "/care",
"/coach/conversations": "/coach",
"/coach/plans": "/coach",
"/documents/deleted": "/documents",
diff --git a/src/__tests__/visit-link-guard.test.ts b/src/__tests__/visit-link-guard.test.ts
index 788b927135..7fc02858e1 100644
--- a/src/__tests__/visit-link-guard.test.ts
+++ b/src/__tests__/visit-link-guard.test.ts
@@ -1,8 +1,9 @@
/**
* A link to a visit is built by `src/lib/encounters/visit-links.ts`, and a
- * bare `/checkups` is a link to the checkups, never to a visit.
+ * bare `/care` (or `/checkups`, its spelling on the wire until 1.50) is a link
+ * to the checkups, never to a visit.
*
- * Visits are the second tab of `/checkups`. The bare path opens the first
+ * Visits are the second tab of `/care`. The bare path opens the first
* one, the preventive-care list, which never lists an appointment. Four
* surfaces showed an upcoming appointment and linked it to the bare path —
* the dashboard's next-appointment line, the Today rail item, the Today
@@ -11,9 +12,9 @@
*
* Two rules, both over code lines (comments are skipped):
*
- * 1. The visit and tab query forms (`/checkups?visit=`, `/checkups?view=`)
- * appear only in the builder.
- * 2. The bare `/checkups` literal appears only where the target IS the
+ * 1. The visit and tab query forms (`/care?visit=`, `/care?view=`, and the
+ * same under `/checkups`) appear only in the builder.
+ * 2. The bare `/care` or `/checkups` literal appears only where the target IS the
* checkups list, counted per file. A new occurrence fails the run until
* someone decides whether it names a checkup (add it here, with the
* reason) or a visit (use the builder).
@@ -32,7 +33,7 @@ const SRC = join(__dirname, "..");
const BUILDER = "lib/encounters/visit-links.ts";
/**
- * Where a bare `/checkups` is right, and how often: each names the
+ * Where a bare `/care` is right, and how often: each names the
* preventive-care list itself, or lists routes rather than linking one.
*/
const BARE_CHECKUPS: Record = {
@@ -61,12 +62,18 @@ const BARE_CHECKUPS: Record = {
count: 2,
why: "route lists for domain visibility, not links",
},
- "lib/daily/digest.ts": { count: 1, why: "the due check-ups rail item" },
- "lib/day/records.ts": { count: 1, why: "a check-up satisfied that day" },
+ "lib/daily/digest.ts": {
+ count: 1,
+ why: "the due check-ups rail item (wire spelling)",
+ },
+ "lib/day/records.ts": {
+ count: 1,
+ why: "a check-up satisfied that day (wire spelling)",
+ },
"lib/onboarding/tour-state.ts": { count: 1, why: "the checkups tour step" },
"lib/notifications/tap-target.ts": {
count: 1,
- why: "a checkup push; an appointment's names its visit as override",
+ why: "a checkup push (wire spelling); an appointment's names its visit as override",
},
};
@@ -112,9 +119,9 @@ function codeLines(source: string): string[] {
return out;
}
-const QUERY_FORM = /\/checkups\?(visit|view)=/;
+const QUERY_FORM = /\/(?:care|checkups)\?(visit|view)=/;
// The bare page, or the page with a query the builder does not own.
-const BARE = /["'`]\/checkups(?:["'`]|\?(?!visit=|view=))/g;
+const BARE = /["'`]\/(?:care|checkups)(?:["'`]|\?(?!visit=|view=))/g;
function scan(files: { path: string; source: string }[]) {
const queryForms: string[] = [];
@@ -154,7 +161,7 @@ describe("links to a visit go through the visit-links builder", () => {
);
expect(
bare,
- "A new bare `/checkups`: if it leads to a visit, use the visit-links builder; if it really is the checkups list, add it to BARE_CHECKUPS with the reason.",
+ "A new bare `/care`: if it leads to a visit, use the visit-links builder; if it really is the checkups list, add it to BARE_CHECKUPS with the reason.",
).toEqual(expected);
});
@@ -164,16 +171,16 @@ describe("links to a visit go through the visit-links builder", () => {
path: "a.tsx",
source: [
"/**",
- " * `/checkups?visit=` in a docblock",
+ " * `/care?visit=` in a docblock",
" */",
- '// "/checkups" in a line comment',
- '{/* a JSX comment naming "/checkups"',
- ' over two lines "/checkups" */}',
- 'const url = "https://example.test/x"; const bad = "/checkups";',
+ '// "/care" in a line comment',
+ '{/* a JSX comment naming "/care"',
+ ' over two lines "/care" */}',
+ 'const url = "https://example.test/x"; const bad = "/care";',
].join("\n"),
},
- { path: "b.ts", source: "const p = `/checkups?visit=${id}`;" },
- { path: "c.ts", source: "const q = `/checkups?${params}`;" },
+ { path: "b.ts", source: "const p = `/care?visit=${id}`;" },
+ { path: "c.ts", source: "const q = `/care?${params}`;" },
]);
expect(queryForms).toEqual(["b.ts"]);
expect(bare).toEqual({ "a.tsx": 1, "c.ts": 1 });
diff --git a/src/app/api/measurement-reminders/route.ts b/src/app/api/measurement-reminders/route.ts
index e1bad22ac3..eaa0939b32 100644
--- a/src/app/api/measurement-reminders/route.ts
+++ b/src/app/api/measurement-reminders/route.ts
@@ -35,7 +35,7 @@ export const GET = apiHandler(async () => {
const { user } = await requireRecordAuth("read", "measurements");
// The query (with its ENCOUNTER-origin exclusion) lives in the shared
- // list read so this route and the `/checkups` SSR prefetch cannot drift.
+ // list read so this route and the `/care` SSR prefetch cannot drift.
const reminders = await listMeasurementReminders(user.id);
annotate({
diff --git a/src/app/api/vaccinations/[id]/booster/route.ts b/src/app/api/vaccinations/[id]/booster/route.ts
index 9bed56f445..27f9367d5c 100644
--- a/src/app/api/vaccinations/[id]/booster/route.ts
+++ b/src/app/api/vaccinations/[id]/booster/route.ts
@@ -5,7 +5,7 @@
* Rung 2: the reminder only exists because the person confirmed it, prefilled
* from the catalogue's interval and fully editable before this call. The minted
* row is an ordinary `origin: VORSORGE` reminder that carries the dose's
- * primary antigen as a match key; it lists on `/checkups` and rings through the
+ * primary antigen as a match key; it lists on `/care` and rings through the
* same engine as every other checkup, with no new code.
*
* WRITE, classified `profile`: filing the owner's Impfpass and arming the
diff --git a/src/app/checkups/__tests__/page-client-view.test.tsx b/src/app/care/__tests__/page-client-view.test.tsx
similarity index 91%
rename from src/app/checkups/__tests__/page-client-view.test.tsx
rename to src/app/care/__tests__/page-client-view.test.tsx
index 7e65a4a93e..b73e1eccb0 100644
--- a/src/app/checkups/__tests__/page-client-view.test.tsx
+++ b/src/app/care/__tests__/page-client-view.test.tsx
@@ -1,5 +1,5 @@
/**
- * Which tab a link to `/checkups` opens.
+ * Which tab a link to `/care` opens.
*
* Visits are the page's second tab. `?visit=` opens one, `?view=visits`
* the list, and the bare path keeps opening the checkups, which is what the
@@ -12,7 +12,7 @@ let search = new URLSearchParams();
vi.mock("next/navigation", () => ({
useRouter: () => ({ push: vi.fn(), replace: vi.fn() }),
- usePathname: () => "/checkups",
+ usePathname: () => "/care",
useSearchParams: () => search,
}));
vi.mock("@tanstack/react-query", async (importOriginal) => ({
@@ -43,19 +43,19 @@ vi.mock("@/components/body-sites/body-sites-section", () => ({
}));
import { I18nProvider } from "@/lib/i18n/context";
-import CheckupsPageClient from "../page-client";
+import CarePageClient from "../page-client";
function openTab(query: string): string | null {
search = new URLSearchParams(query);
const html = renderToStaticMarkup(
-
+ ,
);
return html.match(/data-section="([^"]+)"/)?.[1] ?? null;
}
-describe("/checkups — the tab a link opens", () => {
+describe("/care — the tab a link opens", () => {
it("opens the checkups on the bare path", () => {
expect(openTab("")).toBe("vorsorge");
});
diff --git a/src/app/checkups/__tests__/page-prefetch.test.tsx b/src/app/care/__tests__/page-prefetch.test.tsx
similarity index 87%
rename from src/app/checkups/__tests__/page-prefetch.test.tsx
rename to src/app/care/__tests__/page-prefetch.test.tsx
index 3ca39318b4..6c9a969fed 100644
--- a/src/app/checkups/__tests__/page-prefetch.test.tsx
+++ b/src/app/care/__tests__/page-prefetch.test.tsx
@@ -5,9 +5,9 @@ import type { ReactElement } from "react";
import { queryKeys } from "@/lib/query-keys";
/**
- * The `/checkups` server-prefetch key crux + fail-soft.
+ * The `/care` server-prefetch key crux + fail-soft.
*
- * The RSC wrapper (`src/app/checkups/page.tsx`) dehydrates the Vorsorge
+ * The RSC wrapper (`src/app/care/page.tsx`) dehydrates the Vorsorge
* reminder list under the SAME zero-arg factory key the client hook
* (`useMeasurementReminders`) mounts on, via the shared
* `listMeasurementReminders` read — so the checkups list paints from the
@@ -27,7 +27,7 @@ vi.mock("@/lib/measurement-reminders/list-read", () => ({
}));
vi.mock("../page-client", () => ({ default: () => null }));
-import CheckupsPage from "../page";
+import CarePage from "../page";
const SESSION = { user: { id: "u1", timezone: "Europe/Berlin" } };
@@ -46,14 +46,14 @@ function queriesOf(
return props.state?.queries ?? [];
}
-describe("/checkups RSC prefetch", () => {
+describe("/care RSC prefetch", () => {
it("dehydrates the reminder list under the client's factory key", async () => {
getUnswitchedSession.mockResolvedValue(SESSION);
listMeasurementReminders.mockResolvedValue([
{ id: "r1", label: "Blood pressure", nextDueAt: null },
]);
- const el = (await CheckupsPage()) as ReactElement;
+ const el = (await CarePage()) as ReactElement;
const hashes = queriesOf(el).map((q) => q.queryHash);
expect(hashes).toContain(hashKey(queryKeys.measurementReminders()));
expect(listMeasurementReminders).toHaveBeenCalledWith("u1");
@@ -64,7 +64,7 @@ describe("/checkups RSC prefetch", () => {
const createdAt = new Date("2026-07-18T06:00:00.000Z");
listMeasurementReminders.mockResolvedValue([{ id: "r1", createdAt }]);
- const el = (await CheckupsPage()) as ReactElement;
+ const el = (await CarePage()) as ReactElement;
const seeded = queriesOf(el).find(
(q) => q.queryHash === hashKey(queryKeys.measurementReminders()),
);
@@ -77,7 +77,7 @@ describe("/checkups RSC prefetch", () => {
getUnswitchedSession.mockResolvedValue(SESSION);
listMeasurementReminders.mockRejectedValue(new Error("db blip"));
- const el = (await CheckupsPage()) as ReactElement;
+ const el = (await CarePage()) as ReactElement;
expect(el.type).not.toBe(HydrationBoundary);
});
@@ -85,14 +85,14 @@ describe("/checkups RSC prefetch", () => {
// collapses both into the same answer, and the page treats them the same.
it("fails soft when there is no session", async () => {
getUnswitchedSession.mockResolvedValue(null);
- const el = (await CheckupsPage()) as ReactElement;
+ const el = (await CarePage()) as ReactElement;
expect(el.type).not.toBe(HydrationBoundary);
expect(listMeasurementReminders).not.toHaveBeenCalled();
});
it("honours the DASHBOARD_SSR_PREFETCH kill-switch", async () => {
process.env.DASHBOARD_SSR_PREFETCH = "false";
- const el = (await CheckupsPage()) as ReactElement;
+ const el = (await CarePage()) as ReactElement;
expect(el.type).not.toBe(HydrationBoundary);
expect(getUnswitchedSession).not.toHaveBeenCalled();
});
diff --git a/src/app/checkups/page-client.tsx b/src/app/care/page-client.tsx
similarity index 98%
rename from src/app/checkups/page-client.tsx
rename to src/app/care/page-client.tsx
index 3104cc66aa..0ddd3a5b38 100644
--- a/src/app/checkups/page-client.tsx
+++ b/src/app/care/page-client.tsx
@@ -21,7 +21,7 @@ import { useTranslations } from "@/lib/i18n/context";
import { invalidateKeys, queryKeys } from "@/lib/query-keys";
/**
- * v1.17.1 — Checkups (preventive-care) reminders page. The dedicated
+ * v1.17.1 — Care (preventive-care) reminders page. The dedicated
* feature surface for "wann muss ich was wo machen". Auth-gated; the
* section component owns the list + create flow.
*
@@ -52,7 +52,7 @@ import { invalidateKeys, queryKeys } from "@/lib/query-keys";
* is how a page ends up showing a visit that closed a checkup still listed as
* due.
*/
-export default function CheckupsPageClient() {
+export default function CarePageClient() {
const { isAuthenticated, isLoading } = useAuth();
const mounted = useMounted();
const queryClient = useQueryClient();
diff --git a/src/app/checkups/page.tsx b/src/app/care/page.tsx
similarity index 92%
rename from src/app/checkups/page.tsx
rename to src/app/care/page.tsx
index 512af7b526..0a5ebc38b8 100644
--- a/src/app/checkups/page.tsx
+++ b/src/app/care/page.tsx
@@ -8,10 +8,10 @@ import { getUnswitchedSession } from "@/lib/auth/acting-carrier";
import { listMeasurementReminders } from "@/lib/measurement-reminders/list-read";
import { queryKeys } from "@/lib/query-keys";
-import CheckupsPageClient from "./page-client";
+import CarePageClient from "./page-client";
/**
- * Thin RSC wrapper around the (client) checkups page.
+ * Thin RSC wrapper around the (client) Care page.
*
* The page's above-the-fold content — the Vorsorge reminder list — waited for
* the client `queryKeys.measurementReminders()` cell to fetch after hydrate,
@@ -37,12 +37,12 @@ import CheckupsPageClient from "./page-client";
* - Fail-soft: no session or a read hiccup renders the page exactly as
* before this wrapper existed — the client cell owns the fetch.
*/
-export default async function CheckupsPage() {
+export default async function CarePage() {
// Global SSR-prefetch kill-switch shared with the dashboard wrapper. The e2e
// server sets `DASHBOARD_SSR_PREFETCH=false` so Playwright route mocks — which
// only see CLIENT fetches — keep governing what every prefetched page paints.
if (process.env.DASHBOARD_SSR_PREFETCH === "false") {
- return ;
+ return ;
}
let dehydratedState = null;
@@ -64,11 +64,11 @@ export default async function CheckupsPage() {
}
if (dehydratedState === null) {
- return ;
+ return ;
}
return (
-
+
);
}
diff --git a/src/app/checkups/practitioners/page.tsx b/src/app/care/practitioners/page.tsx
similarity index 98%
rename from src/app/checkups/practitioners/page.tsx
rename to src/app/care/practitioners/page.tsx
index 1a4d27e7f6..b3974848e6 100644
--- a/src/app/checkups/practitioners/page.tsx
+++ b/src/app/care/practitioners/page.tsx
@@ -10,7 +10,7 @@ import { useMounted } from "@/hooks/use-mounted";
*
* Deliberately not in Settings. The Settings IA rule is that a settings surface
* configures behaviour; a list of one's own doctors configures nothing and is
- * record content like every other clinical list. Sitting under `/checkups`
+ * record content like every other clinical list. Sitting under `/care`
* also means it inherits that page's route-family classification, so a
* `profile`-scoped delegate reaches it exactly as they reach the visits.
*/
diff --git a/src/app/medications/page-client.tsx b/src/app/medications/page-client.tsx
index ca1718e8f3..b7bd024240 100644
--- a/src/app/medications/page-client.tsx
+++ b/src/app/medications/page-client.tsx
@@ -276,7 +276,7 @@ export default function MedicationsPageClient() {
refetchOnMount: refetchMedicationsOnMount("list"),
});
- // v1.30.1 — pull-to-refresh parity with labs/checkups/mood/measurements.
+ // v1.30.1 — pull-to-refresh parity with labs/care/mood/measurements.
// Medications is one of the sharpest PWA-resume-staleness surfaces (a
// background-refreshed take/skip from a notification, or a cross-device
// write, wouldn't otherwise show up until the 5-min staleTime lapses or a
diff --git a/src/components/daily/__tests__/priority-card.test.tsx b/src/components/daily/__tests__/priority-card.test.tsx
index 151f4b4744..67bb1607e6 100644
--- a/src/components/daily/__tests__/priority-card.test.tsx
+++ b/src/components/daily/__tests__/priority-card.test.tsx
@@ -158,7 +158,7 @@ describe("", () => {
})}
/>,
);
- expect(html).toContain("View check-ups");
+ expect(html).toContain("Open Care");
});
// An appointment keeps the check-up label on the wire for the shipped iOS
@@ -179,7 +179,7 @@ describe("", () => {
/>,
);
expect(one).toContain("View appointment");
- expect(one).not.toContain("View check-ups");
+ expect(one).not.toContain("Open Care");
expect(one).toContain('href="/checkups?visit=v1"');
const several = render(
` to its existing destination
* by construction; S2 invents no new backend action.
diff --git a/src/components/documents/__tests__/document-record-links.test.tsx b/src/components/documents/__tests__/document-record-links.test.tsx
index 5d980d9084..602b20dcf3 100644
--- a/src/components/documents/__tests__/document-record-links.test.tsx
+++ b/src/components/documents/__tests__/document-record-links.test.tsx
@@ -251,7 +251,7 @@ describe("", () => {
onChange={() => undefined}
/>,
);
- expect(html).toContain('href="/checkups?visit=enc-1"');
+ expect(html).toContain('href="/care?visit=enc-1"');
});
});
});
diff --git a/src/components/documents/document-record-links.tsx b/src/components/documents/document-record-links.tsx
index c4de521b88..25de01825d 100644
--- a/src/components/documents/document-record-links.tsx
+++ b/src/components/documents/document-record-links.tsx
@@ -51,7 +51,7 @@ import { queryKeys } from "@/lib/query-keys";
import type { EncounterDTO, EncounterListDTO } from "@/lib/encounters/dto";
import type { EncounterKind } from "@/generated/prisma/client";
import type { InboundDocumentDetailDto } from "@/lib/validations/inbound-documents";
-import { visitPath } from "@/lib/encounters/visit-links";
+import { careVisitPath } from "@/lib/encounters/visit-links";
type Translate = ReturnType["t"];
@@ -111,7 +111,7 @@ export async function fetchEncounterPage(
/** Where a visit opens: its sheet on the checkups page. */
function visitHref(encounterId: string): string {
- return visitPath(encounterId);
+ return careVisitPath(encounterId);
}
/** Where a dose opens: its sheet on the vaccinations page. */
diff --git a/src/components/documents/vault/use-vault-library.ts b/src/components/documents/vault/use-vault-library.ts
index 10ebf34b18..22cbe97aed 100644
--- a/src/components/documents/vault/use-vault-library.ts
+++ b/src/components/documents/vault/use-vault-library.ts
@@ -83,7 +83,7 @@ export function useVaultLibrary({
// persisted per user and changed behind the wrench.
const { layout, isLayoutLoading } = useDocumentsLayout(moduleEnabled);
- // Pull-to-refresh parity with labs/checkups/mood/
+ // Pull-to-refresh parity with labs/care/mood/
// measurements/medications. The vault is one of the sharpest PWA-resume-
// staleness surfaces named in the audit: a document indexed server-side
// while the tab was backgrounded (auto-index / AI summary) otherwise
diff --git a/src/components/encounters/__tests__/visits-section.test.tsx b/src/components/encounters/__tests__/visits-section.test.tsx
index 0172b6ab2c..8f546866c7 100644
--- a/src/components/encounters/__tests__/visits-section.test.tsx
+++ b/src/components/encounters/__tests__/visits-section.test.tsx
@@ -165,7 +165,7 @@ describe("", () => {
it("offers the address book beside the add action", () => {
const html = render({ upcoming: [], past: [] });
- expect(html).toContain('href="/checkups/practitioners"');
+ expect(html).toContain('href="/care/practitioners"');
});
});
diff --git a/src/components/encounters/visits-section.tsx b/src/components/encounters/visits-section.tsx
index 19928d928c..72ed64203f 100644
--- a/src/components/encounters/visits-section.tsx
+++ b/src/components/encounters/visits-section.tsx
@@ -8,7 +8,7 @@
* ordering lives in one place. A client that split and re-sorted one array
* would be the second place it lives.
*
- * No new nav entry and no new route. `/checkups` already owns exactly the right
+ * No new nav entry and no new route. `/care` already owns exactly the right
* sentence — when do I have to do what, where — and is deliberately not module
* gated, which is also why a visit carries no module key of its own.
*/
@@ -101,7 +101,7 @@ export function VisitsSection({ enabled = true }: { enabled?: boolean }) {
actions={
<>