diff --git a/AGENTS.md b/AGENTS.md index b77a2ee..ea5d8d2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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 `) 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/`, `lucide-react-native/icons/`), 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 diff --git a/mobile/AGENTS.md b/mobile/AGENTS.md index 47b042f..32a8e66 100644 --- a/mobile/AGENTS.md +++ b/mobile/AGENTS.md @@ -189,7 +189,9 @@ Use `npx expo install ` 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. diff --git a/mobile/package-lock.json b/mobile/package-lock.json index 56525e8..9ce6406 100644 --- a/mobile/package-lock.json +++ b/mobile/package-lock.json @@ -45,6 +45,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", @@ -5829,6 +5830,23 @@ "yallist": "^3.0.2" } }, + "node_modules/lucide-react-native": { + "version": "1.72.0", + "resolved": "https://registry.npmjs.org/lucide-react-native/-/lucide-react-native-1.72.0.tgz", + "integrity": "sha512-fa2hf61ytmHttppA90jATO96bzN2+5RKkvdmXKXyNM5FDkNjCQObs4WyAXFXzFzJRagrS8YBah8N9y9RVlDykA==", + "license": "ISC", + "peerDependencies": { + "@types/react": "*", + "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-native": "*", + "react-native-svg": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/makeerror": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", diff --git a/mobile/package.json b/mobile/package.json index bbe1201..6b6dd0d 100644 --- a/mobile/package.json +++ b/mobile/package.json @@ -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", diff --git a/mobile/src/features/overview/OverviewScreen.tsx b/mobile/src/features/overview/OverviewScreen.tsx index 69bedca..0ea4614 100644 --- a/mobile/src/features/overview/OverviewScreen.tsx +++ b/mobile/src/features/overview/OverviewScreen.tsx @@ -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' @@ -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. @@ -393,7 +393,7 @@ export default function OverviewScreen() { const B = ({ children }: { children: React.ReactNode }) => {children} 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: <>{inboxOpen} {inboxOpen === 1 ? 'proposal' : 'proposals'} waiting in your inbox, }) for (const j of failing.slice(0, 2)) attention.push({ diff --git a/mobile/src/lib/navIcons.test.mjs b/mobile/src/lib/navIcons.test.mjs new file mode 100644 index 0000000..511621c --- /dev/null +++ b/mobile/src/lib/navIcons.test.mjs @@ -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/`) + 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`) +}) diff --git a/mobile/src/lib/navIcons.tsx b/mobile/src/lib/navIcons.tsx new file mode 100644 index 0000000..de6a2e8 --- /dev/null +++ b/mobile/src/lib/navIcons.tsx @@ -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 { + const Glyph = ({ strokeWidth, ...props }: LucideProps) => + 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'), +} diff --git a/mobile/src/shell/AppDrawer.tsx b/mobile/src/shell/AppDrawer.tsx index 7d7b292..776b577 100644 --- a/mobile/src/shell/AppDrawer.tsx +++ b/mobile/src/shell/AppDrawer.tsx @@ -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' @@ -98,7 +99,7 @@ export default function AppDrawer({ navigation }: DrawerContentComponentProps) { Totem go(TAB_ROUTES.overview)} accessibilityRole="button" accessibilityLabel={`Overview${inboxOpen ? `, ${inboxOpen} in the inbox` : ''}${totemReports ? ", a totem's report is waiting" : ''}`}> - + Overview {/* A totem's report waits: its Totems tile on the Overview has the same dot. */} @@ -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)} > - + {unread > 0 ? : null} diff --git a/web/package.json b/web/package.json index d530c9e..4a75966 100644 --- a/web/package.json +++ b/web/package.json @@ -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", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index 7cd3897..356ab1e 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -59,6 +59,9 @@ importers: highlight.js: specifier: ^11.10.0 version: 11.11.1 + lucide-react: + specifier: 1.72.0 + version: 1.72.0(@types/react@18.3.31)(react@18.3.1) marked: specifier: ^12.0.2 version: 12.0.2 @@ -1485,6 +1488,15 @@ packages: lru-cache@5.1.1: resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} + lucide-react@1.72.0: + resolution: {integrity: sha512-fbF5i1GU8GODETa3Q7rXqrJrcx3iPYrQtxthom103zGx+Z0BGwKYAW9s+9435ohYJ7hQm0av0PoZcqI1CRwNrg==} + peerDependencies: + '@types/react': '*' + react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0 + peerDependenciesMeta: + '@types/react': + optional: true + lz-string@1.5.0: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} hasBin: true @@ -3080,6 +3092,12 @@ snapshots: dependencies: yallist: 3.1.1 + lucide-react@1.72.0(@types/react@18.3.31)(react@18.3.1): + dependencies: + react: 18.3.1 + optionalDependencies: + '@types/react': 18.3.31 + lz-string@1.5.0: {} magic-string@0.30.21: diff --git a/web/src/App.tsx b/web/src/App.tsx index aa9f847..8584df1 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -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 @@ -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 @@ -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 } @@ -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 diff --git a/web/src/chat/ChatsPanel.harness.tsx b/web/src/chat/ChatsPanel.harness.tsx index a4bb595..44b1888 100644 --- a/web/src/chat/ChatsPanel.harness.tsx +++ b/web/src/chat/ChatsPanel.harness.tsx @@ -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' @@ -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')) { diff --git a/web/src/cliproxy/CliproxyView.tsx b/web/src/cliproxy/CliproxyView.tsx index 120ebe5..76782d0 100644 --- a/web/src/cliproxy/CliproxyView.tsx +++ b/web/src/cliproxy/CliproxyView.tsx @@ -1,5 +1,6 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { AuthError } from '../api' +import { NAV_ICONS } from '../navIcons' import type { NavTarget } from '../router' import { useAiUsageLive } from '../useAiUsageLive' import { @@ -522,7 +523,7 @@ export default function CliproxyView({ onAuthError, onNavigate }: { onAuthError: const head = (
-

CLIProxy

+

CLIProxy

{overview?.configured ? `${accounts.length} login${accounts.length === 1 ? '' : 's'}${overview.url ? ` · ${(() => { try { return new URL(overview.url).host } catch { return overview.url } })()}` : ''}` diff --git a/web/src/components/OverviewView.tsx b/web/src/components/OverviewView.tsx index a21522b..37da0ca 100644 --- a/web/src/components/OverviewView.tsx +++ b/web/src/components/OverviewView.tsx @@ -16,13 +16,14 @@ import type { NavTarget } from '../router' import { pushError } from '../toast' import { IconArrowUp, IconChevronRight, IconRefresh, IconCalendarEvent, IconChecklist, IconFlame, IconTarget, - IconListCheck, IconBulb, IconMicrophone2, IconBrandGithub, IconBrain, IconHistory, IconWand, IconSettings, IconInbox, + IconListCheck, IconBulb, IconMicrophone2, IconBrain, IconHistory, IconWand, IconAlertTriangle, IconMapPin, IconPlus, IconMinus, IconMessageCircle, IconCheck, IconBolt, IconPlane, IconBeach, IconLuggage, } from './overview/icons' import { clock, dueDiff, dueLabel, periodTotal, startOfDay, until } from './overview/time' import './overview/overview.css' import { useOwnerName } from '../useOwnerName' +import { NAV_ICONS } from '../navIcons' import ChatAbout from '../chat/about/ChatAbout' import { goalsContext, habitMetricContext, habitsContext, scheduleContext, systemContext, tasksContext, type ChatContext } from '../chat/about/context' @@ -33,7 +34,8 @@ const JOBS_SECTION: NavTarget = { tab: 'totems' } type Tabler = React.ComponentType -// Everything Totem has, one tap away. Code, Brain, Logs and Studio are no longer +// Everything Totem has, one tap away. A page that is also on the rail wears the +// rail's glyph (navIcons.tsx). Code, Brain, Logs and Studio are no longer // in the side nav, so this row is the way in to them. const APPS: { id: string; label: string; icon: Tabler; to: NavTarget }[] = [ { id: 'todos', label: 'Tasks', icon: IconChecklist, to: { tab: 'productivity', app: 'todos' } }, @@ -43,11 +45,11 @@ const APPS: { id: string; label: string; icon: Tabler; to: NavTarget }[] = [ { id: 'lists', label: 'Lists', icon: IconListCheck, to: { tab: 'productivity', app: 'lists' } }, { id: 'recs', label: 'Recs', icon: IconBulb, to: { tab: 'productivity', app: 'recs' } }, { id: 'journal', label: 'Journal', icon: IconMicrophone2, to: { tab: 'productivity', app: 'journal' } }, - { id: 'dev', label: 'Dev', icon: IconBrandGithub, to: 'dev' }, + { id: 'dev', label: 'Dev', icon: NAV_ICONS.dev, to: 'dev' }, { id: 'brain', label: 'Brain', icon: IconBrain, to: 'brain' }, { id: 'logs', label: 'Activity', 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. @@ -450,7 +452,7 @@ export default function OverviewView({ onNavigate, onAuthError }: OverviewViewPr 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: <>{inboxOpen} {inboxOpen === 1 ? 'proposal' : 'proposals'} waiting in your inbox, }) for (const j of failing.slice(0, 2)) attention.push({ diff --git a/web/src/messages/MessagesView.tsx b/web/src/messages/MessagesView.tsx index 8c6210b..219c9d2 100644 --- a/web/src/messages/MessagesView.tsx +++ b/web/src/messages/MessagesView.tsx @@ -1,7 +1,8 @@ import React, { useCallback, useEffect, useRef, useState } from 'react' import { AuthError } from '../api' +import { NAV_ICONS } from '../navIcons' import { - Hi, ArrowPathIcon, ChatBubbleOvalLeftIcon, LockClosedIcon, MagnifyingGlassIcon, PencilSquareIcon, XMarkIcon, + Hi, ArrowPathIcon, LockClosedIcon, MagnifyingGlassIcon, PencilSquareIcon, XMarkIcon, } from '../icons' import { AppleError, appleEnabled, listChats, searchMessages, type AppleStatus, type ChatSummary, type SearchResult } from './api' import { listTime, previewText } from './format' @@ -45,7 +46,7 @@ export default function MessagesView({ status, onRefreshStatus, onAuthError, nar if (!status) return

Checking Messages on this Mac…

if (!appleEnabled(status)) { return ( - +

Totem reads Messages only when it runs on a Mac with APPLE_ENABLED=true set.

{status.detail &&

{status.detail}

}
@@ -55,7 +56,7 @@ export default function MessagesView({ status, onRefreshStatus, onAuthError, nar if (source?.state === 'no-access') return if (source?.state === 'missing' || source?.state === 'error') { return ( - +

{source.detail || 'Totem could not open the Messages database on this Mac.'}

diff --git a/web/src/navIcons.tsx b/web/src/navIcons.tsx new file mode 100644 index 0000000..33a5983 --- /dev/null +++ b/web/src/navIcons.tsx @@ -0,0 +1,61 @@ +/** + * The rail's glyphs, one per destination, from Lucide (T3 Code's icon set). + * + * Every place that leads to one of these pages (the rail, the phone drawer, the + * Overview's app row, a page's own heading) takes its glyph from here, so a page + * looks the same wherever it is offered. The iPhone app has the same table in + * mobile/src/lib/navIcons.tsx; change both together. + * + * Imported deep, per icon, so the package tree-shakes (AGENTS.md › Gotchas). + * Totems keep their own mark (components/TotemsIcon.tsx). + */ +import React from 'react' +import type { LucideIcon } from 'lucide-react' +import LayoutDashboard from 'lucide-react/icons/layout-dashboard' +import Search from 'lucide-react/icons/search' +import MessagesSquare from 'lucide-react/icons/messages-square' +import CalendarCheck from 'lucide-react/icons/calendar-check' +import Inbox from 'lucide-react/icons/inbox' +import CodeXml from 'lucide-react/icons/code-xml' +import Server from 'lucide-react/icons/server' +import MessageCircle from 'lucide-react/icons/message-circle' +import Monitor from 'lucide-react/icons/monitor' +import KeyRound from 'lucide-react/icons/key-round' +import Settings from 'lucide-react/icons/settings' + +type NavIcon = React.ComponentType> + +/** The rail draws at 21px, where Lucide's 2px stroke reads heavy; 1.75 matches the Tabler glyphs beside it. */ +const NAV_STROKE = 1.75 + +// Lucide takes `strokeWidth`; Tabler's wrapper (TI in chat/ui.tsx) passes a numeric +// `stroke`, which on a Lucide SVG would be read as a colour. Take either. +function nav(Icon: LucideIcon, name: string): NavIcon { + const Glyph = ({ stroke, strokeWidth, ...props }: React.SVGProps) => { + // Typed as a string, but TI hands Tabler's numeric stroke width through it. + const given: unknown = stroke + return ( + + ) + } + 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'), +} satisfies Record diff --git a/web/src/screen/ScreenView.tsx b/web/src/screen/ScreenView.tsx index e1362ca..ed8a8a3 100644 --- a/web/src/screen/ScreenView.tsx +++ b/web/src/screen/ScreenView.tsx @@ -10,6 +10,7 @@ import { forgetLogin, openLogin, rememberChoice, saveLogin, savedLogin, screenEnabled, sealLogin, setRememberChoice, type MacLogin, type ScreenStatus, } from './api' +import { NAV_ICONS } from '../navIcons' import './screen.css' // The desktop of the machine Totem runs on, through noVNC. The bridge only @@ -38,7 +39,7 @@ interface Props { export default function ScreenView({ status, onRefreshStatus, narrow }: Props) { if (narrow) { return ( - +

Open Totem on a laptop or desktop to see and control this machine's screen.

) @@ -46,7 +47,7 @@ export default function ScreenView({ status, onRefreshStatus, narrow }: Props) { if (!status) return

Checking the screen…

if (!screenEnabled(status)) { return ( - +

Totem shows its machine's screen only with SCREEN_ENABLED=true set.

{status.detail &&

{status.detail}

}
@@ -54,7 +55,7 @@ export default function ScreenView({ status, onRefreshStatus, narrow }: Props) { } if (status.viewer?.state !== 'ready') { return ( - + {status.viewer?.detail &&

{status.viewer.detail}

}