mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 21:32:18 +00:00
Lays the visual scaffold for the AI Coach drawer (B2b): - `<CoachDrawer>` wraps `<Sheet side="right">` and exposes the three-column layout from the artboard (history rail · message thread · sources rail) on `lg+`. Mobile (<lg) collapses to a single column with the message thread in focus and the rails hidden — they get reachable via tray menus in v1.4.21. History / sources / composer are slot props so the parent wires them in commit 3 without coupling them to the shell. - `<MessageThread>` renders user / assistant bubbles, supports an in-flight streaming bubble fed by `useSendCoachMessage()`, and preserves a "user-pinned-to-bottom" auto-scroll heuristic so reading earlier turns doesn't yank the viewport when a new token lands. - `<SourceChips>` renders the labels-only provenance envelope — metric + window + n-count, no raw values — matching the wire contract from B2a. - i18n keys land under `insights.coach.*` for tagline, new chat, composer placeholder, history rail, sources rail, metric labels, and window labels. Both locales updated. Drawer state (open / prefill) is consumed via a controlled prop + lazy `useState` initialiser; the close path resets thread + composer in the `onOpenChange` handler so we don't trip `react-hooks/set-state-in-effect`. Tests cover: source-chip render permutations (8), message-thread empty / persisted / streaming / error states (8), provenance locale-aware labels. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>