// Top bar + sub-bar + router context shared across screens const RouterCtx = React.createContext(null); const useRouter = () => React.useContext(RouterCtx); const TopBar = () => { const { route, go, openPalette, query } = useRouter(); const tabs = [ { id: 'home', label: 'Recent', match: ['home', 'search', 'session'] }, { id: 'projects', label: 'Projects', match: ['projects', 'project'] }, { id: 'stats', label: 'Stats', match: ['stats'] }, { id: 'health', label: 'Health', match: ['health'] }, { id: 'settings', label: 'Settings', match: ['settings'] }, ]; const ownerScope = route.ownerScope; // set by ProjectsScreen / HomeScreen when admin uses ?owner= return (
go({ name: 'home' })}>assistant-log / scarlet
{query ? "{query}" : search turns, sessions, paths…} ⌘K
go({ name: 'settings' })} title={`signed in via ${ME.via}`}> {ME.user} {ME.isAdmin && admin} {ownerScope && ownerScope !== ME.user && ( viewing: {ownerScope === '*' ? 'all owners' : ownerScope} )}
); }; Object.assign(window, { RouterCtx, useRouter, TopBar });