// health/MetricDetail.jsx // Per-metric detail with W / 2W / M / 3M segmented control and scrubber. // Spec explicitly calls this out. Demo metric: Sleep duration over a month. function MetricDetail({ dark = false }) { // Last 28 days, hours slept. Touch is on day 18. const days = [ 6.4, 5.8, 7.2, 6.9, 5.4, 8.1, 6.2, 7.5, 6.1, 7.8, 5.9, 6.5, 8.3, 6.7, 7.1, 6.4, 5.6, 7.9, 6.3, 6.8, 7.4, 8.0, 6.2, 5.8, 7.3, 6.5, 6.9, 6.2, ]; const focusIdx = 17; const maxH = 10; const labels = ['Feb 19', '26', 'Mar 5', '12', '16']; const W = 320, H = 170; const dx = W / days.length; const bars = days.map((v, i) => ({ x: i * dx + dx * 0.18, y: H - (v / maxH) * H, w: dx * 0.64, h: (v / maxH) * H, v, })); return (
Mar 4 · Wednesday
7 h 54 m
Quality 82 · Bedtime 11:12 PM
{}}/>
Past 28 nights
Avg 6h 48m
{/* gridlines */} {[0, 0.25, 0.5, 0.75, 1].map(p => ( ))} {/* goal line */} 8h {/* bars */} {bars.map((b, i) => ( ))} {/* scrubber */} {/* x-axis labels */} {[0, 7, 14, 21, 27].map((i, k) => ( {labels[k]} ))} {/* Scrubber readout */}
Mar 4
7h 54m
Time asleep between bedtime and wake, excluding awake periods longer than 4 minutes. Pulled from Apple Health by the HealthSync sidecar app — Ordentus does not write to Health.
Learn more
); } window.MetricDetail = MetricDetail;