/* UpWeDo phone mockups — localized via `t` (I18N[lang].phone) + `dir`. Drawn in the app's current look: the blue Royal backdrop with soft circles, glass cards, pill buttons and a floating pill tab bar. */ const { useState } = React; const DISPLAY = 'var(--font-family-display)'; const BASE = 'var(--font-family-base)'; const PH_SOFT = 'rgba(255,255,255,0.74)'; const PH_GLASS = 'rgba(255,255,255,0.9)'; const PH_INK = '#111827', PH_INK2 = '#4B5563'; /* One of the five buddies' 168 × 168 busts (boy, girl, boy2, girl2, boy3). */ const buddySrc = key => `${(window.BRAND||{}).buddyBase || 'assets/buddy'}/avatar-${key}.png`; function PhoneFrame({ children, tilt=0, cls='' }) { return (
{children}
); } /* Lucide house, compass, users, user. */ const TAB_ICONS = [ 'M3 10l9-7 9 7v10a2 2 0 0 1-2 2h-4v-7h-6v7H5a2 2 0 0 1-2-2z', 'M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20zM16.24 7.76l-2.12 6.36-6.36 2.12 2.12-6.36z', 'M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M9 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8zM22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75', 'M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2M12 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8z', ]; function PhoneTabBar({ t, active=0 }) { return (
{t.tabs.map((l,i) => (
{l}
))}
); } function PhoneStatusBar({ t }) { return (
{t.time}
{[6,8,10,12].map((h,i)=>
)}
); } /* Status bar, the screen's content over the Royal backdrop, and the tab bar. */ function PhoneScreen({ t, dir, tab=0, children }) { return (
{children}
); } const Caps = ({ children, color=PH_SOFT }) => (
{children}
); const Avatars = ({ colors, ring='#fff', size=14 }) => (
{colors.map((c,i)=>
0?-4:0 }} />)}
); const initial = name => (name.trim().split(/\s+/).pop() || '?')[0]; const glass = (extra={}) => ({ borderRadius:16, background:PH_GLASS, boxShadow:'0 6px 18px rgba(13,26,66,0.16)', ...extra }); const Check = ({ size=10, color='#fff' }) => ( ); /* A speech bubble beside a buddy; the tail points at the buddy. */ const Bubble = ({ children, size=9.5 }) => (
{children}
); /* ── HOME (hero): Done or Not today, until the day closes ─────── */ /* Three habits are left today (two of five are already done). Done ticks one off; Not today sets it aside with no guilt; when none are left, the day closes. Numbers are illustrative. */ const HOME_QUEUE = [ { crowd:412 }, { crowd:96 }, { crowd:1840 } ]; const HOME_ROUTINES = [ { done:1, total:2, color:'#8B5CF6' }, { done:0, total:1, color:'#22C55E' }, { done:1, total:2, color:'#F47215' } ]; const HOME_TOTAL = HOME_ROUTINES.reduce((n,g)=>n+g.total, 0); const DONE_FLASH_MS = 650; function HomePhone({ t, dir='ltr', loc='en-US' }) { const [results,setResults] = useState([]); // 'done' | 'skip', one per handled item const [flash,setFlash] = useState(null); const [tried,setTried] = useState(false); const step = results.length; const finished = step >= HOME_QUEUE.length; const doneIn = gi => HOME_ROUTINES[gi].done + results.filter((r,i)=>r==='done' && i===gi).length; const doneCount = HOME_ROUTINES.reduce((n,_,gi)=>n+doneIn(gi), 0); const act = kind => { if (flash) return; setTried(true); setFlash(kind); setTimeout(()=>{ setFlash(null); setResults(r=>[...r, kind]); }, DONE_FLASH_MS); }; const item = HOME_QUEUE[step], copy = t.queue[step]; const num = v => v.toLocaleString(loc); return (
{t.greeting}
✦ {t.quote} {finished ? (
{t.allDone}
{!results.includes('skip') &&
{t.allDoneSub}
}
📅 {t.activeDays}
✦ {t.finishedWith}
) : (
{t.upNext}
{copy.task}
{copy.source}
{flash==='skip' ? t.skipNote : fill(flash==='done' ? t.you : t.crowd, { n:item.crowd.toLocaleString(loc) })}
)}
{Array.from({ length:HOME_TOTAL }, (_,i)=>
)} {fill(t.progress, { done:num(doneCount), total:num(HOME_TOTAL) })} {!tried && 👆 {t.tryIt}}
{t.todayLabel}
{HOME_ROUTINES.map((g,gi)=>{ const done = doneIn(gi), complete = done===g.total; return (
{t.routines[gi]} {num(done)}/{num(g.total)}{complete?' ✓':''}
); })}
); } /* ── THE CROWD: a habit's community count and a challenge ───── */ const CROWD_WEEK = [52, 64, 58, 71, 66, 48, 80]; function CrowdPhone({ t, dir='ltr' }) { const c = t.crowdScreen; return (
{c.title}
{c.count}
{c.countLabel}
{c.week}
{CROWD_WEEK.map((h,i)=>(
{c.days[i]}
))}
⏳ {c.challenge}
{c.join}
{c.challengeMeta}
{c.challengeCount}
); } /* ── YOUR BUDDY: the day closed, a keepsake, and the buddy's word ─ */ function BuddyPhone({ t, dir='ltr' }) { const c = t.buddyScreen; return (
{c.greeting}
{t.allDone}
📅 {t.activeDays}
🏅
{c.keepsakeLabel}
{c.keepsake}
{c.says}
); } /* ── YOUR GUIDE: a creator's routine with their tip ─────────── */ function GuidePhone({ t, dir='ltr' }) { const c = t.guideScreen; return (
{initial(c.creator)}
{c.creator}
✓ {c.verified}
{c.routine}
{c.meta}
{c.steps.map((s,i)=>(
{i+1} {s}
))}
{c.join}
💡 {c.tipLabel}
{c.tip}
); } Object.assign(window, { PhoneFrame, HomePhone, CrowdPhone, BuddyPhone, GuidePhone, buddySrc, Bubble });