feat: add the timeline page, its readiness inventory and life-event entry

The opt-in timeline module gets its page (#613). At 768 px and up the
record's lanes (life, conditions, allergies, medications, vaccinations,
doctor and procedures, labs, documents) are drawn in one SVG on a shared
time axis, with a year, month or week grid, open periods ending in an
arrow, a dashed lead-in where a start is unknown, dose marks and pauses on
the medication they belong to, a Today line and a selection line. Up to
three neutral value lines run below as monthly means, chosen in a menu.
Recharts stays for every value chart; this surface is plain SVG like the
heatmaps.

All geometry is pure (timeline-geometry.ts): window, scale, row packing
and label placement through one occupancy map, so no label overlaps
another label or a bar, none runs past the card edge, and labels that do
not fit are left out rather than squeezed. The width comes from a
ResizeObserver, so a docked day panel re-runs the layout.

The bar under the chart names the selected month's entries as chips, the
month's means and "Open 3 Jan.", which puts ?day= in the URL for the day
layer. The chart is one tab stop: arrows move the selection by a day, a
month or a year with the zoom, Home and End jump to the ends, Enter opens
the day. A visually hidden table lists every entry for screen readers.
The legend says once that stacked means at the same time, not cause and
effect.

Below 768 px the timeline is a chronicle, newest first by month or year,
with an Ongoing block for what has no meaningful start, rails beside the
rows an episode or course spans, and empty stretches named as such.

Switching the module on in Settings opens the readiness inventory: each
lane carries, is thin or is empty, with one link per gap and the verdict
as a count. The same inventory sits as a dismissible card on the timeline
while a gap is open, and under Layers as "Data coverage".

Life events are entered in a sheet (title, kind, a date to the day, month
or year, an optional end, an optional note) from the timeline, the
capture picker and the dashboard's add menu; one surface line maps the
capture kind to the timeline module, and it is offered in one's own
record only. Deleting asks first.

Server routes are built in parallel; the e2e journey answers them with the
contract's shapes. Copy in all seven locales; the timeline and lifeEvents
release-pending prefixes are gone.
This commit is contained in:
Marc-André Bombeck committed 2026-10-08 14:27:02 +02:00
1 parent b8f6372963
commit 32258bc5ab
50 files changed
+8277 -54

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
"use client";
import { Suspense, useEffect } from "react";
import { useRouter } from "next/navigation";
import { PageAuthGate } from "@/components/ui/page-auth-gate";
import { useAuth } from "@/hooks/use-auth";
import { TimelineView } from "@/components/timeline/timeline-view";
/**
* v1.42 (#613): the life timeline.
*
* The `timeline` module is opt-in, and its switch lives in Settings. With
* the module off the navigation entry is gone, and a deep link lands on the
* shell's module notice (`ModulePageGate`, through `nav:/timeline` in the
* surface map) instead of this page, which never mounts and so never asks
* the server, whose routes refuse on their own. An unauthenticated visitor
* is sent to login.
*
* The view reads `?day=` and `?add=` through `useSearchParams`, which needs
* a boundary on a statically rendered page.
*/
export default function TimelinePage() {
const { isLoading, isAuthenticated } = useAuth();
const router = useRouter();
useEffect(() => {
if (!isLoading && !isAuthenticated) router.push("/auth/login");
}, [isLoading, isAuthenticated, router]);
if (isLoading || !isAuthenticated) return <PageAuthGate />;
return (
<Suspense fallback={<PageAuthGate />}>
<TimelineView />
</Suspense>
);
}