Commit Graph
1131 Commits
Author SHA1 Message Date
Marc-André Bombeck 95bc87f5ab feat(auth): wire keyboard hints and aria error wiring on login and register
Bring the auth flows to parity with the rest of the v1.4.27 form
sweep so screen-reader users hear the form-level error banner tied
to the offending field and the mobile keyboard surfaces the right
on-screen affordance per step.

Login: email field flips to `inputMode="email"` +
`enterKeyHint="next"` and disables capitalize / spell-check;
password field carries `enterKeyHint="go"`. Both inputs reference
the error banner via `aria-describedby` and the banner itself gains
`aria-live="polite"`.

Register: same pattern across email, username, and the new-password
field. The submit key on password is `"go"` to fire the create-
account submit on virtual-keyboard return.
2026-05-15 18:38:28 +02:00
Marc-André Bombeck 7398761412 docs(planning): R3d MB1 ResponsiveSheet bucket report
Records the five MB1 commits, the `<ResponsiveSheet>` API, every
migrated form mount, two race-conditioned commit-message
mis-attributions (`bd7cb938`, `44554729`), and the optional
sticky-CTA pattern deferral.
2026-05-15 18:37:13 +02:00
Marc-André Bombeck 192170ee5f feat(forms): wire keyboard hints and aria attributes across settings and admin forms
Bring the same `inputMode`, `enterKeyHint`, `autoComplete`, and
`spellCheck` defaults to the settings and admin surfaces:

- Account: profile email gets `autoComplete="email"` +
  `enterKeyHint="next"`, the disabled username carries
  `autoComplete="username"` so the password manager can still bind
  the credential, and the height field hints the decimal keyboard.
- Telegram card: bot token and chat ID both opt out of autofill,
  disable spell-check + autocapitalize, and lead the chained next →
  done keyboard order.
- Integrations: Withings client-id / secret and the moodLog URL +
  API key share the off-spell + no-capitalize secret-input contract
  and chain into the test / save action via `enterKeyHint`.
- Notifications anchors: each card wrapper carries `scroll-mt-28`
  so direct anchor navigation to `#telegram`, `#ntfy`, `#web-push`
  lands the section header below the safe-area sticky header
  instead of under it.
- Thresholds editor: min/max numeric inputs derive `inputMode`
  ("numeric" for integer ACTIVITY_STEPS, "decimal" elsewhere) and
  chain next → done.
- Admin reminders: the late-window and missed-window minute inputs
  pin `inputMode="numeric"` and the next → done keyboard order.
2026-05-15 18:36:33 +02:00
Marc-André Bombeck 48261b6797 refactor(coach): retire the redundant settings-sheet close-X
The primitive `<SheetContent>` close-X is an absolutely positioned
`opacity-70 rounded-xs` button that clashes with the rest of the
sheet's in-header chrome. Hide it via `showCloseButton={false}` and
render a matching ghost-icon `<SheetClose>` inline in the header
so the close affordance shares the same baseline, ghost variant,
and 44 px tap floor as the coach-drawer header pattern. The
settings-sheet test mock picks up a `SheetClose` passthrough so the
existing skeleton + form assertions keep working.
2026-05-15 18:35:02 +02:00
Marc-André Bombeck beb2b40f7d chore(coach): lift the rail-tray chevrons out of the overlay
The mobile history + sources tray triggers used to mount as absolute
chevron buttons over the message thread, so they (a) overlapped the
first message bubble, (b) sat at a 28 px tap target (`h-7`), and (c)
relied on `backdrop-blur` to stay legible — which still failed on
busy threads.

Lift them into a sub-header strip above the thread: a flex row with
two ghost buttons at `min-h-11`. The strip itself carries `xl:hidden`
since both rails are inline at xl+; the history trigger keeps its own
`lg:hidden` because the history rail mounts inline already at lg+.

While the rail surface is in scope, drop the `opacity-0
group-hover:opacity-100` reveal on the history-rail per-row delete
button — touch surfaces have no hover, so the affordance was
invisible on mobile. The button now sits at `size-11` always-visible;
the confirming state still styles via `data-confirming`.

Test re-baselined to assert the new strip wrapper + `min-h-11` floor.
2026-05-15 18:34:53 +02:00
Marc-André Bombeck 2d8c5e906e feat(forms): wire keyboard hints and aria error wiring across measurement, medication, and mood forms
Pair every required field with `enterKeyHint`, `aria-required`,
`aria-invalid`, and `aria-describedby` so the form-level error banner
gets announced the moment validation fails, and so each input
surfaces the right virtual-keyboard hint (next, done) when the user
moves through the form.

- Measurement form (single + BP triple) and the inline edit dialog
  pin `aria-describedby` to the alert region, add `enterKeyHint` on
  every numeric and notes input, and pass the filter Select an
  explicit `aria-label`.
- Medication form gets the chained `enterKeyHint` flow on name →
  dose → unit → doses-per-pen, switches the schedule window inputs
  to `type="time"`, and forces `text-base` on the dense schedule
  cells so iOS Safari does not auto-zoom the field on focus.
- Intake create + edit dialogs reference the dialog-local error
  banner via `aria-describedby`.
- Inventory add-pen dialog wires the same error descriptor and adds
  `enterKeyHint` to the date and doses-total fields plus
  `autoCapitalize="sentences"` on the notes textarea.
- Side-effect log notes textarea gets `enterKeyHint="done"` and
  `autoCapitalize="sentences"`.
- Mood form pins the timestamp input to the error banner and lifts
  the tags input to `autoCapitalize="none"` so colour-coded chips do
  not get title-cased.

Adds the `measurements.filterByType` translation in de + en.
2026-05-15 18:33:37 +02:00
Marc-André Bombeck 4455472921 chore(insights): apply the tap-target floor across the insights surface
Lift every interactive element on the insights hero + advisor + coach
chrome to clear the 44 px WCAG 2.5.5 floor on touch.

- `hero-strip.tsx`: drop `size="sm"` from the action buttons (weekly
  report, ask the Coach, weekly banner read/share/export). The default
  primitive height now sits at 40 px so the explicit `sm` was the only
  thing keeping these below the floor.
- `suggested-prompts.tsx`: chip floor `min-h-9` → `min-h-11`.
- `insight-advisor-card.tsx`: regenerate icon buttons drop their
  `h-7 w-7` override so the `size="icon"` primitive default (40 px)
  takes over; legacy-payload CTAs drop their `size="sm"`/`h-7` overrides.
- `coach-drawer.tsx`: window pill `h-7` → `h-11`; the three header
  icon buttons (new chat, settings, close) `size-9` → `size-11`.
- `coach-input.tsx`: composer hint icon trigger `h-7 w-7` → `h-11
  w-11`. The Tooltip → Popover swap is owned by MB3 — distinct lines.
- `message-thread.tsx`: thumbs feedback row `py-0.5 text-[11px]` →
  `min-h-11 py-1.5 text-xs`. Same surface row, padding does the lift.
2026-05-15 18:32:28 +02:00
Marc-André Bombeck 04cce8d9c2 refactor(medications): mount the entry surfaces via ResponsiveSheet
Swaps the medication create/edit, intake create/edit, side-effect
log, and inventory add-pen mounts from the centred `<Dialog>` to
the shared `<ResponsiveSheet>` primitive so the same surfaces flip
to a bottom-anchored sheet on narrow viewports. The "log this
thing" mental model — measurement, mood, medication, intake,
side-effect, inventory — now lands on a consistent mobile shape.
Configuration surfaces (IntakeImport, ApiEndpoint, PhaseConfig)
stay centred per Decision G; the dialog primitive's new
`max-h-[calc(100dvh-2rem)]` default keeps them inside the viewport
on short / soft-keyboard screens without the previous per-callsite
`max-h-[90vh]` ceiling.
2026-05-15 18:30:15 +02:00
Marc-André Bombeck b25683404e refactor(ui): move PasswordInput into the shared UI layer with a 44 px toggle
Move `<PasswordInput>` from `src/components/settings/password-input.tsx`
to `src/components/ui/password-input.tsx` so the auth surfaces and
every settings card that masks a secret consume one primitive. The
two surfaces previously diverged on toggle markup and aria-label
wiring; the new home in `ui/` keeps them in lock-step.

While the primitive moves, lift the icon-only show/hide toggle to a
44 px hit area per WCAG 2.5.5 — `inline-flex h-11 w-11` wrapper with
the eye icon centred inside. The input itself gets `pr-12` so user
input never collides with the toggle glyph.

Consumer imports updated in:
- `src/components/settings/account-section.tsx`
- `src/components/settings/ai-section.tsx`
- `src/components/settings/integrations-section.tsx`
- `src/components/settings/ntfy-card.tsx`
- `src/components/settings/telegram-card.tsx`
- `src/components/admin/_shared.tsx`
2026-05-15 18:27:14 +02:00
Marc-André Bombeck 9036e71516 feat(ui): derive Input inputMode default from the type prop
Surface the right on-screen keyboard on iOS Safari and Android Chrome
without forcing every call site to repeat the attribute. The primitive
maps `type="number"` to `inputMode="decimal"` (most numeric fields in
HealthLog accept decimals — kg, mmol/L, sleep hours), `type="email"`
to `"email"`, `type="url"` to `"url"`, `type="tel"` to `"tel"`, and
`type="search"` to `"search"`. Integer-only call sites (steps, doses
per pen, reminder minutes) still opt into `inputMode="numeric"`
explicitly and the override wins.

Cover the derivation with seven additional unit tests on top of the
three existing autoComplete contracts; the suite now pins every
mapping plus the override path.
2026-05-15 18:26:46 +02:00
Marc-André Bombeck bd7cb938c9 feat(ui): lift the password toggle into a shared primitive
Move `<PasswordInput>` from `src/components/settings/password-input.tsx`
to `src/components/ui/password-input.tsx` so the auth surfaces (login
and register) and every settings card that masks a secret consume one
primitive. The two surfaces previously diverged on toggle markup and
aria-label wiring; the new home in `ui/` keeps them in lock-step.

While the primitive moves, lift the icon-only show/hide toggle to a
44 px hit area per WCAG 2.5.5 — `inline-flex h-11 w-11` wrapper with
the eye icon centred inside. The input itself gets `pr-12` so user
input never collides with the toggle glyph.

Consumer imports updated in:
- `src/components/settings/account-section.tsx`
- `src/components/settings/ai-section.tsx`
- `src/components/settings/integrations-section.tsx`
- `src/components/settings/ntfy-card.tsx`
- `src/components/settings/telegram-card.tsx`
- `src/components/admin/_shared.tsx`

The `<DialogContent>` close-X tap-target lift to `min-h-9 min-w-9`
landed in the parallel `ResponsiveSheet` commit because both buckets
share the same `dialog.tsx` file. See Decision I — 36 px is the
intentional exception for fixed icon-only close affordances.
2026-05-15 18:26:06 +02:00
Marc-André Bombeck 65fd0bffdf feat(ui): introduce the ResponsiveSheet primitive
Shared `<ResponsiveSheet>` flips between a bottom `<Sheet>` on narrow
viewports and the existing centred `<Dialog>` at `md+`, with a
sticky-pinned footer slot on the Sheet branch so primary CTAs stay
reachable when the keyboard collapses the viewport. Picks the
breakpoint via a new SSR-safe `useIsMobile` hook (`matchMedia`-driven,
default `false` on the server so SSR markup always matches the
desktop branch). Adds a `max-h-[calc(100dvh-2rem)] overflow-y-auto`
default to `<DialogContent>` so the existing centred-dialog forms
also scroll inside the viewport on short / soft-keyboard mobile
screens instead of spilling off-screen. Smoke suite locks both
branches, the header sr-only escape hatch, sticky-vs-flow footer
shape, and controlled-state plumbing.
2026-05-15 18:23:49 +02:00
Marc-André Bombeck fb6fb4f5e6 feat(ui): lift Button, Input, Select, DropdownMenu defaults to honour the WCAG 2.5.5 floor
Move primitive default heights up so any consumer that does not opt
into a specific size already meets the 40-44 px target-size minimum
without per-callsite overrides.

- `<Button>` default → `h-10` (40 px), `lg` → `h-11` (44 px), `icon`
  → `size-10`, `icon-lg` → `size-11`. `sm` and `xs` stay compact for
  explicit-dense contexts.
- `<Input>` default → `h-10`.
- `<Select>` trigger default → `h-10`.
- `<DropdownMenuItem>` → `min-h-11` so menu rows always clear the
  44 px floor on touch.

No same-line collisions with MB1 (`dialog.tsx` max-h cap) or MB3
(`input.tsx` inputMode derivation) — distinct touch zones.
2026-05-15 18:20:08 +02:00
Marc-André Bombeck 6e01f0e717 docs(planning): consolidated mobile fix-plan for v1.4.27 R3d 2026-05-15 18:15:22 +02:00
Marc-André Bombeck 39d779c7d9 docs(planning): mobile audit report for settings and admin 2026-05-15 18:05:03 +02:00
Marc-André Bombeck 24b67f85a0 docs(planning): mobile audit report for auth and public surfaces 2026-05-15 18:04:02 +02:00
Marc-André Bombeck e5ff434395 docs(planning): mobile audit report for measurements and workouts 2026-05-15 18:03:57 +02:00
Marc-André Bombeck 6a8e5c3482 docs(planning): mobile audit report for the insights surface 2026-05-15 18:03:40 +02:00
Marc-André Bombeck 1b8f03af86 docs(planning): mobile audit report for the coach surface 2026-05-15 18:02:15 +02:00
Marc-André Bombeck d5792a1486 docs(planning): mobile audit report for the medications surface 2026-05-15 18:02:03 +02:00
Marc-André Bombeck bbbb513bfe docs(planning): mobile audit report for the dashboard surface 2026-05-15 18:01:40 +02:00
Marc-André Bombeck 302ebed66b docs(planning): bucket B7 implementation report for v1.4.27
Per-commit subjects, deliverable-vs-actual verification matrix for
every fix-plan item, the orphan-endpoint grep table that grounds the
five-endpoint v1.4.28 defer, and the seven recorded deviations from
the original fix-plan scope.
2026-05-15 17:55:01 +02:00
Marc-André Bombeck d10e0f287b chore(charts): align chart-tick timezone handling across the chart surface
Audits the chart-tick timezone contract called out in BL-P4-2.
`sleep-stage-stacked-bar`, `mood-chart`, `health-chart`, and
`medication-compliance-chart` already anchor every day-key
construction at `Date.UTC(y, m - 1, d)` and route tick rendering
through the timezone-aware formatter pair (`tzFmt.date` / `tzFmt.dateShort`),
so they audit clean.

The compliance heatmap was the outlier: the day cells walked the
weekday and month-boundary axes with `getDay()` and `getMonth()`,
which read in the SSR server's local timezone while the dateKey
above used `toISOString().slice(0, 10)` (UTC). An SSR pass running
on a non-Berlin host would land the Monday alignment and the month
markers one position off relative to the cells they sit under.
Swapped to the UTC accessor pair so all three coordinates (dateKey,
weekday row, month-marker label) read off the same clock.

The tooltip date formatter also parsed the day-key against local
time; pinned to `T00:00:00Z` + the UTC accessor trio for the same
reason.
2026-05-15 17:52:36 +02:00
Marc-André Bombeck f72d2de27c chore(cleanup): retire dead exports across glp1 modules and scheduling helpers
Sweeps the leftover export surface across four modules surfaced by
the v1.4.26 backlog dead-M5 / dead-M7 / simp-M6 / simp-M7 / BL-P4-5
items:

  * src/lib/medications/glp1-knowledge.ts — eight constituent type
    exports (`Glp1Route`, `Glp1DrugClass`, `Glp1Pharmacology`,
    `Glp1Storage`, `Glp1Pen`, `Glp1AdverseReactions`, `Glp1Indications`,
    `Glp1SourceCitations`) drop the `export` keyword. All eight are
    used only as constituents of the still-exported `Glp1DrugRecord`
    aggregate and have no external import sites; narrowing the module
    surface stops a future tree-shaker from re-pulling them.
  * src/lib/medications/scheduling/cadence.ts — `ExpectedDose` drops
    its `export` keyword (no external readers).
  * src/lib/medications/scheduling/cadence.ts — `pairDoses` drops the
    redundant second `.sort()`. Sorting by `windowStart` and by the
    centre `(start+end)/2` produce the same order for the chronologically
    separable windows pairDoses actually sees, so the O(n log n) tail
    that re-sorted the result was wasted work.
  * src/lib/medications/titration/ladder.ts — `escalationDue`'s
    JSDoc gets the parameter-role documentation simp-M7 called out.
    The `drugId` parameter renames to `drugIdForCeiling` so the
    "next-step exists" lookup role is obvious at the call site.
  * src/lib/ai/coach/glp1-snapshot.ts — `__testables.WEEKDAY_KEYS`
    and the underlying private constant retire (zero callers).
2026-05-15 17:48:20 +02:00
Marc-André Bombeck 39571c6e23 chore(lib): derive metricPriorityObjectSchema from SOURCE_PRIORITY_METRIC_KEYS
Drops the hand-maintained 14-key listing on `metricPriorityObjectSchema`
and the parallel 14-key block on the top-level `sourcePrioritySchema`
flat shape; both surfaces now derive their property set from the
`SOURCE_PRIORITY_METRIC_KEYS` constant via `Object.fromEntries`. The
two listings had already drifted twice during v1.4.25 polishing
passes when a new metric class was added. Adding a metric class is
now a single-line constant edit instead of three matching listings
the lint chain doesn't enforce.
2026-05-15 17:40:49 +02:00
Marc-André Bombeck 3ec1f44d74 chore(lib): extract shared allMessages and resolveKey between context and server-translator
Lifts the per-locale message map and the dotted-key resolver out of
`src/lib/i18n/context.tsx` and `src/lib/i18n/server-translator.ts`
into a new `src/lib/i18n/shared-resolve.ts`. The two surfaces had
each carried their own private copy of the same data structure and
the same six-step path resolver; the maps drifted twice when a new
locale was added during v1.4.18 and v1.4.25 polishing passes.
Pinning both call-sites to a shared module keeps client and server
fallback semantics in lockstep and shrinks the surface a future
locale addition has to touch from two files to one.
2026-05-15 17:39:01 +02:00
Marc-André Bombeck 3a7599c846 chore(api): delete the orphan /api/audit-log surface and seed the five README-tied admin orphans into v1.4.28
The /api/audit-log GET handler has zero runtime callers in src/, tests/,
scripts/, or docs/ — verified via grep against the route path plus the
auditLog model name. The admin counterpart at /api/admin/audit-log is
the surface every consumer reads from. Drops the orphan route file
outright per the v1.4.27 fix-plan Section 4 Decision A.

The five admin / monitoring endpoints flagged for the scope-
maximization sweep all carry a README + CHANGELOG documentation
reference, which the fix-plan classes as a consumer for the
defer-on-tie rule:

  /api/admin/ai-settings           — README L362–363, CHANGELOG L752
  /api/admin/backup/test           — README L368,    CHANGELOG L752
  /api/admin/status-overview       — README L367,    CHANGELOG L753
  /api/monitoring/glitchtip/test   — README L381
  /api/monitoring/umami/test       — README L382

All five defer to v1.4.28 for a maintainer call — either wire each to
a real consumer or drop the route + README mention together. Seeds
the v1.4.28 backlog entry with the per-endpoint grep findings so the
decision is one read away.

Also seeds the v1.4.28 backlog with the missing `insights.coach.window.lastYear`
i18n key across the six locale bundles — owned by the i18n bucket.
2026-05-15 17:37:22 +02:00
Marc-André Bombeck 6a76f7463e feat(coach): extend the snapshot window enum with lastYear
Adds a year-in-review window between last90days and allTime so the
Coach drawer can ground a long-horizon question (seasonal mood
patterns, year-over-year weight trajectory) without falling back to
the unbounded `allTime` window. The new enum value flows through the
scope schema, the snapshot builder's window-to-day-count mapping,
the provenance window-set seeding so the source-chips render the
year-in-review chip, and the Coach source-chips Record.

Extends the snapshot test with a `lastYear`-specific assertion that
pins the scope window and the provenance envelope.
2026-05-15 17:35:35 +02:00
Marc-André Bombeck 988bbf1a2f feat(workouts): wire pickCanonicalWorkout into the list read path and collapse the attach route N+1
Adds `GET /api/workouts` as a paginated read surface that runs every
fetch through `pickCanonicalWorkout()` so a duplicated workout that
Apple Health and Withings both publish collapses to the canonical
row before reaching the client. The picker stays a pure function;
the route owns the query window, the fetch multiplier that keeps the
page full after dedup, and the meta envelope that surfaces the
dedup ratio.

Collapses the batch-route route-attach lookup from `Promise.all` of
`tx.workout.findFirst` per manual workout to a single batched
`findMany` keyed by the deterministic `(source, startedAt, sportType)`
tuple. For a 100-row batch this cuts the per-batch round-trip count
from 1 + N to 2 while preserving the most-recent createdAt tie-break
through in-memory grouping.

Adds `__tests__/canonical-dedup.test.ts` covering twin collapse,
proximity-window separation, sport-type isolation, and the limit
clamp.
2026-05-15 17:31:37 +02:00
Marc-André Bombeck 205ee1dd2e chore(api): surface every safeRequestProp fallback through a console warning
The W7d narrowing already pinned the catch to the V8 private-field
TypeError shape, but a real read regression — say, a header parser
crashing on a malformed value — still slipped through silently into
the fallback path because the narrow-catch swallowed every tolerated
error without trace. Logs every fallback through console.warn in
non-test environments so the dev console and run log surface a
regression while the production path keeps the same defensive
defaults. The /api/insights/targets stray-brace comment typo and the
BASE_SYSTEM_PROMPT / INSIGHTS_SYSTEM_PROMPT bare exports flagged by
the original BL-P1-2 / BL-P1-4 items were already retired earlier
in the v1.4.27 cycle.
2026-05-15 17:26:12 +02:00
Marc-André Bombeck 9b0b1c6b84 chore(ui): repair stray motion-reduce tokens that bled into JSDoc comments and pair the mood chart spinner 2026-05-15 17:25:57 +02:00
Marc-André Bombeck 3d3402e3af docs(planning): bucket B6 implementation report for v1.4.27
Captures the i18n cleanup pass: 154 dead-key paths retired across
six locales (~924 strings), 38 new keys added for B1/B3/B4/B5
component-side inserts, locale-native date format ordering for
FR/ES/IT/PL, drift-guard test pinning the GLP-1 / carrier / empty-
state / notification / personal-record key sets, mood-label
shared module landing BL-P6-11.

Also lands the four probe scripts (.planning/v1427-b6-*.mjs) used
to enumerate dead keys and build the new key inserts, sibling to
the existing .planning/v1422-w1a-*.mjs audit artifacts.
2026-05-15 17:24:52 +02:00
Marc-André Bombeck 22b11427e8 feat(i18n): add notification, insights empty-state, and admin carrier keys plus drift-guard
Lands every new translation key referenced by the v1.4.27 buckets B1,
B3, B4 and B5 across all six locale bundles (38 keys per locale):

- dashboard.glp1.tabLevel / tabWeight / tabsAria / rangeStripLabel /
  levelUnavailable / weightUnavailable (B1 — drug-level vs weight tab
  strip on the GLP-1 dashboard tile).
- admin.carrier / admin.carrierUnknown (B3 — IP-address carrier chip
  on the admin login overview).
- insights.emptyState.{bloodPressure,weight,pulse,bmi,mood,medication,sleep}.{title,description,cta}
  (B4 — per-metric empty-state cards on the insights sub-pages).
- notifications.admin.{deployFailedTitle,deployFailedBody,testNotificationTitle,testNotificationBody,reminderCheckMissedTitle,reminderCheckMissedBody,reminderCheckOverdueTitle,reminderCheckOverdueBody}
  (B5 — admin notification messages routed through the localised
  dispatch helper).
- notifications.user.telegramTestBody (B5 — user-facing Telegram test
  message localised to User.locale).

Also retires the now-dead charts.moodLabel1..5 chart-axis label keys:
the mood chart and the mood list now consume the same MOOD_LABEL_KEYS
map from a new src/lib/mood/labels.ts so the chart-axis copy stays in
lockstep with the list (BL-P6-11). Three distinct copy sets for the
same five mood states drifted twice during v1.4.18 / v1.4.25
polishing; the shared resolver locks them together going forward.

New drift-guard test at src/__tests__/i18n-drift-guard.test.ts pins
the GLP-1 tab, admin carrier, insights empty-state, admin/user
notification, and personal-record key sets so a contributor who only
edits one bundle gets a precise failure instead of a 200-line parity
diff. The locale-integrity test continues to assert global parity;
the drift-guard layers on top with call-site-specific coverage.
2026-05-15 17:22:35 +02:00
Marc-André Bombeck 32a023dfff chore(ui): apply M7 + L1 + L3 + L4 polish across medication form, motion-reduce, details aria, therapy timeline
W10 design-review carry-over items. M7 lifts the medication-form
day-of-week buttons, the more-horizontal trigger, and the schedule
label-input gaps to the 44 px / space-y-2 standard used by every
other settings surface. L1 pairs every animate-spin/pulse/bounce
with motion-reduce:animate-none across the component tree so users
with prefers-reduced-motion get a still surface. L3 adds the
aria-controls + panel-id pairing to the inventory + coach-evidence
<details> blocks for parity with the Health Score provenance
accordion. L4 inserts a sr-only h4 per therapy-timeline entry so
screen-reader users can jump between medication blocks.
2026-05-15 17:13:42 +02:00
Marc-André Bombeck 19b5129306 feat(i18n): land locale-native date format ordering for FR/ES/IT/PL
Adds a new `format` namespace across every locale bundle that
documents the locale's native date / time pattern ordering as
template strings (`{day}.{month}.{year}`, `{month}/{day}/{year}`, …).
DE keeps DD.MM.YYYY with dot separators, EN keeps MM/DD/YYYY with
slashes, FR/ES/IT adopt DD/MM/YYYY with slashes (the previous
EN-shaped fallback was visibly wrong on French weekly-report PDFs),
PL adopts DD.MM.YYYY with dots.

The runtime `makeFormatters()` helper still routes through `Intl.*`;
the keys exist so PDF / CSV / email surfaces that render outside a
React context can still pick the right ordering hint.

A new smoke test at
`src/lib/i18n/__tests__/format-locale-order.test.ts` pins the
ordering per locale so a copy-paste regression can't silently flip
DD/MM to MM/DD on a non-English bundle.
2026-05-15 17:12:54 +02:00
Marc-André Bombeck 2960f7352c chore(i18n): retire 414 dead translation keys across six locale bundles
Sweeps 154 dead keys per locale bundle (~924 strings across six
locales) flagged by the v1.4.27 dead-key audit. Drops the
insights.*Status* trio (loading / noKey / unavailable) across six
metrics, the legacy `insights.aiInsights` / `dashboard.insightsPreview`
roots that B1 replaced with the gated tab strip, the
`insights.healthScore.askCoach` / `coachPrompt` pair retired with the
inline button, the orphan onboarding.v2.* stub set, plus the
ad-hoc `medications.glp1.drug.*.class` and `notifications.eventPersonalRecord*`
strings that lost their callers in v1.4.25/W17.

Also drops the stale prefill-format test under
`health-score-card.test.tsx` that asserted the now-removed coachPrompt
key shape — the negative-assertion test for the retired inline button
stays in place.

The locale-integrity test already validates the new shape: no
re-baselining needed because the test asserts parity + no-empties
rather than a key-count threshold.
2026-05-15 17:11:26 +02:00
Marc-André Bombeck 39fef7d316 chore(ui): unify heading weight, card cadence, and label-input gap across settings and admin
Sub-headings in the settings + admin section trees were mixing
font-medium and font-semibold; the password-change dialog used a
1.5-unit label-input gap while every other Settings form runs at 2.
Standardise on font-semibold for every h2 and h3, the card-internal
cadence to space-y-4 on the AI provider and thresholds-editor cards,
and lift the password-dialog field gaps to space-y-2.
2026-05-15 17:07:50 +02:00
Marc-André Bombeck cef9bc14fe docs(planning): R3a contributor reports and v1.4.27 mobile plan
- Three R3a contributor reports (B3 GeoIP+ASN, B4 Coach+Insights,
  B5 Notifications) — B1 and B2 already committed theirs.
- v1.4.27 mobile-capability audit and fix plan inserted between
  R3b and R4: seven parallel auditors per surface area, a single
  consolidator, then a parallel fix-pass against the consolidated
  bucket list.
2026-05-15 17:00:28 +02:00
Marc-André Bombeck 3299fd822c refactor(dashboard): clear B1+B4 reconcile markers
The dashboard already gates each tile through the existing
hasWeight / hasBp / hasPulse / hasBodyFat / hasMood / hasSleep /
hasSteps flags. Those flags read summaries[METRIC].count > 0, which
is exactly the contract hasMetricData() codifies for the routed
Insights surfaces. Both paths now point at each other in code
comments; no behaviour change.
2026-05-15 17:00:16 +02:00
Marc-André Bombeck 5886fea8d7 fix(tests): repair hero-strip and telegram-test-locale assertions after R3a
Two test-contract fixes for fallout from concurrent R3a contributors:

- hero-strip.test.tsx — collapses the two onAskCoach forwarding tests
  into a single regression guard that asserts the inline Health Score
  card Ask-the-Coach button stays retired and the hero strip's
  action-row button carries the affordance.

- telegram-test-locale.test.ts — the route's POST handler takes zero
  arguments (apiHandler wraps an async () => function). Drops the
  Request argument from all seven call sites.
2026-05-15 17:00:13 +02:00
Marc-André Bombeck f3ff262451 feat(insights): gate sub-pages and tab pills on metric data availability
Brand-new accounts (no manual logs, no Apple Health upload yet) used to
land on chart skeletons over blank target bands when they clicked any
metric tab. Apple Health hides those surfaces entirely until the first
observation lands — match the pattern.

Introduce `src/lib/insights/metric-availability.ts` as the single
decision point. `hasMetricData(metric, inputs)` reads `summaries[METRIC].count`
for sensor metrics (PULSE / WEIGHT / BMI / BLOOD_PRESSURE_* / SLEEP_DURATION
/ VO2_MAX / STEPS / ACTIVE_ENERGY), the `hasMood` / `hasMedication`
booleans for event-driven metrics, and BMI inherits from WEIGHT.

Wire three render gates:

- `<InsightsTabStrip>` filters its pills via the new `availability`
  prop. Backward compatible: undefined `availability` keeps every pill.
- `<InsightsLayoutShell>` fetches `/api/analytics` +
  `/api/insights/comprehensive` once per route and threads the inputs
  into the strip; both queries share their cache keys with sub-page
  consumers so the payload lands single-fetch.
- Each `src/app/insights/{slug}/page.tsx` early-returns an
  `<EmptyState>` with the right CTA — `/measurements/new` for sensor
  metrics, `/mood` for Mood, `/medications` for Medication,
  `/settings/data-sources` for Sleep.

Auto-light-up: once the iOS native client uploads its first measurement
the same gate flips on the next refetch — no per-metric feature flag.

References the new `insights.emptyState.<metric>.{title,description,cta}`
translation keys (B6 lands them in messages/*.json):

- insights.emptyState.bloodPressure.{title,description,cta}
- insights.emptyState.weight.{title,description,cta}
- insights.emptyState.pulse.{title,description,cta}
- insights.emptyState.mood.{title,description,cta}
- insights.emptyState.medication.{title,description,cta}
- insights.emptyState.bmi.{title,description,cta}
- insights.emptyState.sleep.{title,description,cta}
2026-05-15 16:54:51 +02:00
Marc-André Bombeck 5364e347f5 docs(planning): bucket B1 implementation report for v1.4.27 2026-05-15 16:49:03 +02:00
Marc-André Bombeck 5b8a47b4ff fix(insights): strip the duplicate briefing paragraph and rebalance the Health Score column
The /insights hero strip already renders briefing.paragraph as its
subtitle directly above the Daily Briefing card; the card then mounted
the same paragraph a second time inside its CardContent before the
key-findings list. The user read the same string twice within 200 px.

Drop the leading paragraph render from <DailyBriefing>; the card now
opens directly on the structured key-findings list (the part the hero
subtitle cannot surface). The empty-state branch keeps its 'Generate
briefing' CTA so the populated → empty flow remains intact.

Rebalance the Health Score card so it reads as a co-equal column of
the hero rather than a small inset:
  - lg:w-[260px] → lg:w-[360px] xl:w-[400px]
  - score number text-4xl → text-5xl sm:text-6xl
  - progress bar h-1.5 → h-2
  - inline Ask-the-Coach button retires; the hero strip's existing
    action covers it. onAskCoach stays on the prop signature so callers
    don't break.

Fold in BL-P4-9 L2: disclaimer text-[10px] → text-[11px] (the 10 px
size was borderline against the 12 px mobile floor flagged in the
W10 design review).

Tests updated: daily-briefing test asserts the paragraph slot is
absent in the populated branch; health-score-card tests pin the new
no-button render across English and German locales.
2026-05-15 16:48:03 +02:00
Marc-André Bombeck 25952d7d05 feat(admin): surface the carrier chip under the auth provider on the login overview
Adds a `carrierShortLabel()` helper in `_shared.tsx` that folds the
verbose GeoLite2 `autonomous_system_organization` strings down to
the glanceable DACH short labels Marc asked for: "Telekom",
"Vodafone", "1&1", "O2". Unknown organisations fall through to the
raw string so the chip stays informative.

`LoginOverviewSection` now renders the short label as a smaller
chip below the existing auth-provider chip, gated on
`entry.carrier !== null` so private-IP and offline-miss rows keep
the legacy single-chip layout.

The CSV export grows a matching `carrier` column between `location`
and `provider`. The API selector pulls the new `asn` + `carrier`
fields. New translation keys (`admin.carrier`, `admin.carrierUnknown`)
are referenced in code; bucket B6 lands the JSON entries.
2026-05-15 16:47:36 +02:00
Marc-André Bombeck fe18a8810c feat(coach): replace the textarea hint footer with an info-icon tooltip
The composer rendered the keyboard-shortcut hint ("Enter to send,
Shift+Enter for new line") as a prose `<span>` directly under the
textarea. Combined with the disclaimer and the send button, the
footer ate ~140 px of vertical room for what is essentially a single-
sentence affordance.

Replace the `<span>` with an `Info` icon wrapped in a Radix `<Tooltip>`
sat left of the send button. The existing `composerHint` translation
surfaces both as the trigger's `aria-label` (so screen-readers still
hear it on focus) and as the tooltip body for sighted users on hover.
The slot `data-slot="coach-input-hint"` stays so consumers can still
target the affordance.
2026-05-15 16:47:25 +02:00
Marc-André Bombeck 4d88764e4f fix(coach): collapse the evidence disclosure to closed-by-default
The assistant bubble's evidence `<details>` mounted open whenever the
user had `coachPrefs.showEvidenceByDefault = true`, which surfaced the
raw measurement values (e.g. "Blutdruck letzte 30 Tage: 226") under
every reply. The disclosure is now always collapsed; the user expands
by click. The persisted pref stays in the schema for backward
compatibility but no UI reads or writes it, so the value is dead-code-
tolerated for one release and can be dropped in the next migration.

Drops the `evidenceDefaultOpen` prop wiring from `<MessageThread>` and
the corresponding `<Switch>` in the Coach settings sheet. Adjusts the
sheet test that previously asserted the toggle was rendered.
2026-05-15 16:45:55 +02:00
Marc-André Bombeck 053d678ac7 refactor(dashboard): promote GLP-1 schedule dates to a header pill row and drop the green seam
The faint dracula-green left-seam on the outer wrapper was decoration
without a semantic tie to the schedule rows beside it. The Syringe-icon
in the title row already carries the 'active therapy' signal at a
glance.

Replace the <dl> grid with a soft-green pill bar that groups Last- and
Next-Injection as one cohesive 'therapy schedule' unit. Each pill keeps
its data-slot anchor (glp1-tile-last / glp1-tile-next) so existing
tests stay in lockstep; new test asserts the data-slot='glp1-tile-schedule'
wrapper renders and the border-l-dracula-green/60 + border-l-2 classes
no longer appear on the outer wrapper.
2026-05-15 16:44:39 +02:00
Marc-André Bombeck 1d8b80698e feat(audit): wire ASN+carrier into the audit-log create/update path
Completes the v1.4.27 B3 audit-log work that landed in e8fb0a75. The
prior commit shipped the backfill helper but the schema + migration
+ audit.ts write-path were dropped during a concurrent staging
window. This commit puts them back.

`prisma/schema.prisma` grows two nullable columns on AuditLog (`asn`
+ `carrier`), the matching idempotent `IF NOT EXISTS`-guarded
migration lands at `0061_audit_log_carrier`, and the auditLog helper
resolves location + ASN row in parallel (single 3 s race, single
`prisma.auditLog.update` carries whichever fields the resolvers
filled).

Test coverage: five new cases on audit.test.ts cover all four
combinations of location/ASN hit-or-miss plus a row with no
carrier organisation.
2026-05-15 16:43:48 +02:00
Marc-André Bombeck c0ec1fecfb feat(dashboard): wire the GLP-1 drug-level pane behind a tab strip and range picker
The GLP-1 tile previously rendered a single weight chart — a downstream
proxy for the dose-response. The maintainer-flagged headline is the
estimated drug-level curve because it surfaces the sawtooth shape of
the weekly cycle directly.

Add a two-tab segmented control (Drug-Level default / Weight) inside the
chart pane and a 7d / 30d / 90d / All range strip above. The Drug-Level
tab mounts <DrugLevelChart compact …>, which now drops its outer card
wrapper and renders at 160 px instead of 240 px when 'compact' is set,
so the dashboard tile owns the card surface. Range selections thread
through a new windowHoursBefore prop on DrugLevelChart; the sample step
scales 6/12/24/48 h with window length so 'All' mode does not paint
thousands of points. The standalone surface at /medications/[id]/history
keeps its full 21-day default and full-card chrome — both consumers
share one implementation.

New translation keys referenced (B6 sweep picks up):
- dashboard.glp1.tabLevel
- dashboard.glp1.tabWeight
- dashboard.glp1.tabsAria
- dashboard.glp1.rangeStripLabel
- dashboard.glp1.levelUnavailable
- dashboard.glp1.weightUnavailable

Test coverage extended: glp1-tile test asserts tab strip + range strip
DOM, drug-level default selection, level-unavailable hint when the
medication has no id; the existing DrugLevelChart test suite continues
to pin the standalone-surface contract.
2026-05-15 16:43:24 +02:00
Marc-André Bombeck e8fb0a7521 feat(audit): persist ASN and carrier on login audit rows
Adds two nullable columns to AuditLog (`asn Int?` + `carrier String?`)
via an additive `IF NOT EXISTS`-guarded migration. The audit-log
write path now resolves the location and the ASN row in parallel and
writes whichever fields the resolvers could fill in a single update.

A new `runGeoBackfill` helper walks rows where `location IS NULL`
AND `ipAddress IS NOT NULL` AND `createdAt > now() - 30 days`,
capped at 5 000 rows per pass. Useful for picking up rows that
landed during an `ipwho.is` outage or before the GeoLite2 MMDBs
were bundled into the image.
2026-05-15 16:43:03 +02:00