/* global React, Icon, SyncChip */ // ============================================================ // App shell — sidebar, topbar, router context // ============================================================ const { useState: useStateSh, useEffect: useEffectSh, createContext: createContextSh, useContext: useContextSh } = React; const RouteCtx = createContextSh({ screen: 'dashboard', go: () => {} }); const useRoute = () => useContextSh(RouteCtx); const SCREENS = [ { id: 'dashboard', label: 'Dashboard', icon: Icon.Dashboard, group: 'main' }, { id: 'collections', label: 'Collections', icon: Icon.Collections, group: 'main' }, { id: 'relics', label: 'Relics', icon: Icon.Relic, group: 'main' }, { id: 'static', label: 'Static', icon: Icon.Static, group: 'group' }, { id: 'fc', label: 'Free Company', icon: Icon.FC, group: 'group' }, { id: 'settings', label: 'Settings', icon: Icon.Settings, group: 'account' }, ]; const TITLES = { landing: { crumb: ['Welcome'] }, binding: { crumb: ['Bind character'] }, dashboard: { crumb: ['Dashboard'] }, collections: { crumb: ['Collections'] }, relics: { crumb: ['Relics', 'Zodiac weapon'] }, static: { crumb: ['Static', 'Aether Crystals'] }, raidnight: { crumb: ['Static', 'Aether Crystals', 'Tue · Mar 4'] }, loot: { crumb: ['Static', 'Aether Crystals', 'Loot table'] }, fc: { crumb: ['Free Company', 'Whispers of Hydaelyn'] }, settings: { crumb: ['Settings'] }, }; function Sidebar({ collapsed, onCollapseChange, character }) { const { screen, go } = useRoute(); const isStaticGroup = ['static', 'raidnight', 'loot'].includes(screen); return ( ); } function Crumbs({ crumb }) { return (
{crumb.map((c, i) => ( {i > 0 && /} {i < crumb.length - 1 ? {c} : {c}} ))}
); } function TopBar({ syncState, extra, onToggleTheme, theme }) { const { screen } = useRoute(); const t = TITLES[screen] || { crumb: [screen] }; return (
{extra}
JK
); } Object.assign(window, { RouteCtx, useRoute, SCREENS, TITLES, Sidebar, TopBar });