// AFTER — Trend screen (4-week view). Same vocabulary as DashboardScreen. const { useState: useStateTrend, useMemo: useMemoTrend } = React; const TR = { cream: '#fafaf8', black: '#0f0f0f', green: '#3d6b4f', greenDark: '#2a4d39', gray: '#6b6b6b', border: '#e2e0db', greenLight: '#e8f0eb', }; const trStyles = { screen: { background: TR.cream, height: '100%', display: 'flex', flexDirection: 'column' }, scroll: { flex: 1, overflowY: 'auto', padding: '64px 20px 20px' }, headerRow: { marginBottom: 24 }, eyebrow: { fontFamily: '"DM Sans", system-ui', fontSize: 12, fontWeight: 600, color: TR.gray, letterSpacing: '.08em', textTransform: 'uppercase' }, title: { fontFamily: '"DM Serif Display", Georgia, serif', fontSize: 30, color: TR.black, lineHeight: 1.15, marginTop: 6 }, sub: { fontFamily: '"DM Sans", system-ui', fontSize: 14, color: TR.gray, marginTop: 6, lineHeight: 1.5 }, card: { background: TR.cream, border: `1px solid ${TR.border}`, borderRadius: 16, padding: 20, marginBottom: 12 }, cardLabel: { fontFamily: '"DM Sans", system-ui', fontSize: 12, fontWeight: 600, color: TR.gray, textTransform: 'uppercase', letterSpacing: '.05em', marginBottom: 12 }, statsRow: { display: 'flex', gap: 24, marginTop: 12 }, statLabel: { fontFamily: '"DM Sans", system-ui', fontSize: 12, color: TR.gray }, statValue: { fontFamily: '"DM Sans", system-ui', fontSize: 18, fontWeight: 600, color: TR.black, marginTop: 2 }, callout: { background: TR.greenLight, border: `1px solid ${TR.green}`, borderRadius: 14, padding: '14px 16px', marginBottom: 12, }, calloutLabel: { fontFamily: '"DM Sans", system-ui', fontSize: 11, fontWeight: 600, color: TR.green, letterSpacing: '.1em', textTransform: 'uppercase', marginBottom: 6, }, calloutBody: { fontFamily: '"DM Sans", system-ui', fontSize: 14, color: TR.greenDark, lineHeight: 1.5, }, segRow: { display: 'flex', gap: 6, background: '#f0efed', padding: 4, borderRadius: 10, marginBottom: 14 }, segBtn: (on) => ({ flex: 1, padding: '8px 0', borderRadius: 8, fontFamily: '"DM Sans", system-ui', fontSize: 13, fontWeight: 600, background: on ? TR.cream : 'transparent', color: on ? TR.black : TR.gray, boxShadow: on ? '0 1px 2px rgba(0,0,0,0.06)' : 'none', border: 'none', cursor: 'pointer', textAlign: 'center', }), }; function TrendChart() { // 30-day weight series — drifts within a 175 ± 3 lb maintenance band const W = 320, H = 130; const center = 175; const bandHi = 178, bandLo = 172; const pts = Array.from({ length: 30 }, (_, i) => { const drift = Math.sin(i * 0.32) * 1.4; const wobble = Math.sin(i * 1.7) * 0.4 + Math.sin(i * 2.9 + 1) * 0.3; return center + drift + wobble + (i < 4 ? 0.6 : 0); }); const yMin = 170, yMax = 180; const yOf = v => H - 8 - ((v - yMin) / (yMax - yMin)) * (H - 16); const xOf = i => (i / (pts.length - 1)) * W; const xs = pts.map((_, i) => xOf(i)); const ys = pts.map(yOf); const line = xs.map((x, i) => `${i === 0 ? 'M' : 'L'} ${x.toFixed(2)} ${ys[i].toFixed(2)}`).join(' '); const fill = line + ` L ${W} ${H} L 0 ${H} Z`; const yBandHi = yOf(bandHi), yBandLo = yOf(bandLo); return ( ); } function NoiseBars() { // Per-day food noise score (0–10), 14 days, with a Sunday-evening spike pattern const days = [3, 4, 3, 5, 4, 6, 8, 3, 4, 3, 4, 5, 7, 9]; const max = 10; return (
{days.map((d, i) => { const isSpike = d >= 7; return (
); })}
); } function TrendScreen() { const [range, setRange] = useStateTrend('30d'); return (
Last 30 days
Holding steady.
You're within 1.4 lb of where you started maintenance. That's the goal — not down, just held.
{[['7d','7 days'],['30d','30 days'],['90d','90 days']].map(([k, label]) => ( ))}
{/* Chart card */}
Weight trend
Maintenance band
Start
175.8
Now
174.4
Range
±1.6 lb
{/* Mira's pattern callout */}
Pattern Mira noticed
Food noise spikes Sunday evenings. Want to plan a Sunday ritual together?
{/* Food noise card */}
Food noise · 14 days
Mon Sun Sat Fri
); } Object.assign(window, { TrendScreen });