/* app.jsx — top-level App: routing, layout, navigation, splash */ const { useState: useStateA, useEffect: useEffectA, useRef: useRefA, useCallback: useCallbackA, } = React; function TopBar({ currentPage }) { const { t, lang, setLang } = window.useI18n(); const clock = window.useClock(); return ( david@fontanet : ~ / {t(`path.${currentPage}`)} {clock} setLang('es')}>ES setLang('en')}>EN ); } function Sidebar({ currentPage }) { const { t } = window.useI18n(); const uptime = window.useUptime(); const Link = window.Link; const items = [ ['home', 'sh'], ['about', 'md'], ['education', '/'], ['skills', 'json'], ['experience', 'log'], ['projects', '/'], ['contact', 'sh'], ]; return ( ); } function StatusBar({ currentPage, onNavigate, onMatrix }) { const { t } = window.useI18n(); const fileLabel = (window.PAGE_FILE[currentPage] || currentPage); const promptPath = (window.PAGE_PROMPT_PATH[currentPage] || '~'); return ( ); } function PageView({ currentPage }) { const { lang } = window.useI18n(); const ref = useRefA(null); // remount on page or lang change to retrigger stage sequence cleanly window.useStageSequence(ref, `${currentPage}-${lang}`); const Map = { home: window.HomePage, about: window.AboutPage, education: window.EducationPage, skills: window.SkillsPage, experience: window.ExperiencePage, projects: window.ProjectsPage, contact: window.ContactPage, }; const Page = Map[currentPage] || window.HomePage; return ( ); } function App() { const [currentPage, setCurrentPage] = useStateA(() => window.pageFromPath()); const [transitionTarget, setTransitionTarget] = useStateA(null); const [matrixOn, setMatrixOn] = useStateA(false); const navigate = useCallbackA((target) => { if (transitionTarget) return; if (target === currentPage) return; setTransitionTarget(target); setTimeout(() => { try { history.pushState({}, '', window.pageToPath(target)); } catch (e) {} setCurrentPage(target); setTransitionTarget(null); }, 520); }, [transitionTarget, currentPage]); // back / forward useEffectA(() => { function onPop() { setCurrentPage(window.pageFromPath()); } window.addEventListener('popstate', onPop); return () => window.removeEventListener('popstate', onPop); }, []); // konami code → matrix window.useKonami(useCallbackA(() => { setMatrixOn(true); }, [])); return ( setMatrixOn(true)} /> setMatrixOn(false)} /> ); } ReactDOM.createRoot(document.getElementById('root')).render();