/* app.jsx — EcoID main shell */ const { useState: useStateA, useEffect: useEffectA } = React; function App() { const [section, setSection] = useStateA("hero"); const [mode, setMode] = useStateA("publik"); // publik | policy const [annotOpen, setAnnotOpen] = useStateA(false); const [flagCount, setFlagCount] = useStateA(23); const [tweaks, setTweak] = useTweaks({ accent: "#C0392B", showPullquotes: true, headlineWeight: 800, compactKpi: false, }); useEffectA(() => { document.body.dataset.mode = mode; }, [mode]); // Apply tweak: accent color useEffectA(() => { document.documentElement.style.setProperty('--eco-red', tweaks.accent); }, [tweaks.accent]); // Scrollspy useEffectA(() => { const sections = ["hero", "overview", "fiskal", "mbg", "subsidi", "simulator"]; const onScroll = () => { const scrollY = window.scrollY + 120; let active = sections[0]; for (const id of sections) { const el = document.getElementById(id); if (el && el.offsetTop <= scrollY) active = id; } setSection(active); }; window.addEventListener("scroll", onScroll, { passive: true }); onScroll(); return () => window.removeEventListener("scroll", onScroll); }, []); const scrollTo = (id) => { const el = document.getElementById(id); if (el) window.scrollTo({ top: el.offsetTop - 80, behavior: 'smooth' }); }; const openAnnot = (id) => { setAnnotOpen(true); }; const tabs = [ { id: "hero", label: "Beranda", num: "01" }, { id: "overview", label: "Overview", num: "02" }, { id: "fiskal", label: "Fiskal & APBN", num: "03" }, { id: "mbg", label: "MBG", num: "04" }, { id: "subsidi", label: "Subsidi", num: "05" }, { id: "simulator", label: "Simulator", num: "06" }, ]; return ( <> {/* Top bar */} E EcoID Analisis Jujur Ekonomi Indonesia 2026 {tabs.map(t => ( scrollTo(t.id)}> {t.num} {t.label} ))} setAnnotOpen(true)} style={{ background: 'transparent', border: '1px solid var(--border)', padding: '6px 10px', fontSize: 11, color: 'var(--fg-2)', display: 'flex', alignItems: 'center', gap: 6, fontWeight: 600, letterSpacing: '0.04em', }} title="Lihat semua catatan pakar" > {flagCount} flag setMode("bayi")} title="Penjelasan sederhana dengan ilustrasi sehari-hari"> 👶 Bayi setMode("publik")}> Publik setMode("policy")}> Policy setAnnotOpen(false)} annotations={ECOID.experts} mode={mode} /> {/* Tweaks panel */} setTweak('accent', v)} options={['#C0392B', '#9D2D22', '#D03020', '#F04000', '#1A1A1A']} /> setTweak('showPullquotes', v)}/> setTweak('compactKpi', v)}/> Toggle Publik/Policy ada di nav atas. Policy mode menampilkan formula matematika & footnote akademik. setMode(v)} options={[ { value: 'bayi', label: 'Bayi' }, { value: 'publik', label: 'Publik' }, { value: 'policy', label: 'Policy' }, ]} /> > ); } ReactDOM.createRoot(document.getElementById("root")).render();