LynCareOS — Frontend presentation stack
Version: 1.0
Last Updated: 2026-06-15 20:02:59
Status: Canonical — tools, patterns, and component map for sophisticated UI
Owner: Frontend
Location: docs/02 - ARCHITECTURE_DESIGN/14-FRONTEND-PRESENTATION-STACK.md
Visual language (colours, typography, Calm Care tokens) lives in 03-DESIGN-SYSTEM.md.
This document is the single place for how we build rich, mobile-first UI: libraries, hybrid graphics, motion, charts, breakpoints, and the vitals component map.
1. Purpose
Section titled “1. Purpose”LynCareOS ships clinical capture surfaces (urine beaker, Bristol stool picker, trend charts) that go beyond plain forms. Engineers need one reference for:
- Which libraries we adopt (and which we explicitly do not)
- Hybrid raster + vector patterns (signed-off beaker)
- Mobile-first capture rules (sheet, sticky actions, touch targets)
- Where each vitals file lives and what it owns
2. Stack inventory
Section titled “2. Stack inventory”Source of truth: frontend/package.json.
| Area | Technology | Notes |
|---|---|---|
| UI framework | React 19, Vite 8, TypeScript ~5.9 | No React Query / TanStack Query |
| Styling | Tailwind CSS 3.4, PostCSS | Dark mode: class on <html> |
| Accessible primitives | Headless UI 2 | Dialog, Listbox in components/ui/ |
| Icons | Lucide React (primary), Heroicons (secondary) | 2px stroke in .cc-icon-chip |
| Charts | Apache ECharts 6 | echarts-for-react; theme in lib/chartTheme.ts |
| Dates | date-fns 4.x | Locale-aware formatting |
| Motion | motion 12.x | Import from motion/react; discrete state only |
| Image tooling (dev) | sharp, svgo | Optimise assets under public/assets/ |
Explicit non-adoptions
Section titled “Explicit non-adoptions”| Not used | Why |
|---|---|
| shadcn / Radix migration | Headless UI covers modal/listbox needs |
| React Query | Project standard: useState + useEffect + lib/api.ts |
| Three.js / Spline on PHI screens | No third-party cloud embeds; client-side SVG/PNG only |
| Rive (optional) | Tier 3 hero assets — not shipped; SVG droplet fallback is launch-ready |
Cursor Canvas (.canvas.tsx) | Decommissioned — Markdown + JSON artefacts only |
3. Rich UI patterns
Section titled “3. Rich UI patterns”3.1 Hybrid raster + vector (urine beaker)
Section titled “3.1 Hybrid raster + vector (urine beaker)”Production urine volume uses a photoreal PNG shell with an SVG liquid fill clipped to the beaker interior.
| File | Role |
|---|---|
components/vitals/UrineVolumeBeaker.tsx | Renders shell + liquid; CSS transitions on fill height |
lib/urineBeakerConstants.ts | Interior geometry (BEAKER_INTERIOR, FLOOR_BULGE) — frozen after sign-off |
public/assets/vitals/urine-beaker-shell.png | Transparent shell raster |
Rule: Do not alter interior clip geometry or shell PNG without clinical/product sign-off.
3.2 Stepped clinical colour scales
Section titled “3.2 Stepped clinical colour scales”Urine colour uses a seven-step enum mapped to hex + plain-language labels (lib/intakeOutputConstants.ts). Selection UI: UrineColourSelector.tsx (vertical desktop, horizontal strip on mobile).
3.3 PNG clinical illustrations (Bristol)
Section titled “3.3 PNG clinical illustrations (Bristol)”Bristol stool types 1–7 use PNG tiles under public/assets/bristol/. Selector: BristolStoolSelector.tsx — grid on desktop, horizontal scroll-snap carousel on mobile.
3.4 CSS custom-property sliders
Section titled “3.4 CSS custom-property sliders”Volume control: UrineVolumeSlider.tsx + .urine-volume-slider / .urine-volume-slider-horizontal in index.css. Thumb uses --urine-fill for brand-tinted track fill.
3.5 Elevation surfaces
Section titled “3.5 Elevation surfaces”Calm Care elevation scale (see 03-DESIGN-SYSTEM.md §3.4):
--cc-shadow-elev-1/2/3inindex.css- Tailwind
shadow-elev-1/2/3 .cc-surface,.cc-surface-floatfor vitals capture cards- Shared vitals accents:
lib/vitalsTheme.ts
4. Motion
Section titled “4. Motion”| Library | Usage |
|---|---|
| CSS transitions | Beaker liquid fill; global prefers-reduced-motion in index.css |
motion/react | Sheet enter (VitalsCaptureSheet), colour knob layoutId, volume number, Bristol whileTap |
Hook: hooks/usePrefersReducedMotion.ts — when reduce, skip springs and use instant/CSS-only updates.
Rule: Do not wrap range slider thumbs in Motion during drag — animate discrete state changes only.
5. Data visualisation
Section titled “5. Data visualisation”| Helper | Location | Used by |
|---|---|---|
chartColors(), chartTypography() | lib/chartTheme.ts | All ECharts wrappers |
intakeOutputChartBase(isDark, isMobile) | lib/chartTheme.ts | UrineTrendChart, BristolStoolTrendChart, cancer intake/output trends |
useChartMobileLayout() | hooks/useMatchMedia.ts | Charts at max-width: 767px |
Charts render with opts={{ renderer: 'svg' }} for crisp clinical graphics.
6. Responsive breakpoints
Section titled “6. Responsive breakpoints”| Hook / query | Breakpoint | Use |
|---|---|---|
useVitalsCaptureMobile() | max-width: 639px | Urine/bowel capture layout, full-screen sheet |
useChartMobileLayout() | max-width: 767px | ECharts grid, axis font sizes |
Tailwind sm: | 640px | General layout (capture mobile is intentionally 639px) |
Mobile-first vitals capture
Section titled “Mobile-first vitals capture”- Touch targets: ≥44×44 px (
min-h-11,min-w-11on destructive actions) - Sticky save:
StickyActionBarinsideVitalsCaptureSheeton mobile
7. Accessibility
Section titled “7. Accessibility”- WCAG 2.1 AA target on vitals route
- Colour selection:
role="radio"+aria-labelper swatch; selected label visible (not colour alone) prefers-reduced-motionhonoured for Motion and CSS- Playwright:
e2e/a11y.spec.tsincludes/vitals; mobile smoke:e2e/vitals-capture-mobile.spec.ts
8. Asset conventions
Section titled “8. Asset conventions”| Path | Content |
|---|---|
public/assets/vitals/ | Urine beaker shell, droplet helpers |
public/assets/bristol/ | Bristol type PNGs (1–7) |
public/brand/ | Auth / marketing brand assets |
Optimise new PNGs with project npm scripts (sharp / svgo where documented in developer guide). No hot-linked external URLs on PHI screens.
9. Vitals component map
Section titled “9. Vitals component map”| Component | Path | Responsibility |
|---|---|---|
| Section shell | components/vitals/IntakeOutputSection.tsx | Collapsed today rows, open capture, save/cancel orchestration |
| Mobile sheet | components/vitals/VitalsCaptureSheet.tsx | Full-screen capture on mobile; desktop passthrough |
| Sticky actions | components/ui/StickyActionBar.tsx | Thumb-reachable Save/Cancel in sheet |
| Urine panel | components/vitals/UrineCapturePanel.tsx | Beaker hero + slider + colour; mobile vs desktop layout |
| Volume slider | components/vitals/UrineVolumeSlider.tsx | Vertical (desktop) / horizontal (mobile) |
| Beaker (frozen) | components/vitals/UrineVolumeBeaker.tsx | PNG shell + SVG fill |
| Colour selector | components/vitals/UrineColourSelector.tsx | Stepped strip + ColourDroplet SVG |
| Bristol selector | components/vitals/BristolStoolSelector.tsx | Type grid / mobile carousel + flag chips |
| Today visuals | UrineEntryStrip.tsx, BowelEntryVisual.tsx | Collapsed list parity with capture UI |
| Urine trend | components/vitals/UrineTrendChart.tsx | Daily stacked mL bars by colour |
| Bristol trend | components/vitals/BristolStoolTrendChart.tsx | BSFS scatter + clinical bands |
| Theme tokens | lib/vitalsTheme.ts | VITALS_CAPTURE_CARD, section icon classes |
| Defaults | lib/urineCaptureDefaults.ts | urineCaptureDefaults() for new capture session |
| Beaker maths | lib/urineBeakerConstants.ts | mL ↔ band, clip constants (geometry frozen) |
| Trend model | lib/intakeOutputTrendModel.ts | Daily stacks, colour hex, window days |
10. Cross-links
Section titled “10. Cross-links”| Document | Relationship |
|---|---|
| 01-ARCHITECTURE.md §Software development stack | High-level stack table + link here |
| 03-DESIGN-SYSTEM.md | Calm Care tokens, elevation, vitals capture layouts |
| 05-DEVELOPER-GUIDE.md | Local vitals dev chapter, quality gates |
| 2026-06-10-watch-closely-measurements-design.md | Product spec for urine/beaker + Bristol |
| 2026-06-15-vitals-ui-sophistication-roadmap.md | Program roadmap and tier checklist |
Change log
- 1.0 (2026-06-15 20:02:59) — Initial publication: stack inventory, vitals component map, mobile/motion/chart rules after vitals UI sophistication program.