// App shell: sidebar nav + user menu pop const { useState: useStateS } = React; // ME is set dynamically from /api/v1/account on app load. let ME = { name: "", email: "" }; function AppShell({ ctx }) { const { t, route, setRoute } = ctx; const [userMenuOpen, setUserMenuOpen] = useStateS(false); const navItems = [ { k: "networks", l: t.nav.networks, icon: "⌥" }, { k: "support", l: t.nav.support, icon: "?" }, ]; return (
); } function NavLink({ k, l, icon, active, onClick }) { return ( ); } function UserMenu({ ctx, open, setOpen }) { const { t, setRoute } = ctx; return (
{open && ( <>
setOpen(false)} style={{ position: "fixed", inset: 0, zIndex: 30 }}/>
{ setRoute("settings"); setOpen(false); }}>{t.common.settings} {ME.is_admin && { window.location.href = "admin.html"; }}>Admin Panel} { window.location.href = "index.html"; }}>{t.common.backToSite} { ww.logout(); window.location.href = "login.html"; }}>{t.common.signOut}
)}
); } function TopRightControls({ ctx }) { const { lang, setLang, theme, toggleTheme } = ctx; return (
{["en", "zh"].map(l => ( ))}
); } function MenuItem({ children, onClick }) { return ( ); } function AppRouter({ ctx }) { const { route } = ctx; switch (route) { case "networks": return ; case "network": return ; case "support": return ; case "settings": return ; default: return ; } } function AppTweaks({ state, setState, onReset }) { const t = APP_I18N[state.lang]; return (
Tweaks
{t.common.language}
setState({ ...state, lang: v })}/>
{t.common.theme}
setState({ ...state, theme: v })}/>
); } Object.assign(window, { AppShell, AppTweaks, ME });