fix(visits): open an upcoming appointment where it lives

Visits are the second tab of `/checkups`, and the bare path opens the
first one, the preventive-care list, which never shows an appointment.
Every surface that listed an upcoming appointment linked it there: the
dashboard's next-appointment line, the Today rail item, the Today
overview fact and the appointment's push notification. A tap on the
appointment landed on the list it is not on.

Each now opens the visit itself (`/checkups?visit=<id>`), or the visits
tab (`/checkups?view=visits`) for a line naming several appointments.
The checkups page reads `view` to pick a tab. The rail item stops
borrowing the check-up item's action: it carries its own label
("View appointment") and intent `visit.view`. The appointment push names
its visit through the producer's `metadata.url` override; a check-up's
push keeps the checkups list.

The same mis-route sat on three links that lead to visits without
being upcoming: a condition's visit rows, the address book's back link
and the onboarding and timeline prompts to add a visit.

`visit-link-guard.test.ts` keeps the visit paths in the builder and
counts every bare `/checkups` per file, each with the reason it names
the checkups list.
This commit is contained in:
Marc-André Bombeck committed 2026-10-21 12:22:36 +02:00
1 parent 78bacb0d86
commit 0dcafeeb70
29 files changed
+591 -23

No files matched your search

+2 -1
View File
@@ -30,6 +30,7 @@ import type {
TimelineReadinessResponse,
} from "@/lib/day/contract";
import { readLocalDaysWithReadings } from "@/lib/day/daily-stats";
import { VISITS_PATH } from "@/lib/encounters/visit-links";
import { listLiveMeasurementTypes } from "@/lib/measurements/live-types";
import { prisma } from "@/lib/db";
import { TRACKED_INTAKE_EVENT_WHERE } from "@/lib/medications/intake-tracking";
@@ -377,7 +378,7 @@ async function visitsLane(frame: Frame) {
{ detail: { key: "visits", params: { count: done, procedures } } },
);
}
const visitGap = gap("visitsEmpty", 0, "/checkups");
const visitGap = gap("visitsEmpty", 0, VISITS_PATH);
return planned > 0
? lane("thin", planned, null, {
detail: { key: "visitsPlanned", params: { count: planned } },