// Main app — routes between screens, manages fix-all state, wraps in device frame function ResumeAuraApp({ platform = 'ios', startScreen = 'score', score = 82, scoreVariant = 'orb', width, height }) { const [screen, setScreen] = React.useState(startScreen); const [activeIssue, setActiveIssue] = React.useState(null); const [fixedIds, setFixedIds] = React.useState(new Set()); const [toast, setToast] = React.useState(null); const [prevFixed, setPrevFixed] = React.useState(null); // Reset state when switching start screens (from tweaks) React.useEffect(() => { setScreen(startScreen); }, [startScreen]); const handleIssueTap = (iss) => setActiveIssue(iss); const applyOne = (id) => { setFixedIds(prev => { const s = new Set(prev); s.add(id); return s; }); setActiveIssue(null); setToast({ count: 1, prev: new Set(fixedIds) }); }; const applyAll = () => { setPrevFixed(new Set(fixedIds)); const all = allIssues().map(i => i.id); const n = all.length - fixedIds.size; setFixedIds(new Set(all)); setActiveIssue(null); setToast({ count: n }); }; const undo = () => { setFixedIds(prevFixed || new Set()); setToast(null); }; const screens = { onboarding: setScreen('upload')}/>, upload: setScreen('scanning')}/>, scanning: setScreen('score')}/>, score: setScreen('editor')} onShare={() => setScreen('export')} onExport={() => setScreen('export')}/>, editor: setScreen('score')} onFix={applyAll} onIssueTap={handleIssueTap} onExport={() => setScreen('export')} fixedIds={fixedIds} activeIssue={activeIssue}/>, export: setScreen('editor')}/>, history: setScreen('score')} onOpen={() => setScreen('score')} onExport={() => setScreen('export')}/>, profile: setScreen('score')} onExport={() => setScreen('export')}/>, }; // Tab bar — overlay on screens that benefit const showTabs = ['score', 'history', 'profile'].includes(screen); const tabs = [ { id: 'score', label: 'aura', icon: }, { id: 'editor', label: 'edit', icon: }, { id: 'history', label: 'history', icon: <> }, { id: 'profile', label: 'me', icon: <> }, ]; const dark = ['onboarding', 'scanning'].includes(screen) || (screen === 'score'); const content = (
{screens[screen]} {showTabs && (
{tabs.map(t => { const active = t.id === screen; const c = active ? (dark ? '#fae14b' : '#1a0d2e') : (dark ? 'rgba(255,255,255,0.5)' : '#6b5e88'); return ( ); })}
)} setActiveIssue(null)} onApply={applyOne} onApplyAll={applyAll}/> setToast(null)}/>
); if (platform === 'ios') { return {content}; } return {content}; } window.ResumeAuraApp = ResumeAuraApp;