Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ row counts, ids and foreign keys, and run it twice.
what Heroicons lacks. Confirm a name exists
(`ls node_modules/@tabler/icons-react/dist/esm/icons | grep -i <term>`) and import it deep and
per-icon as a default export so the package tree-shakes. See `web/src/goals/sportIcons.tsx`.
A rail page's glyph, wherever it is offered (the rail, the phone drawer, the Overview's app row,
the page's own heading and empty states), is Lucide,
T3 Code's set, from one table per client: `web/src/navIcons.tsx` and `mobile/src/lib/navIcons.tsx`
(`lucide-react/icons/<name>`, `lucide-react-native/icons/<name>`), pinned to the same exact
version; `mobile/src/lib/navIcons.test.mjs` checks the two tables and the rail agree. A Lucide
icon takes `strokeWidth`, never a numeric `stroke` (Tabler's), which it would read as a colour;
the web table's wrappers take either; in the app pass `strokeWidth`.
- **Entry checks compare real paths.** Node resolves symlinks in `import.meta.url` but not in
`process.argv[1]`, so a script launched through a symlinked checkout must use
`isEntry(import.meta.url)` from `scripts/is-entry.mjs`. Otherwise it loads, decides it was
Expand Down
4 changes: 3 additions & 1 deletion mobile/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ Use `npx expo install <pkg>` for dependencies so versions match the SDK.
calls with the same payloads, and nothing that deletes, completes or snoozes loses its undo or its way
back (recycle bin, snoozed, archive).
- **Never hand-draw an icon.** Heroicons via `src/lib/icons.tsx` (the web's names), Tabler via deep
per-icon imports (`@tabler/icons-react-native/dist/esm/icons/IconX.mjs`, default export). Brand art is
per-icon imports (`@tabler/icons-react-native/dist/esm/icons/IconX.mjs`, default export). A page's own glyph
(the drawer's Overview, Search and Settings, the Overview's app row) comes from `src/lib/navIcons.tsx`,
the web rail's Lucide table (`web/src/navIcons.tsx`); change both together. Brand art is
rendered to PNG from the web's SVGs by `scripts/build-logo-assets.mjs` (the app icon, splash and
`assets/images/`); never edit those PNGs by hand.
- **Keep the bridge contract aligned with `bridge.mjs`.** The app has no API of its own.
Expand Down
18 changes: 18 additions & 0 deletions mobile/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"expo-task-manager": "~57.0.21",
"expo-updates": "~57.0.25",
"expo-web-browser": "~57.0.3",
"lucide-react-native": "1.72.0",
"marked": "^18.1.0",
"react": "19.2.3",
"react-dom": "19.2.3",
Expand Down
16 changes: 8 additions & 8 deletions mobile/src/features/overview/OverviewScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import { pushError, pushToast } from '../../lib/toast'
import { DRIVER_LOGOS } from '../../lib/providers'
import {
IconArrowUp, IconChevronRight, IconRefresh, IconCalendarEvent, IconChecklist, IconFlame, IconTarget,
IconListCheck, IconBulb, IconMicrophone2, IconHistory, IconWand, IconSettings, IconInbox,
IconAlertTriangle, IconMapPin, IconPlus, IconCheck, IconBolt, IconServer2,
IconListCheck, IconBulb, IconMicrophone2, IconHistory, IconWand,
IconAlertTriangle, IconMapPin, IconPlus, IconCheck, IconBolt,
IconPlane, IconBeach, IconLuggage,
} from '../../lib/components/overview/icons'
import IconSearch from '@tabler/icons-react-native/dist/esm/icons/IconSearch.mjs'
import { NAV_ICONS } from '../../lib/navIcons'
import { clock, dueDiff, dueLabel, periodTotal, startOfDay, until } from '../../lib/components/overview/time'
import { ov, TI, Section, Quiet, Failed, Loading, Bar, Subhead, More } from './parts'
import { HabitRow } from './HabitRow'
Expand Down Expand Up @@ -73,12 +73,12 @@ const APPS: { id: string; label: string; icon: Tabler; to: NavTarget }[] = [
{ id: 'lists', label: 'Lists', icon: IconListCheck, to: 'lists' },
{ id: 'recs', label: 'Recs', icon: IconBulb, to: 'recs' },
{ id: 'journal', label: 'Journal', icon: IconMicrophone2, to: 'journal' },
{ id: 'inbox', label: 'Inbox', icon: IconInbox, to: 'inbox' },
{ id: 'search', label: 'Search', icon: IconSearch, to: 'search' },
{ id: 'fleet', label: 'Fleet', icon: IconServer2, to: 'fleet' },
{ id: 'inbox', label: 'Inbox', icon: NAV_ICONS.inbox, to: 'inbox' },
{ id: 'search', label: 'Search', icon: NAV_ICONS.search, to: 'search' },
{ id: 'fleet', label: 'Fleet', icon: NAV_ICONS.fleet, to: 'fleet' },
{ id: 'logs', label: 'Logs', icon: IconHistory, to: { tab: 'settings', sub: 'logs' } },
{ id: 'studio', label: 'Skills', icon: IconWand, to: { tab: 'settings', sub: 'skills' } },
{ id: 'settings', label: 'Settings', icon: IconSettings, to: 'settings' },
{ id: 'settings', label: 'Settings', icon: NAV_ICONS.settings, to: 'settings' },
]

// Stored priority is 1..4 with 4 meaning P1.
Expand Down Expand Up @@ -393,7 +393,7 @@ export default function OverviewScreen() {
const B = ({ children }: { children: React.ReactNode }) => <T size={14} weight={600} color={colors.text}>{children}</T>
const attention: { key: string; icon: Tabler; text: React.ReactNode; tone: 'warn' | 'info'; to: NavTarget }[] = []
if (inboxOpen) attention.push({
key: 'inbox', icon: IconInbox, tone: 'info', to: 'inbox',
key: 'inbox', icon: NAV_ICONS.inbox, tone: 'info', to: 'inbox',
text: <><B>{inboxOpen} {inboxOpen === 1 ? 'proposal' : 'proposals'}</B> waiting in your inbox</>,
})
for (const j of failing.slice(0, 2)) attention.push({
Expand Down
49 changes: 49 additions & 0 deletions mobile/src/lib/navIcons.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// The iPhone app's page glyphs (navIcons.tsx) are the web rail's (web/src/navIcons.tsx):
// the same Lucide icon for every destination, at the same version. This reads both
// files as text, so it runs without either app's node_modules.
import test from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'

const repo = join(dirname(fileURLToPath(import.meta.url)), '../../..')
const read = (path) => readFileSync(join(repo, path), 'utf8')

// { overview: 'layout-dashboard', … } from the imports and the NAV_ICONS table.
function table(source, pkg) {
const slugOf = {}
for (const [, name, slug] of source.matchAll(new RegExp(`^import (\\w+) from '${pkg}/icons/([a-z0-9-]+)'`, 'gm'))) slugOf[name] = slug
const body = source.slice(source.indexOf('export const NAV_ICONS'))
const rows = {}
for (const [, id, name] of body.matchAll(/^\s+(\w+): nav\((\w+), '[^']+'\),$/gm)) {
assert.ok(slugOf[name], `${id} uses ${name}, which is not imported from ${pkg}/icons/<name>`)
rows[id] = slugOf[name]
}
return rows
}

test('the app and the web give every page the same Lucide icon', () => {
const web = table(read('web/src/navIcons.tsx'), 'lucide-react')
const app = table(read('mobile/src/lib/navIcons.tsx'), 'lucide-react-native')
assert.ok(Object.keys(web).length >= 8, 'the web table was not read')
assert.deepEqual(app, web)
})

test('both apps pin the same Lucide release', () => {
const web = JSON.parse(read('web/package.json')).dependencies['lucide-react']
const app = JSON.parse(read('mobile/package.json')).dependencies['lucide-react-native']
assert.match(web, /^\d+\.\d+\.\d+$/, 'pin an exact version')
assert.equal(app, web)
})

test('the rail takes every glyph from the table', () => {
const tabs = read('web/src/App.tsx')
let seen = 0
for (const [, id, icon] of tabs.matchAll(/\{ id: '?([\w]+)'?, label: '[^']+', icon: (\w+(?:\.\w+)?) \}/g)) {
seen++
if (id === 'totems' || icon === 'TotemsIcon') continue
assert.match(icon, /^NAV_ICONS\.\w+$/, `the rail's ${id} tab draws ${icon}, not a NAV_ICONS glyph`)
}
assert.ok(seen >= 10, `only ${seen} rail tabs were read from App.tsx`)
})
45 changes: 45 additions & 0 deletions mobile/src/lib/navIcons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* The web rail's glyphs (web/src/navIcons.tsx), one per destination, from Lucide
* (T3 Code's icon set): the drawer, the Overview's app row and anything else that
* leads to one of these pages take their glyph from here. Change both tables
* together; navIcons.test.mjs checks they name the same icons.
*
* Imported deep, per icon, so the package tree-shakes (AGENTS.md › Gotchas).
* Totems keep their own mark (assets/images/totems-icon.png).
*/
import React from 'react'
import type { LucideIcon, LucideProps } from 'lucide-react-native'
import LayoutDashboard from 'lucide-react-native/icons/layout-dashboard'
import Search from 'lucide-react-native/icons/search'
import MessagesSquare from 'lucide-react-native/icons/messages-square'
import CalendarCheck from 'lucide-react-native/icons/calendar-check'
import Inbox from 'lucide-react-native/icons/inbox'
import CodeXml from 'lucide-react-native/icons/code-xml'
import Server from 'lucide-react-native/icons/server'
import MessageCircle from 'lucide-react-native/icons/message-circle'
import Monitor from 'lucide-react-native/icons/monitor'
import KeyRound from 'lucide-react-native/icons/key-round'
import Settings from 'lucide-react-native/icons/settings'

/** Lucide's 2px stroke reads heavy at 20px; 1.75 matches the Tabler glyphs beside it, as on the web. */
const NAV_STROKE = 1.75

function nav(Icon: LucideIcon, name: string): React.ComponentType<LucideProps> {
const Glyph = ({ strokeWidth, ...props }: LucideProps) => <Icon {...props} strokeWidth={strokeWidth ?? NAV_STROKE} />
Glyph.displayName = `Nav${name}`
return Glyph
}

export const NAV_ICONS = {
overview: nav(LayoutDashboard, 'Overview'),
search: nav(Search, 'Search'),
chat: nav(MessagesSquare, 'Chat'),
productivity: nav(CalendarCheck, 'Productivity'),
inbox: nav(Inbox, 'Inbox'),
dev: nav(CodeXml, 'Dev'),
fleet: nav(Server, 'Fleet'),
messages: nav(MessageCircle, 'Messages'),
screen: nav(Monitor, 'Screen'),
cliproxy: nav(KeyRound, 'CLIProxy'),
settings: nav(Settings, 'Settings'),
}
11 changes: 6 additions & 5 deletions mobile/src/shell/AppDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ import { alpha, colors, textAlpha } from '../theme'
import { T } from '../ui/Text'
import { Badge, IconBtn, Press } from '../ui/kit'
import { FAB_TINT, GLASS, GlassButton, GlassGroup } from '../ui/glass'
import { Hi, Squares2X2Icon, Cog6ToothIcon, ChevronRightIcon } from '../lib/icons'
import { Hi, ChevronRightIcon } from '../lib/icons'
import { NAV_ICONS } from '../lib/navIcons'
import IconChevronDown from '@tabler/icons-react-native/dist/esm/icons/IconChevronDown.mjs'
import IconChevronUp from '@tabler/icons-react-native/dist/esm/icons/IconChevronUp.mjs'
import { useSettings } from '../lib/settings'
import { IconEdit, IconLayoutSidebarLeftCollapse, IconSearch } from '../lib/chat/icons'
import { IconEdit, IconLayoutSidebarLeftCollapse } from '../lib/chat/icons'
import { useInboxCount } from '../lib/useInboxCount'
import { useUnreadNotifications } from '../features/notifications/useUnread'
import ChatsNav, { DockedShelfButtons } from '../features/chat/ChatsNav'
Expand Down Expand Up @@ -98,7 +99,7 @@ export default function AppDrawer({ navigation }: DrawerContentComponentProps) {
<View style={st.head}>
<T brand size={17} style={{ flex: 1, letterSpacing: 2, textTransform: 'uppercase', paddingLeft: 10 }}>Totem</T>
<IconBtn
icon={IconSearch}
icon={NAV_ICONS.search}
size={20}
box={44}
label="Search"
Expand All @@ -112,7 +113,7 @@ export default function AppDrawer({ navigation }: DrawerContentComponentProps) {
<ScrollView style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: footH + 12 }} scrollIndicatorInsets={{ bottom: footH }} keyboardShouldPersistTaps="handled">
<View style={st.nav}>
<Press style={[st.item, onOverview && st.itemOn]} onPress={() => go(TAB_ROUTES.overview)} accessibilityRole="button" accessibilityLabel={`Overview${inboxOpen ? `, ${inboxOpen} in the inbox` : ''}${totemReports ? ", a totem's report is waiting" : ''}`}>
<Hi icon={Squares2X2Icon} size={20} color={onOverview ? colors.text : textAlpha(86)} />
<Hi icon={NAV_ICONS.overview} size={20} color={onOverview ? colors.text : textAlpha(86)} />
<T size={15.5} color={onOverview ? colors.text : textAlpha(86)} style={{ flex: 1 }}>Overview</T>
<Badge count={inboxOpen} />
{/* A totem's report waits: its Totems tile on the Overview has the same dot. */}
Expand Down Expand Up @@ -208,7 +209,7 @@ export default function AppDrawer({ navigation }: DrawerContentComponentProps) {
accessibilityLabel={unread > 0 ? `Settings, ${unread} unread ${unread === 1 ? 'notification' : 'notifications'}` : 'Settings'}
onPress={() => go(TAB_ROUTES.settings)}
>
<Hi icon={Cog6ToothIcon} size={22} color={onSettings ? colors.text : textAlpha(82)} />
<Hi icon={NAV_ICONS.settings} size={22} color={onSettings ? colors.text : textAlpha(82)} />
{unread > 0 ? <View style={st.badge} /> : null}
</GlassButton>
</GlassGroup>
Expand Down
1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@xterm/xterm": "^6.0.0",
"dompurify": "^3.4.16",
"highlight.js": "^11.10.0",
"lucide-react": "1.72.0",
"marked": "^12.0.2",
"marked-highlight": "^2.1.3",
"onnxruntime-web": "^1.30.0",
Expand Down
18 changes: 18 additions & 0 deletions web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 13 additions & 31 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,7 @@ import TaskCardHost from './work/TaskCard'
import { installTaskNav } from './work/card'
import HabitCheckin from './components/HabitCheckin'
import RunningChats from './chat/RunningChats'
import {
Hi,
Squares2X2Icon,
ChatBubbleLeftRightIcon,
ChatBubbleOvalLeftIcon,
ComputerDesktopIcon,
CalendarDaysIcon,
CircleStackIcon,
ShieldCheckIcon,
Cog6ToothIcon,
InboxArrowDownIcon,
CodeBracketIcon,
MagnifyingGlassIcon,
ChevronDownIcon,
EllipsisHorizontalIcon,
WrenchScrewdriverIcon,
ServerStackIcon,
KeyIcon,
} from './icons'
import { NAV_ICONS } from './navIcons'

interface TabDef {
id: string
Expand All @@ -73,15 +55,15 @@ interface TabDef {

// Primary sidebar tabs — the ones the owner reaches for most often.
const PRIMARY_TABS: TabDef[] = [
{ id: 'overview', label: 'Overview', icon: Squares2X2Icon },
{ id: 'search', label: 'Search', icon: MagnifyingGlassIcon },
{ id: 'chat', label: 'Chat', icon: ChatBubbleLeftRightIcon },
{ id: 'productivity', label: 'Productivity', icon: CalendarDaysIcon },
{ id: 'inbox', label: 'Inbox', icon: InboxArrowDownIcon },
{ id: 'overview', label: 'Overview', icon: NAV_ICONS.overview },
{ id: 'search', label: 'Search', icon: NAV_ICONS.search },
{ id: 'chat', label: 'Chat', icon: NAV_ICONS.chat },
{ id: 'productivity', label: 'Productivity', icon: NAV_ICONS.productivity },
{ id: 'inbox', label: 'Inbox', icon: NAV_ICONS.inbox },
// CI, reviews and runners across the repos in data/dev.json, plus outside alerts.
{ id: 'dev', label: 'Dev', icon: WrenchScrewdriverIcon },
{ id: 'dev', label: 'Dev', icon: NAV_ICONS.dev },
// The owner's machines: health, uptime, resources, power and its cost.
{ id: 'fleet', label: 'Fleet', icon: ServerStackIcon },
{ id: 'fleet', label: 'Fleet', icon: NAV_ICONS.fleet },
]

// No longer on the nav: Brain opens from the Overview's app row, Code is the last
Expand All @@ -93,16 +75,16 @@ const MORE_TABS: TabDef[] = []

// Messages from the Mac Totem runs on. Last on the rail, and only when the bridge
// says Apple data is on (APPLE_ENABLED on a Mac); the route works either way and
// explains itself. Chat's double bubble is taken, so this is the single oval.
const MESSAGES_TAB_DEF: TabDef = { id: 'messages', label: 'Messages', icon: ChatBubbleOvalLeftIcon }
// explains itself. Chat's two bubbles are taken, so this is the single round one.
const MESSAGES_TAB_DEF: TabDef = { id: 'messages', label: 'Messages', icon: NAV_ICONS.messages }

// The desktop of the machine Totem runs on (SCREEN_ENABLED). On the desktop rail
// only, never in the phone drawer; /screen on a phone explains itself.
const SCREEN_TAB_DEF: TabDef = { id: 'screen', label: 'Screen', icon: ComputerDesktopIcon }
const SCREEN_TAB_DEF: TabDef = { id: 'screen', label: 'Screen', icon: NAV_ICONS.screen }

// The logins CLIProxy pools (cliproxy/), on the rail only once the proxy is set up
// (CLIPROXY_URL and a key); /cliproxy explains itself either way.
const CLIPROXY_TAB_DEF: TabDef = { id: 'cliproxy', label: 'CLIProxy', icon: KeyIcon }
const CLIPROXY_TAB_DEF: TabDef = { id: 'cliproxy', label: 'CLIProxy', icon: NAV_ICONS.cliproxy }

// On the rail and in the drawer right after Chat, with a badge for reports waiting.
const TOTEMS_TAB_DEF: TabDef = { id: 'totems', label: 'Totems', icon: TotemsIcon }
Expand All @@ -114,7 +96,7 @@ const SETTINGS_TAB = 'settings'
// Pages drawn over a moving colour glow (glow.css). The chat, editors and the
// Totems scene keep a plain background.
const GLOW_TABS = new Set(['overview', 'productivity', 'inbox', 'search', 'messages', 'fleet', SETTINGS_TAB])
const SETTINGS_TAB_DEF: TabDef = { id: SETTINGS_TAB, label: 'Settings', icon: Cog6ToothIcon }
const SETTINGS_TAB_DEF: TabDef = { id: SETTINGS_TAB, label: 'Settings', icon: NAV_ICONS.settings }

// The bottom bar fits five items with a readable label under each; past that the
// row silently scrolled and the last tabs sat off the right edge where nothing
Expand Down
6 changes: 3 additions & 3 deletions web/src/chat/ChatsPanel.harness.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { createRoot } from 'react-dom/client'
import { ChatBubbleLeftRightIcon, Cog6ToothIcon } from '../icons'
import { NAV_ICONS } from '../navIcons'
import { MobileDrawer, SidePanel } from '../components/Shell'
import { syncThreads } from './store'
import { drafts } from './draftsWeb'
Expand All @@ -19,8 +19,8 @@ if (q.get('drafts')) {
drafts.write('c1', { text: 'Fictional unsent reply' }, home)
}
const noop = () => {}
const chat = { id: 'chat', label: 'Chat', icon: ChatBubbleLeftRightIcon }
const settings = { id: 'settings', label: 'Settings', icon: Cog6ToothIcon }
const chat = { id: 'chat', label: 'Chat', icon: NAV_ICONS.chat }
const settings = { id: 'settings', label: 'Settings', icon: NAV_ICONS.settings }

function Harness() {
if (q.get('phone')) {
Expand Down
Loading
Loading