Skip to content

Plan — Vitals UI sophistication roadmap (four tiers + mobile-first)

Version: 1.2.1
Last Updated: 2026-06-16 08:59:24
Status: Complete — Tiers 1, 1b, 2, and 4 shipped; Tier 3 (Rive droplet) deferred — SVG fallback is launch-ready
Parent specs: 2026-06-10-watch-closely-measurements-design.md · 03-DESIGN-SYSTEM.md
Scope: Vitals intake/output capture (urine + bowel), trend charts, and shared Calm Care elevation tokens that lift the whole app


Move LynCareOS vitals capture from functional but visually basic to reference-grade sophistication — matching the depth, polish, and metaphor quality of the urine beaker work already shipped — while treating mobile as the primary surface (majority of carers log on phones).

Non-negotiables

RuleWhy
Do not regress the urine beaker + fluid fillAlready signed off; geometry and blend are production-quality
Mobile-first layout and touch targets≥44×44 px; one-hand use; minimal vertical scroll in capture
No new GPL/AGPL dependenciesProject licensing rule
No third-party cloud embeds on PHI screensRive/SVG/Motion run client-side only
Presentation-only changes unless spec requires API workSame IntakeOutputCreate payloads and bands
WCAG 2.1 AAColour + shape/label for clinical status; contrast on swatches

AreaLocationNotes
Photoreal beaker + SVG liquidUrineVolumeBeaker.tsx, urineBeakerConstants.tsHybrid PNG shell + clipped liquid; do not replace
Urine trend stacked barsUrineTrendChart.tsx, intakeOutputTrendModel.tsmL axis, colour segments, rounded tops
Bristol PNG selectorBristolStoolSelector.tsx, public/assets/bristol/7 types, tone rings
Daily entry visualsUrineEntryStrip.tsx, BowelEntryVisual.tsxReplace plain text in today’s list
Calm Care foundation03-DESIGN-SYSTEM.md, cc-* classesTokens exist; vitals not fully on elevation scale
Stack fitpackage.jsonHeadless UI, Lucide, ECharts, Sharp — no shadcn migration needed

2.2 Mobile pain points (why it “doesn’t look good” on phone)

Section titled “2.2 Mobile pain points (why it “doesn’t look good” on phone)”

The desktop-oriented three-column urine panel (UrineCapturePanel.tsx: slider | beaker | colour) stacks on mobile into a very tall column (~900–1100 px before Save):

Mobile today — urine open

Vertical slider card ~240px

Beaker ~320px

Colour strip + labels + droplet ~380px

Current volume + presets

Time picker

Cancel / Save

IssueComponentImpact on mobile
Three-column → stackUrineCapturePanelExcessive scroll; beaker loses “hero” focus
Fixed 252 px colour stripUrineColourSelectorToo tall beside labels; horizontal space wasted
Vertical volume sliderindex.css .urine-volume-sliderAwkward thumb reach; narrow hit area
Inline expand in sectionIntakeOutputSectionCompetes with “Urine today” + “Bowel today” + entries
2×4 Bristol gridBristolStoolSelectorAcceptable but long; type 7 off-screen without scroll
Small preset chipsURINE_VOLUME_PRESETS_ML buttonsSome chips <44 px height
Text-only “last recorded”IntakeOutputSectionMisses visual parity with capture UI

Design principle for mobile: one hero graphic per step, controls below or beside (never three heavy panels stacked), sticky primary action, optional stepped flow when height > ~70vh.


2026-06-172026-06-192026-06-212026-06-232026-06-252026-06-272026-06-292026-07-012026-07-032026-07-052026-07-072026-07-09Design tokens + cc elevation Mobile vitals layout (Phase A) ECharts Calm Care theme Motion micro-interactions Rive droplet + optional slider Tier1Tier2Tier3Tier4Vitals UI sophistication — suggested sequence
TierNameOutcomeEffortPriority
1Design tokens & surfacesConsistent elevation, radius, surface gradients app-wide3–5 daysP0
1bMobile-first vitals capturePhone-native urine + bowel flows; beaker unchanged5–7 daysP0
2MotionFill, selection, panel enter/exit; prefers-reduced-motion3–5 daysP1
3Rive hero graphicsDesigner-driven droplet/slider states; optional thermometer later7–10 daysP2
4ECharts polishSofter grids, token colours, shared tooltip chrome3–4 daysP1 (can parallel Tier 1)

Recommended delivery order: Tier 1 → Tier 1b (mobile) → Tier 2 + Tier 4 in parallel → Tier 3 when a Rive asset pipeline is ready.


4. Tier 1 — Design tokens & surfaces (detailed)

Section titled “4. Tier 1 — Design tokens & surfaces (detailed)”

~70% of “premium” feel is consistent depth and spacing, not new libraries. Extend Calm Care with a named elevation scale and vitals-specific surface utilities so urine/bowel cards match the reference mockup (soft multi-layer shadows, rounded-2xl, restrained borders).

IDTaskFilesDone when
T1-1Add elevation tokens shadow-elev-1 … shadow-elev-3 (+ dark variants)tailwind.config.js, index.css :root --cc-shadow-*Documented in 03-DESIGN-SYSTEM.md §Components
T1-2Add surface utilities cc-surface, cc-surface-float (white + subtle top gradient + elev-1)index.cssUsed on vitals capture cards
T1-3Standardise radius: cards rounded-2xl, chips rounded-full, inner wells rounded-xlVitals componentsNo mixed rounded-lg on new vitals work
T1-4Vitals accent mapping: urine = brand, bowel = amber/healing, concern = coralConstants or small vitalsTheme.tsSingle import for section headers
T1-5Replace ad-hoc border shadow-sm on urine panel with cc-surface-floatUrineCapturePanel, UrineColourSelector, IntakeOutputSectionVisual match on 390×844 viewport
T1-6Touch target audit script or checklist row in PR templatedocs/plans/… or validate:architecture notePresets & flag chips ≥44 px min-height

4.3 Token sketch (implementation reference)

Section titled “4.3 Token sketch (implementation reference)”
/* index.css — additive, do not remove shadow-soft */
:root {
--cc-shadow-elev-1: 0 1px 2px rgba(37, 48, 59, 0.06), 0 4px 12px rgba(37, 48, 59, 0.06);
--cc-shadow-elev-2: 0 2px 4px rgba(37, 48, 59, 0.06), 0 8px 24px rgba(37, 48, 59, 0.08);
--cc-shadow-elev-3: 0 4px 8px rgba(37, 48, 59, 0.08), 0 16px 40px rgba(37, 48, 59, 0.10);
}
  • npm run build + npm run lint:strict
  • Manual: iPhone 14 / Pixel 7 widths in DevTools + one real device
  • npm run test:a11y on vitals route (no new violations)

5. Tier 1b — Mobile-first vitals capture (detailed)

Section titled “5. Tier 1b — Mobile-first vitals capture (detailed)”

Urine capture - mobile

Sticky header: Urine step pill

Hero: UrineVolumeBeaker centered max-w-xs

Horizontal volume slider or compact vertical beside beaker

Current volume card - full width

Horizontal colour strip or bottom sheet step 2

Selected colour droplet - inline compact

Preset chips - horizontal scroll

Sticky bottom: Cancel and Save urine

Layout rules

ElementMobile behaviourDesktop (≥640 px)
BeakerCenter, max-w-[280px], top of flowCenter column, current size
Volume controlHorizontal slider under beaker (filled track)Keep vertical slider left
ColourHorizontal gradient strip + label below OR 2-step wizardVertical strip + labels right
DropletInline 40 px beside selected labelCard below strip
PresetsHorizontal scroll, min-h-11 chipsWrap row
Save/CancelSticky bottom-0 safe-area paddingInline in card
ElementMobile behaviour
Bristol gridSingle column large cards (full width) OR horizontal snap carousel for types 1–7
Selected previewSticky mini-preview bar when type selected
FlagsFull-width wrap; min-h-11
SaveSame sticky bar pattern as urine
SectionMobile behaviour
Last urineUrineEntryStrip + time (not text band label only)
Last bowelBowelEntryVisual thumbnail + one line
Record CTAFull-width cc-btn-accent “Record urine” / “Record bowel”
Today’s entriesCompact rows; strip/visual max-height capped
IDTaskFilesNotes
M-1Add useMatchMedia('(max-width: 639px)') layout switchUrineCapturePanel.tsxProp layout?: 'auto' default
M-2UrineVolumeSliderHorizontal — reuse --urine-fill CSSNew UrineVolumeSlider.tsx, index.cssShared thumb styles with vertical
M-3UrineColourSelector mobile variant — horizontal strip, labels under or tooltipUrineColourSelector.tsxStrip height ~48–56 px; tap targets full band
M-4Optional 2-step stepper on mobile: Volume → ColourUrineCapturePanel.tsxReduces single-page height ~40%
M-5VitalsCaptureSheet wrapper — full-bleed on mobile when recordingIntakeOutputSection.tsx or new componentfixed inset-0 z-40 + scroll body; desktop stays inline
M-6Sticky action bar componentcomponents/ui/StickyActionBar.tsxCancel + primary; safe-area
M-7Bristol mobile carousel option (CSS scroll-snap)BristolStoolSelector.tsxgrid-cols-1 fallback; carousel @media max-sm
M-8Visual “last recorded” for urineIntakeOutputSection.tsxMirror bowel row pattern
M-9Playwright mobile screenshotse2e/panel-screenshots.spec.ts or vitals spec390×844 baseline images
  • Urine capture open: beaker visible without scrolling on 390×844 (iPhone 14)
  • Primary save reachable with thumb (sticky bar or within 1 scroll)
  • All interactive targets ≥44×44 px (WCAG 2.5.5 target size)
  • Colour selection readable: label + shape (not colour alone)
  • Bristol type selectable in ≤2 swipes if carousel; all types reachable
  • No horizontal page scroll at 320 px width
  • Dark mode parity on all above
  • Changing beaker interior geometry or shell PNG
  • New API fields or mL column in Postgres
  • Replacing ECharts with another chart library

Terminal window
cd frontend && npm install motion

Import from motion/react (not legacy framer-motion).

IDTaskWhereMotion pattern
MO-1Beaker fill level transitionUrineVolumeBeaker liquid rect/ellipsemotion animate y/height or keep CSS transition + spring on wrapper
MO-2Current volume count-upUrineCapturePaneluseMotionValue + formatted mL (respect reduced motion → instant)
MO-3Colour knob + labelUrineColourSelectorlayoutId on selection ring
MO-4Bristol card selectBristolStoolSelectorwhileTap={{ scale: 0.98 }}, ring fade
MO-5Capture sheet enter/exitVitalsCaptureSheetAnimatePresence slide up
MO-6Global reduced-motionuseReducedMotion() hook wrapperSkip springs when true; Tailwind motion-reduce: on CSS
  • Lighthouse performance on vitals page (no major regression)
  • Manual: iOS Safari — no jank during slider drag
  • prefers-reduced-motion: reduce — animations disabled or ≤200 ms fade only

7. Tier 3 — Rive hero graphics (detailed)

Section titled “7. Tier 3 — Rive hero graphics (detailed)”
AssetRecommendationRationale
Urine beaker + fluidKeep current SVG + PNGSigned off; Rive migration high risk for little gain
Colour dropletRive candidateGloss, highlight, subtle wobble on select
Volume slider thumbOptional RiveOnly if designer delivers state machine
Bristol type highlightCSS + PNGAlready good; Rive overkill
Thermometer (fever band)Future RivePer watch-closely spec §2.1
Terminal window
npm install @rive-app/react-canvas

Runtime is client-only; bundle ~80–100 KB — lazy-load on vitals route.

Designer: Rive editor

Export .riv

public/assets/vitals/rive/

Lazy Rive component

State machine inputs: colourIndex fillPct

IDTaskOwner
R-1Create ColourDropletRive.tsx with fallback to SVG ColourDropletDev
R-2Design droplet .riv (idle + selected states)Design
R-3Wire colour enum → Rive inputDev
R-4Document asset export settings in docs/02…/assets/vitals/README.mdDev
  • Fallback SVG always renders if Rive fails to load
  • No Rive Cloud hosted URLs in production
  • Test on mid-range Android (Carer phone profile)

IDTaskFiles
E-1Centralise chart theme object from --cc-* tokensfrontend/src/lib/chartTheme.ts (extend if exists)
E-2Urine stacked bars: softer grid, token font, tooltip cc-surface stylingUrineTrendChart.tsx
E-3Bristol trend: shape markers + colour not sole signalBristolStoolTrendChart.tsx
E-4Mobile chart height + axis label rotationTrend panels in cancer module + vitals
E-5Weekly date strip already mobile — verify touch targetsDayDateStrip.tsx

FileTiers
frontend/tailwind.config.js1
frontend/src/index.css1, 2
frontend/src/components/vitals/UrineCapturePanel.tsx1b, 2
frontend/src/components/vitals/UrineVolumeBeaker.tsx2 only (motion on liquid; no geometry changes)
frontend/src/components/vitals/UrineColourSelector.tsx1, 1b, 2, 3
frontend/src/components/vitals/UrineVolumeSlider.tsx (new)1b
frontend/src/components/vitals/BristolStoolSelector.tsx1, 1b, 2
frontend/src/components/vitals/IntakeOutputSection.tsx1b
frontend/src/components/ui/StickyActionBar.tsx (new)1b
frontend/src/lib/chartTheme.ts4
docs/02 - ARCHITECTURE_DESIGN/03-DESIGN-SYSTEM.md1 (§ update)

Phase A — Foundation + mobile urine (Week 1)

Section titled “Phase A — Foundation + mobile urine (Week 1)”
  • T1-1 … T1-5 elevation tokens applied to vitals cards
  • M-1, M-2, M-3 horizontal slider + mobile colour strip
  • M-6 sticky save bar
  • M-8 visual last urine row
  • Build + lint + mobile manual QA

Phase B — Mobile bowel + capture sheet (Week 2)

Section titled “Phase B — Mobile bowel + capture sheet (Week 2)”
  • M-5 vitals capture sheet on mobile
  • M-7 Bristol carousel / single-column
  • M-4 optional urine stepper (if Phase A still too tall) — not needed; single-page mobile layout fits
  • M-9 Playwright mobile screenshots
  • Update 03-DESIGN-SYSTEM.md vitals pattern subsection
  • MO-1 … MO-6 Motion integration
  • E-1 … E-5 chart theme
  • test:a11y green — requires Playwright auth env + running dev stack
  • R-1 … R-4 droplet Rive with SVG fallback — deferred; ColourDroplet SVG ships instead
  • Performance check on 3G Fast throttling

Terminal window
cd frontend
npm run validate:architecture
npm run lint:strict
npm run test
npm run build
npm run test:a11y # when vitals routes touched

Manual mobile matrix

ViewportDevice reference
390×844iPhone 14
360×800Android common
320×568iPhone SE (minimum)

Do not ship if urine beaker fill alignment regresses or mobile capture requires >2 full screens of scroll before Save.


RiskMitigation
Mobile layout swap breaks desktopuseMatchMedia + shared subcomponents; screenshot both breakpoints
Motion jank on slider dragAnimate fill via CSS where possible; Motion only on discrete state
Rive bundle sizeLazy load; SVG fallback
Colour contrast on gradient stripWCAG check each swatch label; border on selected band
Scope creep into backend mL storageKeep urine_volume_band mapping; mL is UI-only

  • Product owner sign-off on 390×844 urine + bowel capture screenshots
  • Carers can record urine in under 30 seconds with ≤1 scroll on mobile
  • Visual parity between reference mockup sophistication and live UI (droplet, slider, cards) without copying AI mockup literally
  • Beaker + fluid unchanged and still rated “production quality”

PR1 — Tier 1 tokens + mobile urine layout shell

  1. Add --cc-shadow-elev-* and cc-surface-float
  2. Create UrineVolumeSlider.tsx (horizontal + vertical)
  3. Refactor UrineCapturePanel mobile branch: beaker hero → horizontal slider → compact colour → sticky bar
  4. Do not modify UrineVolumeBeaker geometry in this PR

Estimated size: ~400–600 lines changed across 4–6 files.


Section titled “15. Related documents to update after Phase B”
DocumentUpdate
03-DESIGN-SYSTEM.mdNew § Vitals capture patterns (mobile + desktop)
2026-06-10-watch-closely-measurements-design.mdMark urine/bowel UI phases complete
05-DEVELOPER-GUIDE.mdShort note on Motion + optional Rive lazy load
14-FRONTEND-PRESENTATION-STACK.md (new)Canonical UI tools, patterns, vitals component map
01-ARCHITECTURE.mdStack table + cross-link to §14
00-INDEX.mdLink presentation stack doc

16. Documentation workstream (architecture, design, full stack)

Section titled “16. Documentation workstream (architecture, design, full stack)”

Implementation and documentation ship together. Each PR includes a doc gate (see vitals UI implementation plan (DOC0 section in this roadmap) DOC0 section).

16.1 New canonical doc: Frontend presentation stack

Section titled “16.1 New canonical doc: Frontend presentation stack”

Path: docs/02 - ARCHITECTURE_DESIGN/14-FRONTEND-PRESENTATION-STACK.md

Why a separate doc: 01-ARCHITECTURE.md covers the full platform (FastAPI, Postgres, Docker, billing). 03-DESIGN-SYSTEM.md covers Calm Care visual language. Neither fully captures how we build sophisticated clinical UI — hybrid graphics, motion policy, chart theming, asset pipeline, mobile capture patterns.

Contents:

SectionWhat it records
Stack inventoryCurrent frontend/package.json dependencies with purpose
Planned stackMotion (Tier 2), Rive optional (Tier 3)
Non-adoptionsNo shadcn, no React Query, no Spline on PHI screens
Rich UI patternsHybrid PNG+SVG beaker, SVG droplet, Bristol PNGs, CSS fill sliders
Mobile-firstBreakpoints (639px capture, 767px charts), capture sheet, sticky bar
AccessibilityWCAG 2.1 AA, colour+label, reduced motion, axe
Asset pipelinepublic/assets/, sharp, svgo
Vitals component mapFile → responsibility table
Quality gatesbuild, lint, test, test:a11y, mobile viewports
DocumentUpdates
01-ARCHITECTURE.mdExtend §Software development stack: Calm Care elevation, Motion, optional Rive, vitals hybrid graphics; link §14
03-DESIGN-SYSTEM.mdelev-1/2/3, cc-surface-float; § Vitals capture mobile/desktop; Phase 6 charts status
05-DEVELOPER-GUIDE.mdNew § Vitals intake/output development (files, breakpoints, adding clinical graphics)
03-SOLUTION-DESIGN.mdSolution posture: mobile-first vitals, four-tier sophistication
2026-06-10-watch-closely-measurements-design.md§2.2–2.3 implementation status + component links
00-INDEX.mdPresentation stack in design/architecture links
This roadmapPhase checkboxes + version bump per merge
PRDocumentation
PR1Design system elevation §; §14 skeleton; architecture link
PR2§14 component map; developer guide urine mobile
PR3Design system vitals capture §; watch-closely partial complete
PR4Developer guide screenshots + touch targets
PR5§14 Motion; architecture Motion row
PR6Chart theme in §14; watch-closely implemented; Phase 6 status

Current: React 19 · Vite 8 · TS · Tailwind 3.4 · Headless UI 2 · ECharts 6 · Lucide · date-fns · fetch/api.ts · useMatchMedia · sharp/svgo · Vitest/Playwright/axe

Tier 1 adds: cc-surface-float, shadow-elev-*, vitalsTheme.ts

Tier 2 adds: motion (motion/react)

Tier 3 adds (optional): @rive-app/react-canvas lazy + SVG fallback

Tier 4 extends: chartTheme.ts intake/output helpers

Frozen (do not replace): UrineVolumeBeaker hybrid implementation