Skip to content

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.


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

Source of truth: frontend/package.json.

AreaTechnologyNotes
UI frameworkReact 19, Vite 8, TypeScript ~5.9No React Query / TanStack Query
StylingTailwind CSS 3.4, PostCSSDark mode: class on <html>
Accessible primitivesHeadless UI 2Dialog, Listbox in components/ui/
IconsLucide React (primary), Heroicons (secondary)2px stroke in .cc-icon-chip
ChartsApache ECharts 6echarts-for-react; theme in lib/chartTheme.ts
Datesdate-fns 4.xLocale-aware formatting
Motionmotion 12.xImport from motion/react; discrete state only
Image tooling (dev)sharp, svgoOptimise assets under public/assets/
Not usedWhy
shadcn / Radix migrationHeadless UI covers modal/listbox needs
React QueryProject standard: useState + useEffect + lib/api.ts
Three.js / Spline on PHI screensNo 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

Production urine volume uses a photoreal PNG shell with an SVG liquid fill clipped to the beaker interior.

FileRole
components/vitals/UrineVolumeBeaker.tsxRenders shell + liquid; CSS transitions on fill height
lib/urineBeakerConstants.tsInterior geometry (BEAKER_INTERIOR, FLOOR_BULGE) — frozen after sign-off
public/assets/vitals/urine-beaker-shell.pngTransparent shell raster

Rule: Do not alter interior clip geometry or shell PNG without clinical/product sign-off.

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).

Bristol stool types 1–7 use PNG tiles under public/assets/bristol/. Selector: BristolStoolSelector.tsx — grid on desktop, horizontal scroll-snap carousel on mobile.

Volume control: UrineVolumeSlider.tsx + .urine-volume-slider / .urine-volume-slider-horizontal in index.css. Thumb uses --urine-fill for brand-tinted track fill.

Calm Care elevation scale (see 03-DESIGN-SYSTEM.md §3.4):

  • --cc-shadow-elev-1/2/3 in index.css
  • Tailwind shadow-elev-1/2/3
  • .cc-surface, .cc-surface-float for vitals capture cards
  • Shared vitals accents: lib/vitalsTheme.ts

LibraryUsage
CSS transitionsBeaker liquid fill; global prefers-reduced-motion in index.css
motion/reactSheet 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.


HelperLocationUsed by
chartColors(), chartTypography()lib/chartTheme.tsAll ECharts wrappers
intakeOutputChartBase(isDark, isMobile)lib/chartTheme.tsUrineTrendChart, BristolStoolTrendChart, cancer intake/output trends
useChartMobileLayout()hooks/useMatchMedia.tsCharts at max-width: 767px

Charts render with opts={{ renderer: 'svg' }} for crisp clinical graphics.


Hook / queryBreakpointUse
useVitalsCaptureMobile()max-width: 639pxUrine/bowel capture layout, full-screen sheet
useChartMobileLayout()max-width: 767pxECharts grid, axis font sizes
Tailwind sm:640pxGeneral layout (capture mobile is intentionally 639px)

Desktop (≥640px)

Inline cc-surface-float in IntakeOutputSection

Mobile capture (≤639px)

Record urine / Record bowel cc-btn-accent min-h-11

VitalsCaptureSheet full viewport

StickyActionBar Save / Cancel

  • Touch targets: ≥44×44 px (min-h-11, min-w-11 on destructive actions)
  • Sticky save: StickyActionBar inside VitalsCaptureSheet on mobile

  • WCAG 2.1 AA target on vitals route
  • Colour selection: role="radio" + aria-label per swatch; selected label visible (not colour alone)
  • prefers-reduced-motion honoured for Motion and CSS
  • Playwright: e2e/a11y.spec.ts includes /vitals; mobile smoke: e2e/vitals-capture-mobile.spec.ts

PathContent
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.


ComponentPathResponsibility
Section shellcomponents/vitals/IntakeOutputSection.tsxCollapsed today rows, open capture, save/cancel orchestration
Mobile sheetcomponents/vitals/VitalsCaptureSheet.tsxFull-screen capture on mobile; desktop passthrough
Sticky actionscomponents/ui/StickyActionBar.tsxThumb-reachable Save/Cancel in sheet
Urine panelcomponents/vitals/UrineCapturePanel.tsxBeaker hero + slider + colour; mobile vs desktop layout
Volume slidercomponents/vitals/UrineVolumeSlider.tsxVertical (desktop) / horizontal (mobile)
Beaker (frozen)components/vitals/UrineVolumeBeaker.tsxPNG shell + SVG fill
Colour selectorcomponents/vitals/UrineColourSelector.tsxStepped strip + ColourDroplet SVG
Bristol selectorcomponents/vitals/BristolStoolSelector.tsxType grid / mobile carousel + flag chips
Today visualsUrineEntryStrip.tsx, BowelEntryVisual.tsxCollapsed list parity with capture UI
Urine trendcomponents/vitals/UrineTrendChart.tsxDaily stacked mL bars by colour
Bristol trendcomponents/vitals/BristolStoolTrendChart.tsxBSFS scatter + clinical bands
Theme tokenslib/vitalsTheme.tsVITALS_CAPTURE_CARD, section icon classes
Defaultslib/urineCaptureDefaults.tsurineCaptureDefaults() for new capture session
Beaker mathslib/urineBeakerConstants.tsmL ↔ band, clip constants (geometry frozen)
Trend modellib/intakeOutputTrendModel.tsDaily stacks, colour hex, window days

DocumentRelationship
01-ARCHITECTURE.md §Software development stackHigh-level stack table + link here
03-DESIGN-SYSTEM.mdCalm Care tokens, elevation, vitals capture layouts
05-DEVELOPER-GUIDE.mdLocal vitals dev chapter, quality gates
2026-06-10-watch-closely-measurements-design.mdProduct spec for urine/beaker + Bristol
2026-06-15-vitals-ui-sophistication-roadmap.mdProgram 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.