// Dashtreme's horizontal layout: the topbar (logo, search, connection, notifications), the primary menu (three dropdown // groups, an off-canvas panel on phones), the status strip under it on every page, and the footer. import { useEffect, useState, type ReactNode } from 'react' import { NavLink, useLocation } from 'react-router' import { useApp } from '../context' import { InspectorDrawer } from '../fly/Inspector' import { LiveToasts } from '../fly/Ticker' import { useConn } from '../lib/hooks' import { Notifications } from './Notifications' import { SearchBox } from './SearchBox' import { Icon } from './ui' export type NavItem = { to: string; label: string; icon: string } export type NavGroup = { label: string; icon: string; items: NavItem[]; when?: (m: NonNullable['meta']>) => boolean } export const NAV: NavGroup[] = [ { label: 'Memecoins', icon: 'bx-coin', items: [ { to: '/', label: 'Overview', icon: 'dashboard' }, { to: '/trades', label: 'Trades', icon: 'trades' }, { to: '/model', label: 'Model & training', icon: 'psychology' }, { to: '/data', label: 'Data pipelines', icon: 'database' }, { to: '/rh', label: 'Robinhood Chain', icon: 'link' }, ] }, { label: 'Prediction markets', icon: 'bx-target-lock', when: (m) => m.kalshi, items: [ { to: '/kalshi', label: 'Kalshi overview', icon: 'visibility' }, { to: '/kalshi-trades', label: 'Kalshi trades', icon: 'receipt' }, { to: '/kalshi-model', label: 'Kalshi model & training', icon: 'neurology' }, { to: '/kalshi-data', label: 'Kalshi data', icon: 'database' }, ] }, { label: 'System', icon: 'bx-cog', items: [ { to: '/processes', label: 'Processes', icon: 'settings' }, { to: '/safety', label: 'Safety & wallet', icon: 'shield' }, { to: '/logs', label: 'Logs', icon: 'logs' }, ] }, ] function Logo() { return (

fly·trader

) } function Menu({ open, onClose }: { open: boolean; onClose: () => void }) { const { meta } = useApp() const loc = useLocation() const [drop, setDrop] = useState(null) useEffect(() => { setDrop(null); onClose() }, [loc.pathname]) // eslint-disable-line react-hooks/exhaustive-deps const groups = NAV.filter((g) => !g.when || (meta && g.when(meta))) return (
{open &&
}
) } /** Dashtreme's user box, for the operator: which console this is and the system pages. */ function OperatorBox() { const { meta } = useApp() const [open, setOpen] = useState(false) return (
setOpen(false)}> setOpen(!open)}>

Operator

{meta ? (meta.hosts_workers ? `console · pid ${meta.pid}` : 'observer · read only') : '…'}

  • Processes
  • Safety & wallet
  • Logs
  • {meta ? `fly-trader ${meta.version}` : ''}
) } function TopBar({ onMenu }: { onMenu: () => void }) { const conn = useConn() return (
) } export function Layout({ children }: { children: ReactNode }) { const { meta, inspect, closeInspector } = useApp() const [menu, setMenu] = useState(false) return (
setMenu(true)} /> setMenu(false)} />
{children}
fly-trader operator console{meta ? ` · ${meta.hosts_workers ? `pid ${meta.pid} hosts the workers` : 'observer: hosts no workers, controls are refused'}` : ''}
{inspect && }
) }