Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

collapse a phone sub-nav to icon links instead of a dropdown

[._.]/ Adam Eivy696155a21068
diff --git a/client/src/AGENTS.md b/client/src/AGENTS.md
index 8b0b434b8c..5637da4746 100644
--- a/client/src/AGENTS.md
+++ b/client/src/AGENTS.md
@@ -10,6 +10,10 @@ These apply to React/Vite client code. Universal constraints (functional program
- **A shared primitive that bakes in `inline-flex` must yield it to a caller's own display utility.** Tailwind v4 emits display utilities in alphabetical order, so `.inline-flex` lands AFTER `.hidden` in the stylesheet and wins at equal specificity: a `<Pill className="hidden sm:inline-flex">` stayed visible at every width, and the responsive variant it was paired with did nothing. `Pill` handles this (see `OWN_DISPLAY` in `components/ui/Pill.jsx`); `InfoTooltip`, `CopyableId`, and `ProvenanceChip` still interpolate `className` after a hardcoded `inline-flex` and need the same treatment the first time one of them is given a `hidden md:` call site. Primitives baking `flex`/`grid` are not exposed — those sort BEFORE `.hidden` and lose to it correctly.
- **A fixed-width popover carries a viewport clamp** - an absolutely-positioned panel whose width is fixed at 256px or more (`w-64` and up, or the same size as an arbitrary `w-[19rem]`) must also carry `max-w-[calc(100vw-1rem)]`. `Layout`'s root shell is `overflow-x-hidden`, so anything wider than the viewport is *clipped away*, not made scrollable: a `w-96` filter panel anchored `right-3` on a 360px phone puts its whole left column of controls permanently off-screen with nothing to scroll to. The `calc(100vw-1rem)` form (not `90vw`) is the standard because it holds an 8px gutter at every width instead of a proportional one that collapses on small screens. Enforced tree-wide by `client/src/popoverClampConventions.test.js`.
- **Size form fields for their content.** Short selects, numeric inputs, and related settings should share rows when the container has room, then stack on narrow screens or drawers. Prefer wrapping grids with bounded columns (for example `grid-cols-[repeat(auto-fit,minmax(min(100%,18rem),24rem))]`) over full-page-width controls. Keep labels and help text with their fields, preserve DOM/tab order, and leave prose editors and long paths room to work. Avoid global input width limits; compact toolbars and narrow panels have different needs.
+- **A sub-nav that doesn't fit a phone collapses to ICON LINKS, not a `<select>`** - this is a stated product preference, not a judgement call to re-make per page: a dropdown reads as a form control and hides where you are behind a tap, while an icon row still looks and behaves like navigation and keeps every destination one tap away. Pass `mobileCompact` to `TabPills` and it renders the same tab buttons icon-only below `sm` (label kept as `max-sm:sr-only`, so the accessible name never changes) with a chevron at whichever edge is still scrollable. `RouteTabsHeader` decides *whether* to collapse (past `MOBILE_COMPACT_THRESHOLD` tabs); `TabPills` decides *how*. #7283 made the `<select>` universal and was reverted — don't reintroduce it as "consistency". Corollaries:
+ - **Every tab in a fixed set of sections needs an icon, and no two in one bar may share one.** One iconless tab drops the whole bar back to the `<select>`, and on a phone the icon is all the user sees, so a repeated glyph is a repeated destination. Section tabs get theirs from the sidebar registry via `buildSectionNavTabs(getSectionNavTabs(s), NAV_PRESENTATION, s)`, which **throws** on a missing one; `client/src/lib/navPresentation.test.js` pins coverage and uniqueness for every section.
+ - **The `<select>` fallback is for lists icons can't serve** — an unbounded, data-driven one where every entry would draw the same glyph (FableLoomStory's episode list). Not for a fixed set of sections someone hasn't given icons yet. Unbounded *record pickers* that happen to be `<select>`s (the account switchers in `pages/X.jsx`, `pages/StackerNews.jsx`) are not sub-navs and are out of scope.
+ - **Not yet enforced tree-wide.** Several hand-rolled tab strips still bypass `TabPills` (`components/apps/AppDetailView.jsx`'s 15-tab scroller, `pages/SystemHealthPage.jsx`, `pages/Sharing.jsx`, `components/writers-room/WorkEditor.jsx`'s `MobileTab`, …) — converting them and adding a `subNavConventions.test.js` is tracked in #7359. Until then, **reuse `TabPills`; never roll a new tab bar.**
- **Above the fold** - keep actionable content and info above the fold and design pages for maximum information and access without scrolling
- **No hardcoded localhost** - use `window.location.hostname` for URLs; app accessed via Tailscale remotely
- **Chrome floating over media uses `.port-media-overlay`** - a label, status bar, badge, or control panel sitting on top of an image, a video, or a 3D canvas takes its surface and ink from the theme (`.port-media-overlay`, or `.port-media-overlay-strong` for a small label directly on photography; `.port-media-overlay-item` for its buttons, `.port-media-overlay-divider` for its separators — all defined in `index.css`, which carries the mechanism and the rule for picking between this, `.always-dark`, and the OpenWorld HUD remap). **Don't write `bg-black/NN` + `text-white`/`text-gray-N00` for this** — day mode remaps the text to the theme's dark ink while the black scrim stays black, so the label renders dark-on-black. Older overlays outside the 3D/Three.js pages still carry that idiom (migration tracked in #3796), so match the new convention rather than the nearest neighbor.
@@ -43,7 +47,7 @@ For the full "adding a new page" checklist (nav manifest entry shape, palette ac
- **Size.** Pass `size` (`sm` 520px · `md` 640px · `lg` 720→880px · `xl` up to 1100px). Widen for genuinely large forms so they can lay out in columns on desktop; keep small dialogs at `sm`. Mobile is always `w-full` (full-screen sheet) regardless of `size` — mobile-responsive is non-negotiable. `widthClass` is a back-compat escape hatch that overrides `size`.
- **When to tab.** A large config surface (many fields / logical groups, e.g. Edit App's ~25 fields) should group its fields into `tabs={[{ id, label, icon?, count? }]}` + `activeTab` / `onTabChange` and render only the active tab's fields as `children` — not one page-length scroll. A *medium* form that should stay fully visible above the fold uses the child's own labeled sections instead (e.g. `ImageGenSettingsForm`'s `grouped` prop in the pipeline image-gen drawers), because tabs hide inactive fields behind a click.
- **Per-tab scroll.** The drawer gives each tab its own scroll region that resets on switch (`key={currentTab}` remounts the panel) — so no single tab is ever page-length. Because the body remounts per tab, **all mutable form state must live above the Drawer body** in the parent component, never in an uncontrolled input inside the form, or it resets on tab switch (see `EditAppDrawer.jsx`'s state-hoisting comment). Validate fields on tabs that may be unmounted at Save time explicitly, and `setActiveTab()` to the offending tab to surface the error.
- - **Mobile `<select>` fallback + `TabPills`.** The tab bar is `client/src/components/ui/TabPills.jsx` (`mobileDropdown` collapses it to a `<select>` under `sm`) — **reuse it, never roll a new tab bar.** The `Drawer tabs` layout wires TabPills for you; a surface hosted in *both* a drawer and a page (like `ImageGenTab`) renders its own internal `<TabPills variant="pills" mobileDropdown>` instead so the same grouping works in either host.
+ - **Mobile collapse + `TabPills`.** The tab bar is `client/src/components/ui/TabPills.jsx` (`mobileCompact` collapses it under `sm`) — **reuse it, never roll a new tab bar.** The `Drawer tabs` layout wires TabPills for you; a surface hosted in *both* a drawer and a page (like `ImageGenTab`) renders its own internal `<TabPills variant="pills" mobileCompact>` instead so the same grouping works in either host. See the sub-nav rule below for what `mobileCompact` renders.
- **Deep-linkable active tab.** Drive `activeTab` from a URL search param via `useDrawerTab(paramName, defaultTab, tabIds)` (`client/src/hooks/useDrawerTab.js`) so the open section is shareable/bookmarkable/reload-safe — the same "URL is the source of truth for what's open" rule as routed views. The caller owns the param name (`appTab`, `mediaTab`, …) so a page can host more than one drawer; pass the id list so a stale deep link degrades to `defaultTab` instead of a blank panel.
- **Long-lived forms** opt out of accidental dismissal with `closeOnEsc={false}` / `closeOnBackdrop={false}` so an Esc keystroke mid-edit doesn't discard the form.
- **The overlay is always portaled to `<body>` — never re-nest it.** The backdrop and panel are both `position:fixed`, and a `filter` / `backdrop-filter` / `transform` ancestor becomes their containing block; on the "glass" themes `index.css` gives every bordered/rounded `.bg-port-card` a `backdrop-filter`, so an inline drawer nested under a card was sized to the *card*, not the viewport (issue #4150). Portaling is unconditional rather than an opt-in flag, so no call site has to remember it — React still routes events and context through the React tree. The one thing the portal leaves behind is a **page-scoped CSS theming root written as descendant selectors** (`.openworld-themed` in `index.css`): a caller inside one must pass that class as `portalClassName` (see `OpenWorldSettingsDrawer.jsx`). Same trap, same fix, for any new hand-rolled `fixed inset-0` overlay — portal it (`Modal`'s `usePortal`, `GalleryImagePicker.jsx`).
diff --git a/client/src/components/Drawer.jsx b/client/src/components/Drawer.jsx
index dbfeb4c96d..03d9d987e8 100644
--- a/client/src/components/Drawer.jsx
+++ b/client/src/components/Drawer.jsx
@@ -134,7 +134,7 @@ export default function Drawer({
tabs={tabList}
activeTab={currentTab}
onChange={changeTab}
- mobileDropdown
+ mobileCompact
mobileSelectId="drawer-tab-select"
ariaLabel={title ? `${title} sections` : 'Sections'}
controlsIdPrefix="drawer-tabpanel"
diff --git a/client/src/components/Drawer.test.jsx b/client/src/components/Drawer.test.jsx
index 6e4734d116..8d9092e667 100644
--- a/client/src/components/Drawer.test.jsx
+++ b/client/src/components/Drawer.test.jsx
@@ -108,7 +108,7 @@ describe('Drawer', () => {
it('renders the mobile <select> fallback for tabbed drawers', () => {
// The drawer uses the default underline variant; the mobile <select>
// collapse must still render (regression guard for the variant-agnostic
- // mobileDropdown wiring).
+ // mobileCompact wiring).
render(<Drawer open onClose={() => {}} title="X" tabs={TABS} activeTab="ports" onTabChange={() => {}}>body</Drawer>);
const select = screen.getByRole('combobox');
expect(select).toHaveAttribute('id', 'drawer-tab-select');
diff --git a/client/src/components/apps/EditAppDrawer.jsx b/client/src/components/apps/EditAppDrawer.jsx
index 5c294ce95a..4c764381eb 100644
--- a/client/src/components/apps/EditAppDrawer.jsx
+++ b/client/src/components/apps/EditAppDrawer.jsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useCallback } from 'react';
import { Link } from 'react-router';
-import { BarChart3, GitBranch, GitPullRequest, Lock, Copy, ShieldCheck } from 'lucide-react';
+import { BarChart3, Brain, GitBranch, GitPullRequest, Info, Lock, Copy, Network, ShieldCheck, SquareTerminal, ToggleLeft } from 'lucide-react';
import IconPicker from '../IconPicker';
import * as api from '../../services/api';
import { PORTOS_APP_ID } from '../../services/apiCore';
@@ -28,12 +28,12 @@ import { useInstanceFeatures } from '../../hooks/useInstanceFeatures.js';
// per-app feature visibility overrides; it never sends a `jira` key, so saving
// an unrelated field cannot clobber the detail tab's configuration.
const TABS = [
- { id: 'general', label: 'General' },
- { id: 'ports', label: 'Ports & TLS' },
- { id: 'commands', label: 'Commands' },
- { id: 'workflow', label: 'Workflow' },
- { id: 'intelligence', label: 'Intelligence' },
- { id: 'features', label: 'Features' }
+ { id: 'general', label: 'General', icon: Info },
+ { id: 'ports', label: 'Ports & TLS', icon: Network },
+ { id: 'commands', label: 'Commands', icon: SquareTerminal },
+ { id: 'workflow', label: 'Workflow', icon: GitBranch },
+ { id: 'intelligence', label: 'Intelligence', icon: Brain },
+ { id: 'features', label: 'Features', icon: ToggleLeft }
];
const TAB_IDS = TABS.map(t => t.id);
diff --git a/client/src/components/cos/tabs/MindTab.jsx b/client/src/components/cos/tabs/MindTab.jsx
index b59a87af05..17403c477f 100644
--- a/client/src/components/cos/tabs/MindTab.jsx
+++ b/client/src/components/cos/tabs/MindTab.jsx
@@ -922,7 +922,7 @@ export default function MindTab() {
closeOnBackdrop={false}
>
<div className="mb-4">
- <TabPills tabs={MIND_PANEL_TABS} activeTab={activePanel || 'context'} onChange={openPanel} variant="pills" size="sm" mobileDropdown ariaLabel="Mind workspace sections" />
+ <TabPills tabs={MIND_PANEL_TABS} activeTab={activePanel || 'context'} onChange={openPanel} variant="pills" size="sm" mobileCompact ariaLabel="Mind workspace sections" />
</div>
{(visitedPanels.has('context') || activePanel === 'context') && <div hidden={activePanel !== 'context'} className="space-y-4">
<PersistentMindRuntimePanel runtime={runtime} error={runtimeError} loading={runtimeLoading} />
diff --git a/client/src/components/creative-director/VideoDraftDrawer.jsx b/client/src/components/creative-director/VideoDraftDrawer.jsx
index 5a6f63fa3f..636eb949b9 100644
--- a/client/src/components/creative-director/VideoDraftDrawer.jsx
+++ b/client/src/components/creative-director/VideoDraftDrawer.jsx
@@ -11,8 +11,9 @@ import { listCatalogIngredients } from '../../services/apiCatalog.js';
import { listMusicEngines } from '../../services/apiMusic.js';
import { listTracks } from '../../services/apiTracks.js';
import { listVideoModels } from '../../services/apiImageVideo.js';
+import { Clapperboard, FileText, Library } from 'lucide-react';
-const TABS = [{ id: 'brief', label: 'Brief' }, { id: 'production', label: 'Production' }, { id: 'sources', label: 'Sources' }];
+const TABS = [{ id: 'brief', label: 'Brief', icon: FileText }, { id: 'production', label: 'Production', icon: Clapperboard }, { id: 'sources', label: 'Sources', icon: Library }];
const fieldClass = 'w-full mt-1 bg-port-bg border border-port-border rounded px-2 py-2 text-sm';
export default function VideoDraftDrawer({ open, onClose, project, onSaved, catalogIngredientIds = [] }) {
diff --git a/client/src/components/digital-twin/SectionNav.jsx b/client/src/components/digital-twin/SectionNav.jsx
index 55ded1bb3d..c68dbcbf0b 100644
--- a/client/src/components/digital-twin/SectionNav.jsx
+++ b/client/src/components/digital-twin/SectionNav.jsx
@@ -7,17 +7,13 @@
// every existing deep link keeps resolving and there is no second source of
// truth for "what is open".
//
-// Mobile is the case the issue measured: below `sm` the whole thing collapses
-// to ONE grouped `<select>` (~40px, no horizontal scanning) instead of a
-// 19-wide scrolling strip, which is what buys the fold back. TabPills'
-// `mobileDropdown` can't serve this — it renders a flat option list, and the
-// grouping is the entire point — so the select is spelled out here with
-// `<optgroup>` headers.
+// The grouping is also what makes this fit a phone: `mobileCompact` collapses
+// each row to icons below `sm`, and because only the active group's sections
+// render, that is five group icons over at most six section icons — never the
+// 19-wide scroll the groups were introduced to kill.
import TabPills from '../ui/TabPills';
import { SECTION_GROUPS, groupSections, sectionGroupId } from './constants';
-const SELECT_ID = 'digital-twin-section-select';
-
export default function SectionNav({ activeSection, onChange }) {
const activeGroupId = sectionGroupId(activeSection);
const activeGroup = SECTION_GROUPS.find((g) => g.id === activeGroupId);
@@ -31,42 +27,24 @@ export default function SectionNav({ activeSection, onChange }) {
};
return (
- <>
- <div className="sm:hidden shrink-0 border-b border-port-border p-2">
- <label htmlFor={SELECT_ID} className="sr-only">Digital Twin section</label>
- <select
- id={SELECT_ID}
- value={activeSection}
- onChange={(e) => onChange(e.target.value)}
- className="w-full bg-port-card border border-port-border rounded px-3 py-2 text-white text-sm focus:outline-none focus:border-port-accent min-h-[40px]"
- >
- {SECTION_GROUPS.map((group) => (
- <optgroup key={group.id} label={group.label}>
- {groupSections(group).map((t) => (
- <option key={t.id} value={t.id}>{t.label}</option>
- ))}
- </optgroup>
- ))}
- </select>
- </div>
-
- <div className="hidden sm:block shrink-0">
- <TabPills
- tabs={SECTION_GROUPS}
- activeTab={activeGroupId}
- onChange={handleGroupChange}
- ariaLabel="Digital Twin groups"
- />
- <TabPills
- tabs={sections}
- activeTab={activeSection}
- onChange={onChange}
- variant="pills"
- size="sm"
- ariaLabel={`${activeGroup.label} sections`}
- className="m-2"
- />
- </div>
- </>
+ <div className="shrink-0">
+ <TabPills
+ tabs={SECTION_GROUPS}
+ activeTab={activeGroupId}
+ onChange={handleGroupChange}
+ mobileCompact
+ ariaLabel="Digital Twin groups"
+ />
+ <TabPills
+ tabs={sections}
+ activeTab={activeSection}
+ onChange={onChange}
+ variant="pills"
+ size="sm"
+ mobileCompact
+ ariaLabel={`${activeGroup.label} sections`}
+ className="m-2"
+ />
+ </div>
);
}
diff --git a/client/src/components/digital-twin/SectionNav.test.jsx b/client/src/components/digital-twin/SectionNav.test.jsx
index 254e46caab..5cb8e3a277 100644
--- a/client/src/components/digital-twin/SectionNav.test.jsx
+++ b/client/src/components/digital-twin/SectionNav.test.jsx
@@ -91,19 +91,18 @@ describe('SectionNav', () => {
expect(onChange).toHaveBeenCalledWith('interview');
});
- it('collapses to one labelled, grouped select on mobile that reaches every section', () => {
- const onChange = vi.fn();
- render(<SectionNav activeSection="overview" onChange={onChange} />);
- const select = screen.getByLabelText('Digital Twin section');
- expect(select.tagName).toBe('SELECT');
- expect(select.value).toBe('overview');
-
- const optgroups = [...select.querySelectorAll('optgroup')];
- expect(optgroups.map((g) => g.label)).toEqual(SECTION_GROUPS.map((g) => g.label));
- expect([...select.querySelectorAll('option')].map((o) => o.value).sort())
- .toEqual(TABS.map((t) => t.id).sort());
-
- fireEvent.change(select, { target: { value: 'legacy' } });
- expect(onChange).toHaveBeenCalledWith('legacy');
+ it('collapses both rows to icon links on mobile rather than a select', () => {
+ render(<SectionNav activeSection="overview" onChange={() => {}} />);
+ expect(screen.queryByRole('combobox')).toBeNull();
+
+ // Compact mode hides each label visually below `sm` but keeps it in the
+ // accessible name, so the icon row is still one tablist of named tabs.
+ for (const row of ['Digital Twin groups', 'Profile sections']) {
+ for (const tab of within(screen.getByRole('tablist', { name: row })).getAllByRole('tab')) {
+ expect(tab.querySelector('svg')).toBeTruthy();
+ expect(tab.querySelector('.max-sm\\:sr-only')).toBeTruthy();
+ }
+ }
+ expect(groupTab('Profile')).toHaveAccessibleName('Profile');
});
});
diff --git a/client/src/components/fableloom/LoomSeriesPlan.jsx b/client/src/components/fableloom/LoomSeriesPlan.jsx
index fc4f07bd00..664f259e83 100644
--- a/client/src/components/fableloom/LoomSeriesPlan.jsx
+++ b/client/src/components/fableloom/LoomSeriesPlan.jsx
@@ -8,7 +8,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
import { Link } from 'react-router';
import TabPills from '../ui/TabPills';
import useDrawerTab from '../../hooks/useDrawerTab';
-import { BrainCircuit, CheckCircle2, ChevronDown, ChevronUp, Loader2, Plus, Save, Sparkles, Trash2 } from 'lucide-react';
+import { BrainCircuit, CheckCircle2, ChevronDown, ChevronUp, Compass, Film, Loader2, Map as MapIcon, Plus, Save, Send, Sparkles, Swords, Trash2, Users } from 'lucide-react';
import ConfirmButtonPair from '../ui/ConfirmButtonPair';
import toast from '../ui/Toast';
import { FormField } from '../ui/FormField.jsx';
@@ -34,13 +34,13 @@ import SeriesDesignEditor from '../pipeline/arcCanvas/SeriesDesignEditor.jsx';
import { EVOLUTION_STAGES, isDeclaredEvolution } from '../../lib/characterEvolution.js';
const PLAN_SECTIONS = [
- { id: 'arc', label: 'Story arc' },
- { id: 'challenges', label: 'Plot & challenges' },
- { id: 'quests', label: 'Side quests' },
- { id: 'cast', label: 'Cast evolution' },
- { id: 'episodes', label: 'Episode outlines' },
- { id: 'editorial', label: 'AI editor' },
- { id: 'handoffs', label: 'Viewer handoffs' },
+ { id: 'arc', label: 'Story arc', icon: MapIcon },
+ { id: 'challenges', label: 'Plot & challenges', icon: Swords },
+ { id: 'quests', label: 'Side quests', icon: Compass },
+ { id: 'cast', label: 'Cast evolution', icon: Users },
+ { id: 'episodes', label: 'Episode outlines', icon: Film },
+ { id: 'editorial', label: 'AI editor', icon: BrainCircuit },
+ { id: 'handoffs', label: 'Viewer handoffs', icon: Send },
];
const newItemId = (prefix) => `${prefix}-${uuidv4()}`;
@@ -204,7 +204,7 @@ export default function LoomSeriesPlan({ loom, universe, onLoomUpdate }) {
{saving ? <Loader2 size={14} className="animate-spin" /> : <Save size={14} />}{saving ? 'Saving…' : 'Save plan'}
</button>
</div>
- <TabPills tabs={PLAN_SECTIONS} activeTab={requestedSection} onChange={setSection} mobileDropdown ariaLabel="Series plan section" controlsIdPrefix="series-section" />
+ <TabPills tabs={PLAN_SECTIONS} activeTab={requestedSection} onChange={setSection} mobileCompact ariaLabel="Series plan section" controlsIdPrefix="series-section" />
</div>
<div ref={contentRef} className="min-h-0 flex-1 overflow-y-auto p-4 md:p-6">
<div className="max-w-5xl mx-auto">
diff --git a/client/src/components/fableloom/LoomValidationPanel.jsx b/client/src/components/fableloom/LoomValidationPanel.jsx
index 929f941c41..affd1d7a22 100644
--- a/client/src/components/fableloom/LoomValidationPanel.jsx
+++ b/client/src/components/fableloom/LoomValidationPanel.jsx
@@ -143,8 +143,7 @@ export default function LoomValidationPanel({
variant="underline"
size="xs"
stretch
- mobileDropdown
- mobileSelectId="fableloom-workflow-section"
+ mobileCompact
ariaLabel="Episode production sections"
/>
diff --git a/client/src/components/music/MusicDesigner.jsx b/client/src/components/music/MusicDesigner.jsx
index 72db313adb..f2203c4816 100644
--- a/client/src/components/music/MusicDesigner.jsx
+++ b/client/src/components/music/MusicDesigner.jsx
@@ -288,8 +288,7 @@ export default function MusicDesigner() {
tabs={STEPS}
activeTab={step}
onChange={goTo}
- mobileDropdown
- mobileSelectId="music-designer-step"
+ mobileCompact
ariaLabel="Music designer steps"
/>
diff --git a/client/src/components/providers/ProviderForm.jsx b/client/src/components/providers/ProviderForm.jsx
index cc7d56af9a..86bb9ae676 100644
--- a/client/src/components/providers/ProviderForm.jsx
+++ b/client/src/components/providers/ProviderForm.jsx
@@ -1,6 +1,6 @@
import { hardwareUnavailableReason } from '../../utils/systemCapabilities';
import { useState } from 'react';
-import { AlertTriangle } from 'lucide-react';
+import { AlertTriangle, Braces, Cpu, Plug, SlidersHorizontal } from 'lucide-react';
import toast from '../ui/Toast';
import * as api from '../../services/api';
import { filterHardwareCompatibleProviderModels, filterGenerationModels, isEmbeddingModel, isProviderHardwareCompatible, isProviderModelHardwareCompatible, mergeModelLists, configuredDefaultIn, localBackendForProvider, modelOptionLabel, isProcessProvider, isLocalEndpoint, effectiveModelContextWindow, isRunnerAllowedCommand, effortLevelsForProvider, isOllamaBackedProvider, gatewayForProvider, isClaudeCommandProvider, generationControlsFor, isCodexProvider } from '../../utils/providers';
@@ -23,10 +23,10 @@ import { GatewayKeyHint } from './ProviderNotices';
// /ai/edit/:providerId deep link opens on the identity/transport fields; the
// others are reachable as /ai/edit/:providerId?providerTab=<id>.
const PROVIDER_FORM_TABS = [
- { id: 'connection', label: 'Connection' },
- { id: 'models', label: 'Models' },
- { id: 'generation', label: 'Generation' },
- { id: 'environment', label: 'Environment' },
+ { id: 'connection', label: 'Connection', icon: Plug },
+ { id: 'models', label: 'Models', icon: Cpu },
+ { id: 'generation', label: 'Generation', icon: SlidersHorizontal },
+ { id: 'environment', label: 'Environment', icon: Braces },
];
const PROVIDER_FORM_TAB_IDS = PROVIDER_FORM_TABS.map(t => t.id);
diff --git a/client/src/components/settings/ImageGenTab.jsx b/client/src/components/settings/ImageGenTab.jsx
index b032f3d5c4..5279f9a0a0 100644
--- a/client/src/components/settings/ImageGenTab.jsx
+++ b/client/src/components/settings/ImageGenTab.jsx
@@ -9,7 +9,7 @@
import { useState, useEffect, useCallback, useId, useRef } from 'react';
import {
Save, Image as ImageIcon, Zap, Wrench, Cloud, Cpu, Globe, AlertTriangle,
- Sparkles, Terminal, Key, Check, Trash2, SlidersHorizontal
+ Sparkles, Terminal, Key, Check, Trash2, SlidersHorizontal, Bot, FlaskConical
} from 'lucide-react';
import toast from '../ui/Toast';
import FormField from '../ui/FormField';
@@ -71,11 +71,11 @@ export const MEDIA_TABS = [
{ id: 'external', label: 'External', icon: Cloud, probeMode: IMAGE_GEN_MODE.EXTERNAL },
{ id: 'local', label: 'Local', icon: Cpu, probeMode: IMAGE_GEN_MODE.LOCAL },
{ id: 'codex', label: 'Codex CLI', icon: Terminal, probeMode: IMAGE_GEN_MODE.CODEX },
- { id: 'grok', label: 'Grok CLI', icon: Sparkles, probeMode: IMAGE_GEN_MODE.GROK },
- { id: 'agy', label: 'Agy CLI', icon: Terminal, probeMode: IMAGE_GEN_MODE.AGY },
+ { id: 'grok', label: 'Grok CLI', icon: Zap, probeMode: IMAGE_GEN_MODE.GROK },
+ { id: 'agy', label: 'Agy CLI', icon: Bot, probeMode: IMAGE_GEN_MODE.AGY },
{ id: 'tokens', label: 'Tokens', icon: Key },
{ id: 'expose', label: 'Expose', icon: Globe },
- { id: 'test', label: 'Test', icon: Sparkles },
+ { id: 'test', label: 'Test', icon: FlaskConical },
];
const MEDIA_TAB_IDS = MEDIA_TABS.map((t) => t.id);
@@ -716,8 +716,7 @@ export function ImageGenTab() {
activeTab={mediaTab}
onChange={setMediaTab}
variant="pills"
- mobileDropdown
- mobileSelectId="media-settings-tab-select"
+ mobileCompact
ariaLabel="Media generation settings sections"
controlsIdPrefix="media-settings-tabpanel"
/>
diff --git a/client/src/components/settings/LocalLlmTab.jsx b/client/src/components/settings/LocalLlmTab.jsx
index b96c7a710e..36b69ffec7 100644
--- a/client/src/components/settings/LocalLlmTab.jsx
+++ b/client/src/components/settings/LocalLlmTab.jsx
@@ -37,8 +37,7 @@ export function LocalLlmTab({ view }) {
onChange={(nextView) => navigate(`/models/llms/${nextView}`)}
variant="pills"
size="sm"
- mobileDropdown
- mobileSelectId="llm-management-view"
+ mobileCompact
ariaLabel="LLM management sections"
controlsIdPrefix="llm-management-panel"
/>
diff --git a/client/src/components/ui/README.md b/client/src/components/ui/README.md
index 711c6216ef..3682d50317 100644
--- a/client/src/components/ui/README.md
+++ b/client/src/components/ui/README.md
@@ -36,7 +36,7 @@ accessibility). Feature-specific components live under their own feature directo
| `ProvenanceChip` | Chip + popover showing where a generated value came from. |
| `SideBySideDiff` | Columnar word-level diff — old left, new right. |
| `Skeleton` | Loading-placeholder primitives (`SkeletonBlock` / `Lines` / `Card` / `Rows` / `Region`) — what `PageSkeleton` is built from, and what a sub-region loader should reserve its shape with instead of a bare spinner. |
-| `TabPills` | Shared tab nav — `underline` / `pills` / `filter` (toggle chips) families, with a mobile `<select>` fallback. |
+| `TabPills` | Shared tab nav — `underline` / `pills` / `filter` (toggle chips) families; `mobileCompact` collapses it to an icon row under `sm` (labelled `<select>` when a tab has no icon). |
| `Toast` | Toast notification system (`toast()`, `.success()`, `.error()`, `.loading()`, `<Toaster />`). |
| `ToggleChip` | Checkbox styled as a pill — the "pick some of these" affordance. |
| `ToolUseWarning` | The "this model can't call tools" warning every agent/model picker shows. |
diff --git a/client/src/components/ui/RouteTabsHeader.jsx b/client/src/components/ui/RouteTabsHeader.jsx
index 54aeacf041..1275b0f833 100644
--- a/client/src/components/ui/RouteTabsHeader.jsx
+++ b/client/src/components/ui/RouteTabsHeader.jsx
@@ -1,9 +1,10 @@
import { useNavigate } from 'react-router';
import TabPills from './TabPills';
-// Above this many tabs, a phone-width pill row is a horizontal scroll nobody
-// finds the far end of. Six fits 375px; larger sections such as Models do not.
-const MOBILE_DROPDOWN_THRESHOLD = 6;
+// Above this many tabs, a phone-width pill row with labels no longer fits, so
+// the bar collapses to TabPills' compact treatment. Six fits 375px; larger
+// sections such as Models do not.
+const MOBILE_COMPACT_THRESHOLD = 6;
const selectIdFor = (ariaLabel) => `${String(ariaLabel || 'section').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '')}-select`;
@@ -21,19 +22,20 @@ const selectIdFor = (ariaLabel) => `${String(ariaLabel || 'section').toLowerCase
* whose `to` lives outside their route prefix (Models → Playground) — the id
* still selects it, so the host page passes its own `activeTab`.
*
- * Past `MOBILE_DROPDOWN_THRESHOLD` tabs the bar collapses to a `<select>` under
- * `sm`. That is decided HERE rather than per section: every caller has the same
- * phone width and the same pill sizes, so leaving it to each one meant Settings
- * (19 tabs) kept scrolling horizontally while Models (9) collapsed. The select's
- * id is derived from `ariaLabel` for the same reason — a caller that passed
- * `mobileDropdown` but forgot the id silently downgraded from a real
- * `<label htmlFor>` to a bare aria-label, and nothing failed.
+ * Past `MOBILE_COMPACT_THRESHOLD` tabs the bar collapses under `sm` — to an
+ * icon-only row, or to a `<select>` when the tabs have no icons. That is decided
+ * HERE rather than per section: every caller has the same phone width and the
+ * same pill sizes, so leaving it to each one meant Settings (19 tabs) kept
+ * scrolling horizontally while Models (9) collapsed. The select fallback's id is
+ * derived from `ariaLabel` for the same reason — a caller that passed the flag
+ * but forgot the id silently downgraded from a real `<label htmlFor>` to a bare
+ * aria-label, and nothing failed.
*
* @param {{ tabs: Array<{id:string,label:string,to:string}>, activeTab: string, ariaLabel: string }} props
*/
export default function RouteTabsHeader({ tabs, activeTab, ariaLabel }) {
const navigate = useNavigate();
- const mobileDropdown = tabs.length > MOBILE_DROPDOWN_THRESHOLD;
+ const mobileCompact = tabs.length > MOBILE_COMPACT_THRESHOLD;
const handleChange = (tabId) => {
const target = tabs.find((t) => t.id === tabId);
@@ -46,8 +48,8 @@ export default function RouteTabsHeader({ tabs, activeTab, ariaLabel }) {
activeTab={activeTab}
onChange={handleChange}
ariaLabel={ariaLabel}
- mobileDropdown={mobileDropdown}
- mobileSelectId={mobileDropdown ? selectIdFor(ariaLabel) : undefined}
+ mobileCompact={mobileCompact}
+ mobileSelectId={selectIdFor(ariaLabel)}
className="w-full min-w-0 shrink-0"
/>
);
diff --git a/client/src/components/ui/RouteTabsHeader.test.jsx b/client/src/components/ui/RouteTabsHeader.test.jsx
new file mode 100644
index 0000000000..7a992630bf
--- /dev/null
+++ b/client/src/components/ui/RouteTabsHeader.test.jsx
@@ -0,0 +1,36 @@
+import { describe, it, expect } from 'vitest';
+import { render, screen, within } from '@testing-library/react';
+import { MemoryRouter } from 'react-router';
+
+import RouteTabsHeader from './RouteTabsHeader';
+import { NAV_PRESENTATION } from '../../lib/navPresentation.js';
+import { buildSectionNavTabs } from '../../lib/pageNavTabs.js';
+import { getSectionNavTabs } from '../../../../server/lib/navManifest.js';
+
+const settingsTabs = buildSectionNavTabs(getSectionNavTabs('Settings'), NAV_PRESENTATION, 'Settings');
+
+const renderAt = (tabs, activeTab) => render(
+ <MemoryRouter>
+ <RouteTabsHeader tabs={tabs} activeTab={activeTab} ariaLabel="Demo sections" />
+ </MemoryRouter>,
+);
+
+describe('RouteTabsHeader', () => {
+ it('renders an icon row past the compact threshold instead of a select', () => {
+ renderAt(settingsTabs, 'general');
+
+ expect(screen.queryByRole('combobox')).toBeNull();
+ const bar = screen.getByRole('tablist', { name: 'Demo sections' });
+ for (const tab of within(bar).getAllByRole('tab')) {
+ expect(tab.querySelector('svg')).toBeTruthy();
+ expect(tab.querySelector('.max-sm\\:sr-only')).toBeTruthy();
+ }
+ });
+
+ it('leaves a short bar\'s labels visible at every width', () => {
+ renderAt(settingsTabs.slice(0, 3), 'general');
+
+ const bar = screen.getByRole('tablist', { name: 'Demo sections' });
+ expect(within(bar).getAllByRole('tab')[0].querySelector('.max-sm\\:sr-only')).toBeNull();
+ });
+});
diff --git a/client/src/components/ui/SectionTabsHeader.jsx b/client/src/components/ui/SectionTabsHeader.jsx
index 7e05119f6e..81dd8056d2 100644
--- a/client/src/components/ui/SectionTabsHeader.jsx
+++ b/client/src/components/ui/SectionTabsHeader.jsx
@@ -1,6 +1,8 @@
import { useLocation } from 'react-router';
import { getNavSectionForPath, getSectionNavTabs } from '../../../../server/lib/navManifest.js';
import RouteTabsHeader from './RouteTabsHeader';
+import { buildSectionNavTabs } from '../../lib/pageNavTabs.js';
+import { NAV_PRESENTATION } from '../../lib/navPresentation.js';
/**
* Shared section child navigation.
@@ -20,7 +22,7 @@ export default function SectionTabsHeader({ activeTab, fallbackSection, tabs })
return (
<RouteTabsHeader
- tabs={sectionTabs}
+ tabs={buildSectionNavTabs(sectionTabs, NAV_PRESENTATION, section)}
activeTab={activeTab}
ariaLabel={`${section} sections`}
/>
diff --git a/client/src/components/ui/TabPills.jsx b/client/src/components/ui/TabPills.jsx
index 86a25cd803..9176c8e7d1 100644
--- a/client/src/components/ui/TabPills.jsx
+++ b/client/src/components/ui/TabPills.jsx
@@ -6,18 +6,32 @@
// rather than swapping panels: a tab promises a panel it never shows, so those
// chips are a `role="group"` of `aria-pressed` buttons — the same semantics the
// app's other toggle filters use — while sharing this component's styling.
-// Knobs cover the call-site quirks: `runningKind` swaps a per-tab icon for a
-// spinner; `stretch` makes each tab `flex-1` (StoryboardPanel); `mobileDropdown`
-// collapses to a `<select>` below `sm` (UniverseBuilder), whose wrapper is
-// `sm:hidden` unless `mobileSelectClassName` replaces it wholesale — a caller
-// passes that to make the select a flex sibling sharing one row with other
-// controls (`sm:hidden min-w-0 flex-1` in FableLoomStory's episode row), and the
-// replacement must carry its own `sm:hidden` or the select shows on desktop;
-// `controlsIdPrefix` wires `aria-controls` (and `id="tab-<id>"`) to matching tabpanels — pass
-// `'tabpanel'` to mirror ChiefOfStaff's wiring. `t.trailing` is an optional
-// ReactNode rendered after the count (e.g. PipelineIssue's per-stage status dot).
-import { useRef, useEffect } from 'react';
-import { Loader2 } from 'lucide-react';
+//
+// `mobileCompact` is the phone treatment for a bar with more tabs than fit at
+// 375px. It collapses to an ICON-ONLY row below `sm` — same buttons, same
+// tablist, labels kept for screen readers — with chevrons at whichever edge is
+// still scrollable. That is a deliberate product preference over a `<select>`
+// (#7283 swapped to one and it reads as a form control, not navigation): icons
+// keep every destination one tap away and keep the bar looking like a nav.
+// A tab list where any tab has no icon has nothing to render in that row and
+// falls back to the labelled `<select>`. That is for the lists icons genuinely
+// cannot serve — an unbounded, data-driven one, like FableLoomStory's episodes,
+// where every entry would draw the same glyph. A FIXED set of sections is not
+// that case: give it icons rather than letting it fall through here. The
+// fallback's wrapper is `sm:hidden` unless `mobileSelectClassName` replaces it
+// (a caller passes that to make the select a flex sibling sharing one row with
+// other controls, `sm:hidden min-w-0 flex-1` in FableLoomStory's episode row,
+// and the replacement must carry its own `sm:hidden` or the select shows on
+// desktop). `mobileSelectId` pairs a real `<label htmlFor>` with that fallback.
+//
+// Other knobs cover the call-site quirks: `runningKind` swaps a per-tab icon
+// for a spinner; `stretch` makes each tab `flex-1` (StoryboardPanel);
+// `controlsIdPrefix` wires `aria-controls` (and `id="tab-<id>"`) to matching
+// tabpanels — pass `'tabpanel'` to mirror ChiefOfStaff's wiring. `t.trailing`
+// is an optional ReactNode rendered after the count (e.g. PipelineIssue's
+// per-stage status dot).
+import { useRef, useEffect, useState, useCallback } from 'react';
+import { ChevronLeft, ChevronRight, Loader2 } from 'lucide-react';
const SIZE = {
xs: { text: 'text-[11px]', icon: 11, padding: 'px-2 py-2', gap: 'gap-1' },
@@ -25,6 +39,11 @@ const SIZE = {
md: { text: 'text-sm', icon: 16, padding: 'px-3 sm:px-4 py-3', gap: 'gap-2' },
};
+// Chevrons are the only overflow cue an icon row gets — with labels gone there
+// is no half-clipped word hinting that the strip continues. They sit in flow
+// beside the strip rather than over it, so they never cover a destination.
+const ARROW_CLASS = 'sm:hidden shrink-0 flex items-center justify-center self-stretch px-1 text-gray-400 hover:text-white';
+
export default function TabPills({
tabs,
activeTab,
@@ -33,24 +52,34 @@ export default function TabPills({
size = 'md',
stretch = false,
runningKind = null,
- mobileDropdown = false,
+ mobileCompact = false,
mobileSelectId,
mobileSelectClassName = '',
ariaLabel,
controlsIdPrefix,
className = '',
- listRef,
- onScroll,
}) {
const sz = SIZE[size] || SIZE.md;
const visibleTabs = tabs.filter(Boolean);
const tabRefs = useRef([]);
+ const stripRef = useRef(null);
+ // Widest scrollLeft the strip can reach. Held in a ref because it only moves
+ // on resize or a tab-count change — reading `scrollWidth` per scroll event
+ // would force a layout flush on every frame of a momentum scroll.
+ const maxScrollRef = useRef(0);
+ const [canScrollLeft, setCanScrollLeft] = useState(false);
+ const [canScrollRight, setCanScrollRight] = useState(false);
const enabledTabIndexes = visibleTabs
.map((tab, index) => (tab.disabled ? null : index))
.filter((index) => index !== null);
const activeIndex = visibleTabs.findIndex((t) => t.id === activeTab);
+ // Icons ARE the row in compact mode, so one iconless tab disqualifies the
+ // whole bar rather than rendering a gap the user can't aim at.
+ const iconRow = mobileCompact && visibleTabs.every((t) => t.icon);
+ const selectFallback = mobileCompact && !iconRow;
+
// Reveal only inside the horizontal tab strip. scrollIntoView also scrolls
// ancestors, pulling a mobile page away from its task form/content.
useEffect(() => {
@@ -67,6 +96,38 @@ export default function TabPills({
if (delta) strip.scrollBy({ left: delta, behavior: 'smooth' });
}, [activeTab, activeIndex, variant]);
+ // Scroll path: position only, against the cached extent.
+ const syncPosition = useCallback(() => {
+ const strip = stripRef.current;
+ if (!strip) return;
+ setCanScrollLeft(strip.scrollLeft > 1);
+ setCanScrollRight(strip.scrollLeft < maxScrollRef.current - 1);
+ }, []);
+
+ // Extent path: re-measure whenever the strip's width or its tab count moves,
+ // neither of which fires `scroll`.
+ const measure = useCallback(() => {
+ const strip = stripRef.current;
+ if (!strip) return;
+ maxScrollRef.current = strip.scrollWidth - strip.clientWidth;
+ syncPosition();
+ }, [syncPosition]);
+
+ useEffect(() => { if (iconRow) measure(); }, [iconRow, measure, visibleTabs.length]);
+
+ useEffect(() => {
+ const strip = stripRef.current;
+ if (!iconRow || !strip || typeof ResizeObserver === 'undefined') return undefined;
+ const observer = new ResizeObserver(measure);
+ observer.observe(strip);
+ return () => observer.disconnect();
+ }, [iconRow, measure]);
+
+ const scrollStrip = (direction) => {
+ const strip = stripRef.current;
+ if (strip) strip.scrollBy({ left: direction * strip.clientWidth * 0.8, behavior: 'smooth' });
+ };
+
const handleTabKeyDown = (event, index) => {
if (!['ArrowRight', 'ArrowDown', 'ArrowLeft', 'ArrowUp', 'Home', 'End'].includes(event.key)) {
return;
@@ -94,9 +155,20 @@ export default function TabPills({
tabRefs.current[targetIndex]?.focus({ preventScroll: true });
};
- // Mobile `<select>` collapse, shared by both variants so `mobileDropdown` works
- // regardless of `variant` (the underline tab bar just overflow-scrolls without it).
- const mobileSelect = mobileDropdown ? (
+ // ONE label node either way. Compact mode reaches for `sr-only` (takes no
+ // layout, still read aloud) rather than a `hidden` + `sr-only` pair: two
+ // copies of the word would each land in the accessible name, renaming every
+ // tab to "Agents Agents" for a screen reader and for `getByRole` alike. It is
+ // scoped with `max-sm:` rather than undone with `sm:not-sr-only` because that
+ // utility also resets `white-space` and `overflow`, which would unpick the
+ // `whitespace-nowrap` and `truncate` the desktop row depends on.
+ const renderLabel = (label, truncate = false) => label && (
+ <span className={[iconRow && 'max-sm:sr-only', truncate && 'truncate'].filter(Boolean).join(' ')}>{label}</span>
+ );
+
+ // Mobile `<select>` collapse for bars that cannot render an icon row, shared
+ // by both variants so `mobileCompact` works regardless of `variant`.
+ const mobileSelect = selectFallback ? (
<div className={mobileSelectClassName || 'sm:hidden'}>
{mobileSelectId && <label htmlFor={mobileSelectId} className="sr-only">{ariaLabel || 'Section'}</label>}
<select
@@ -115,16 +187,92 @@ export default function TabPills({
</div>
) : null;
+ // One strip, wrapped in an arrow row only when compact — an extra flex
+ // wrapper on every bar would break the callers that size this thing. The
+ // wrapper IS the bar when it exists, so the caller's `className` and the
+ // underline move onto it; the strip keeps only what makes it the scroller.
+ const withArrows = (strip) => (iconRow ? (
+ <div className={`flex min-w-0 items-stretch ${variant === 'underline' ? 'border-b border-port-border' : ''} ${className}`}>
+ {canScrollLeft && (
+ <button type="button" onClick={() => scrollStrip(-1)} aria-label="Scroll tabs left" className={ARROW_CLASS}>
+ <ChevronLeft size={18} />
+ </button>
+ )}
+ {strip}
+ {canScrollRight && (
+ <button type="button" onClick={() => scrollStrip(1)} aria-label="Scroll tabs right" className={ARROW_CLASS}>
+ <ChevronRight size={18} />
+ </button>
+ )}
+ </div>
+ ) : strip);
+
if (variant === 'pills' || variant === 'filter') {
const isFilter = variant === 'filter';
return (
<>
{mobileSelect}
+ {withArrows(
+ <div
+ ref={stripRef}
+ onScroll={iconRow ? syncPosition : undefined}
+ className={`${selectFallback ? 'hidden sm:flex' : 'flex'} ${iconRow ? 'min-w-0 flex-1' : `shrink-0 ${className}`} items-center gap-1 bg-port-card border border-port-border rounded p-1 overflow-x-auto scrollbar-hide touch-pan-x`}
+ role={isFilter ? 'group' : 'tablist'}
+ aria-label={ariaLabel}
+ >
+ {visibleTabs.map((t, index) => {
+ const Icon = t.icon;
+ const active = t.id === activeTab;
+ const running = runningKind && t.runningKind === runningKind;
+ return (
+ <button
+ key={t.id}
+ type="button"
+ role={isFilter ? undefined : 'tab'}
+ aria-selected={isFilter ? undefined : active}
+ aria-pressed={isFilter ? active : undefined}
+ aria-controls={!isFilter && controlsIdPrefix ? `${controlsIdPrefix}-${t.id}` : undefined}
+ id={!isFilter && controlsIdPrefix ? `tab-${t.id}` : undefined}
+ ref={!isFilter ? (node) => { tabRefs.current[index] = node; } : undefined}
+ tabIndex={!isFilter ? (active ? 0 : -1) : undefined}
+ disabled={t.disabled}
+ onClick={() => onChange(t.id)}
+ onKeyDown={!isFilter ? (event) => handleTabKeyDown(event, index) : undefined}
+ className={`flex items-center ${sz.gap} ${sz.padding} rounded ${sz.text} transition-colors whitespace-nowrap ${
+ active
+ ? 'bg-port-accent/20 text-port-accent border border-port-accent/40'
+ : 'text-gray-300 hover:bg-port-bg border border-transparent'
+ } ${t.disabled ? 'opacity-50 cursor-not-allowed' : ''}`}
+ >
+ {running
+ ? <Loader2 size={sz.icon} className="animate-spin shrink-0" />
+ : (Icon && <Icon size={sz.icon} aria-hidden="true" className="shrink-0" />)}
+ {renderLabel(t.label)}
+ {t.count != null && t.count > 0 && (
+ <span className={`text-[10px] ${active ? 'text-port-accent/70' : 'text-gray-500'}`}>
+ {t.count}
+ </span>
+ )}
+ {t.trailing}
+ </button>
+ );
+ })}
+ </div>
+ )}
+ </>
+ );
+ }
+
+ // underline variant
+ return (
+ <>
+ {mobileSelect}
+ {withArrows(
<div
- ref={listRef}
- onScroll={onScroll}
- className={`${mobileDropdown ? 'hidden sm:flex' : 'flex'} shrink-0 items-center gap-1 bg-port-card border border-port-border rounded p-1 overflow-x-auto scrollbar-hide touch-pan-x ${className}`}
- role={isFilter ? 'group' : 'tablist'}
+ ref={stripRef}
+ onScroll={iconRow ? syncPosition : undefined}
+ className={`${selectFallback ? 'hidden sm:flex' : 'flex'} ${iconRow ? 'min-w-0 flex-1' : `shrink-0 border-b border-port-border ${className}`} ${stretch ? 'items-stretch bg-port-bg/40' : 'gap-1'} overflow-x-auto scrollbar-hide touch-pan-x`}
+ role="tablist"
aria-label={ariaLabel}
>
{visibleTabs.map((t, index) => {
@@ -135,26 +283,25 @@ export default function TabPills({
<button
key={t.id}
type="button"
- role={isFilter ? undefined : 'tab'}
- aria-selected={isFilter ? undefined : active}
- aria-pressed={isFilter ? active : undefined}
- aria-controls={!isFilter && controlsIdPrefix ? `${controlsIdPrefix}-${t.id}` : undefined}
- id={!isFilter && controlsIdPrefix ? `tab-${t.id}` : undefined}
- ref={!isFilter ? (node) => { tabRefs.current[index] = node; } : undefined}
- tabIndex={!isFilter ? (active ? 0 : -1) : undefined}
+ role="tab"
+ aria-selected={active}
+ aria-controls={controlsIdPrefix ? `${controlsIdPrefix}-${t.id}` : undefined}
+ id={controlsIdPrefix ? `tab-${t.id}` : undefined}
+ ref={(node) => { tabRefs.current[index] = node; }}
+ tabIndex={active ? 0 : -1}
disabled={t.disabled}
onClick={() => onChange(t.id)}
- onKeyDown={!isFilter ? (event) => handleTabKeyDown(event, index) : undefined}
- className={`flex items-center ${sz.gap} ${sz.padding} rounded ${sz.text} transition-colors whitespace-nowrap ${
+ onKeyDown={(event) => handleTabKeyDown(event, index)}
+ className={`flex items-center ${stretch ? 'flex-1 min-w-0 justify-center' : 'shrink-0 justify-center'} ${sz.gap} ${sz.padding} ${sz.text} font-medium transition-colors whitespace-nowrap min-h-[44px] sm:min-h-[40px] border-b-2 -mb-px ${
active
- ? 'bg-port-accent/20 text-port-accent border border-port-accent/40'
- : 'text-gray-300 hover:bg-port-bg border border-transparent'
+ ? 'text-port-accent border-port-accent bg-port-accent/5'
+ : 'text-gray-400 border-transparent hover:text-white hover:bg-port-card'
} ${t.disabled ? 'opacity-50 cursor-not-allowed' : ''}`}
>
{running
? <Loader2 size={sz.icon} className="animate-spin shrink-0" />
- : (Icon && <Icon size={sz.icon} aria-hidden="true" />)}
- {t.label}
+ : (Icon && <Icon size={sz.icon} aria-hidden="true" className="shrink-0" />)}
+ {renderLabel(t.label, stretch)}
{t.count != null && t.count > 0 && (
<span className={`text-[10px] ${active ? 'text-port-accent/70' : 'text-gray-500'}`}>
{t.count}
@@ -165,62 +312,7 @@ export default function TabPills({
);
})}
</div>
- </>
- );
- }
-
- // underline variant
- return (
- <>
- {mobileSelect}
- <div
- ref={listRef}
- onScroll={onScroll}
- className={`${mobileDropdown ? 'hidden sm:flex' : 'flex'} shrink-0 border-b border-port-border ${stretch ? 'items-stretch bg-port-bg/40' : 'gap-1'} overflow-x-auto scrollbar-hide touch-pan-x ${className}`}
- role="tablist"
- aria-label={ariaLabel}
- >
- {visibleTabs.map((t, index) => {
- const Icon = t.icon;
- const active = t.id === activeTab;
- const running = runningKind && t.runningKind === runningKind;
- return (
- <button
- key={t.id}
- type="button"
- role="tab"
- aria-selected={active}
- aria-controls={controlsIdPrefix ? `${controlsIdPrefix}-${t.id}` : undefined}
- id={controlsIdPrefix ? `tab-${t.id}` : undefined}
- ref={(node) => { tabRefs.current[index] = node; }}
- tabIndex={active ? 0 : -1}
- disabled={t.disabled}
- onClick={() => onChange(t.id)}
- onKeyDown={(event) => handleTabKeyDown(event, index)}
- className={`flex items-center ${stretch ? 'flex-1 min-w-0 justify-center' : 'shrink-0 justify-center'} ${sz.gap} ${sz.padding} ${sz.text} font-medium transition-colors whitespace-nowrap min-h-[44px] sm:min-h-[40px] border-b-2 -mb-px ${
- active
- ? 'text-port-accent border-port-accent bg-port-accent/5'
- : 'text-gray-400 border-transparent hover:text-white hover:bg-port-card'
- } ${t.disabled ? 'opacity-50 cursor-not-allowed' : ''}`}
- >
- {running
- ? <Loader2 size={sz.icon} className="animate-spin shrink-0" />
- : (Icon && <Icon size={sz.icon} aria-hidden="true" className="shrink-0" />)}
- {t.label && (stretch ? (
- <span className="truncate">{t.label}</span>
- ) : (
- <span>{t.label}</span>
- ))}
- {t.count != null && t.count > 0 && (
- <span className={`text-[10px] ${active ? 'text-port-accent/70' : 'text-gray-500'}`}>
- {t.count}
- </span>
- )}
- {t.trailing}
- </button>
- );
- })}
- </div>
+ )}
</>
);
}
diff --git a/client/src/components/ui/TabPills.test.jsx b/client/src/components/ui/TabPills.test.jsx
index 6b5ad077e2..6540328841 100644
--- a/client/src/components/ui/TabPills.test.jsx
+++ b/client/src/components/ui/TabPills.test.jsx
@@ -1,5 +1,5 @@
import { describe, it, expect, vi } from 'vitest';
-import { render, screen, within } from '@testing-library/react';
+import { render, screen, within, fireEvent, act } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { Users, MapPin, Package } from 'lucide-react';
@@ -132,14 +132,63 @@ describe('TabPills — underline variant (default)', () => {
});
});
-describe('TabPills — pills variant', () => {
- it('renders a hidden mobile <select> with all labels when mobileDropdown is set', () => {
+// The preferred phone treatment: the same tab buttons, icons only. A `<select>`
+// reads as a form control rather than navigation, so it is reserved for the
+// bars that have no icons to show (#7283 made it universal; this reverses that).
+describe('TabPills — mobileCompact icon row', () => {
+ it('keeps one tablist and hides each label below `sm` without renaming the tab', () => {
+ render(<TabPills mobileCompact tabs={sampleTabs} activeTab="cast" onChange={() => {}} />);
+
+ expect(screen.queryByRole('combobox')).toBeNull();
+ expect(screen.getAllByRole('tab')).toHaveLength(3);
+ const castBtn = screen.getByRole('tab', { name: /Cast/ });
+ expect(castBtn).toHaveAccessibleName('Cast 3');
+ expect(within(castBtn).getByText('Cast')).toHaveClass('max-sm:sr-only');
+ expect(castBtn.querySelector('svg')).toBeTruthy();
+ });
+
+ it.each(['underline', 'pills'])('reveals a scrollable edge with a chevron in the %s variant', async (variant) => {
+ // happy-dom reports every box as 0x0 and ships no ResizeObserver, so both
+ // the overflow and the re-measure that publishes it have to be stated. The
+ // fake observer is also what proves the split: the scroll path alone never
+ // re-reads `scrollWidth`, so without a resize there is nothing to reveal.
+ const resize = [];
+ vi.stubGlobal('ResizeObserver', class {
+ constructor(cb) { resize.push(cb); }
+ observe() {}
+ disconnect() {}
+ });
+ const user = userEvent.setup();
+ const { container } = render(
+ <TabPills variant={variant} mobileCompact tabs={sampleTabs} activeTab="cast" onChange={() => {}} />
+ );
+ const strip = container.querySelector('[role="tablist"]');
+ Object.defineProperty(strip, 'scrollWidth', { configurable: true, value: 800 });
+ Object.defineProperty(strip, 'clientWidth', { configurable: true, value: 300 });
+ const scrollBy = vi.spyOn(strip, 'scrollBy').mockImplementation(() => {});
+
+ expect(screen.queryByRole('button', { name: 'Scroll tabs right' })).toBeNull();
+ act(() => { for (const cb of resize) cb(); });
+ expect(screen.queryByRole('button', { name: 'Scroll tabs left' })).toBeNull();
+
+ await user.click(screen.getByRole('button', { name: 'Scroll tabs right' }));
+ expect(scrollBy).toHaveBeenCalledWith({ left: 240, behavior: 'smooth' });
+
+ strip.scrollLeft = 200;
+ fireEvent.scroll(strip);
+ await user.click(screen.getByRole('button', { name: 'Scroll tabs left' }));
+ expect(scrollBy).toHaveBeenLastCalledWith({ left: -240, behavior: 'smooth' });
+ vi.unstubAllGlobals();
+ });
+
+ it('falls back to the labelled <select> when any tab has no icon to show', () => {
+ const tabs = [...sampleTabs.slice(0, 2), { id: 'objects', label: 'Objects' }];
render(
<TabPills
variant="pills"
- mobileDropdown
+ mobileCompact
mobileSelectId="ub-tab-select"
- tabs={sampleTabs}
+ tabs={tabs}
activeTab="cast"
onChange={() => {}}
/>
@@ -147,6 +196,7 @@ describe('TabPills — pills variant', () => {
const select = screen.getByRole('combobox');
expect(select).toHaveAttribute('id', 'ub-tab-select');
expect(select.value).toBe('cast');
+ expect(screen.queryByRole('button', { name: 'Scroll tabs right' })).toBeNull();
// Count appears in option text when present
expect(within(select).getByRole('option', { name: /Cast \(3\)/i })).toBeInTheDocument();
expect(within(select).getByRole('option', { name: 'Objects' })).toBeInTheDocument();
@@ -156,9 +206,9 @@ describe('TabPills — pills variant', () => {
render(
<TabPills
variant="pills"
- mobileDropdown
+ mobileCompact
ariaLabel="Universe sections"
- tabs={sampleTabs}
+ tabs={[{ id: 'cast', label: 'Cast' }, { id: 'places', label: 'Places' }]}
activeTab="cast"
onChange={() => {}}
/>
diff --git a/client/src/components/universe/CharacterDetailEditor.jsx b/client/src/components/universe/CharacterDetailEditor.jsx
index 744b8c0cbe..c9746ad67b 100644
--- a/client/src/components/universe/CharacterDetailEditor.jsx
+++ b/client/src/components/universe/CharacterDetailEditor.jsx
@@ -1439,7 +1439,7 @@ export default function CharacterDetailEditor({ entry, universeId = null, onPatc
</aside>
<div className="min-w-0 space-y-3">
<TabPills tabs={SHEET_PAGES} activeTab={activePage} onChange={setActivePage}
- variant="pills" size="sm" mobileDropdown ariaLabel={`${entry.name} sheet page`} />
+ variant="pills" size="sm" mobileCompact ariaLabel={`${entry.name} sheet page`} />
{SHEET_PAGES.map((page) => (
<div key={page.id} role="tabpanel" aria-label={page.label} hidden={activePage !== page.id}>
{activePage === page.id || visited[page.id] ? (
diff --git a/client/src/components/universeBuilder/UniverseBuilderPage.jsx b/client/src/components/universeBuilder/UniverseBuilderPage.jsx
index 6be4930a08..4a2e5b857d 100644
--- a/client/src/components/universeBuilder/UniverseBuilderPage.jsx
+++ b/client/src/components/universeBuilder/UniverseBuilderPage.jsx
@@ -446,8 +446,7 @@ export default function UniverseBuilder() {
<TabPills
variant="pills"
size="sm"
- mobileDropdown
- mobileSelectId="ub-tab-select"
+ mobileCompact
activeTab={activeTab}
onChange={setTab}
tabs={[
diff --git a/client/src/lib/README.md b/client/src/lib/README.md
index dd75c08f55..d088b6fded 100644
--- a/client/src/lib/README.md
+++ b/client/src/lib/README.md
@@ -26,7 +26,7 @@ grep -i "what you want to do" client/src/lib/README.md
```
| `navFeatures.js` | `filterNavByFeatures(navEntries, isFeatureEnabled)` — drops nav-manifest entries whose optional instance feature (`post`, `datadog`, `jira`, `gsd`) is off. The single gate for BROWSE surfaces (sidebar, ⌘K); routes stay reachable by URL, bookmark, and voice. Pair with `useInstanceFeatures`. |
-| `pageNavTabs.js` | `buildPageNavTabs(manifestTabs, presentation, pageName)` — merges `getPageNavTabs(group)` (nav-manifest, owns id/label/order) with a page-owned presentation map (icon, layout flags), throwing at import time when a manifest tab has no entry. The one way a tabbed page builds its tab bar. |
+| `pageNavTabs.js` | `buildPageNavTabs(manifestTabs, presentation, pageName)` — merges `getPageNavTabs(group)` (nav-manifest, owns id/label/order) with a page-owned presentation map (icon, layout flags), throwing at import time when a manifest tab has no entry. `buildSectionNavTabs(sectionTabs, presentation, section)` does the same for `getSectionNavTabs(section)`, resolving icons by path out of `NAV_PRESENTATION`. The one way a tabbed page or section builds its tab bar. |
| `eidoverseFrame.js` | Versioned hosted Eidoverse message guards, exact section navigation allowlist, and browser label preferences. |
| `eidoverseWorldReset.js` | Client reset-reconciliation maps for Eidoverse source kinds and district asset slots; parity-tested against the authoritative server world-design contracts. |
| `postQuickSession.js` | Pure Quick POST duration presets, local-observation estimator, deterministic budget composer, and preview metadata. |
diff --git a/client/src/lib/navPresentation.js b/client/src/lib/navPresentation.js
index 91900b58eb..c7d8bc8e3d 100644
--- a/client/src/lib/navPresentation.js
+++ b/client/src/lib/navPresentation.js
@@ -51,6 +51,7 @@ import {
Compass,
Feather,
Scale,
+ GitCompareArrows,
Lightbulb,
GitBranch,
Link2,
@@ -228,7 +229,7 @@ export const NAV_PRESENTATION = {
'/models/llms': { icon: Cpu },
'/models/loras': { icon: Sparkles },
'/models/media': { icon: HardDrive },
- '/models/comparison': { icon: Gauge },
+ '/models/comparison': { icon: GitCompareArrows },
'/models/performance': { icon: Gauge },
'/local-llm/playground': { icon: FlaskConical },
'/models/status': { icon: Activity },
diff --git a/client/src/lib/navPresentation.test.js b/client/src/lib/navPresentation.test.js
new file mode 100644
index 0000000000..ebb0adb57c
--- /dev/null
+++ b/client/src/lib/navPresentation.test.js
@@ -0,0 +1,35 @@
+import { describe, it, expect } from 'vitest';
+
+import { NAV_PRESENTATION } from './navPresentation.js';
+import { buildSectionNavTabs } from './pageNavTabs.js';
+import { NAV_COMMANDS, getSectionNavTabs } from '../../../server/lib/navManifest.js';
+
+const SECTIONS = [...new Set(NAV_COMMANDS.map((command) => command.section).filter(Boolean))]
+ .map((section) => [section, getSectionNavTabs(section)])
+ .filter(([, tabs]) => tabs.length > 0);
+
+const iconName = (icon) => icon?.displayName || icon?.name;
+
+// This registry is the single icon source for BOTH the sidebar and each
+// section's sub-nav (`buildSectionNavTabs`), so its invariants are registry
+// invariants, not any one component's. Both matter more than they look:
+// a destination with no icon throws the whole section's nav, and two
+// destinations sharing one are indistinguishable on a phone, where the
+// sub-nav collapses to icons and the icon is all the user sees.
+describe.each(SECTIONS)('%s destinations', (section, tabs) => {
+ it('all resolve an icon, so the section can build its sub-nav', () => {
+ expect(() => buildSectionNavTabs(tabs, NAV_PRESENTATION, section)).not.toThrow();
+ });
+
+ it('use a different icon each', () => {
+ const names = tabs.map((tab) => iconName(NAV_PRESENTATION[tab.to]?.icon));
+ expect(names).toEqual([...new Set(names)]);
+ });
+});
+
+describe('buildSectionNavTabs', () => {
+ it('names the destination whose icon is missing instead of degrading the bar', () => {
+ expect(() => buildSectionNavTabs([{ id: 'x', to: '/not-a-nav-path' }], NAV_PRESENTATION, 'Demo'))
+ .toThrow('Demo: no nav presentation icon for /not-a-nav-path');
+ });
+});
diff --git a/client/src/lib/pageNavTabs.js b/client/src/lib/pageNavTabs.js
index 34bcb5a1f4..bb80f16679 100644
--- a/client/src/lib/pageNavTabs.js
+++ b/client/src/lib/pageNavTabs.js
@@ -25,4 +25,26 @@ export const buildPageNavTabs = (manifestTabs, presentation, pageName) => (
})
);
+/**
+ * The same merge for the SECTION axis (`getSectionNavTabs(section)`), whose tabs
+ * are sidebar destinations. Their icons therefore come from the sidebar's own
+ * registry rather than a page-owned map — one registry, so a section's sub-nav
+ * and its sidebar row can never disagree about what a destination looks like.
+ *
+ * Missing icon throws, for the reason `buildPageNavTabs` throws: on a phone the
+ * bar collapses to icons, and ONE tab without one silently demotes the whole
+ * section to the `<select>` the product rejected (see TabPills' `mobileCompact`).
+ *
+ * @param {Array<{id: string, to: string}>} sectionTabs from `getSectionNavTabs(section)`
+ * @param {Record<string, {icon?: Function}>} presentation path-keyed, i.e. NAV_PRESENTATION
+ * @param {string} section used in the drift error, e.g. Settings
+ */
+export const buildSectionNavTabs = (sectionTabs, presentation, section) => (
+ sectionTabs.map((tab) => {
+ const icon = presentation[tab.to]?.icon;
+ if (!icon) throw new Error(`${section}: no nav presentation icon for ${tab.to}`);
+ return { ...tab, icon };
+ })
+);
+
export default buildPageNavTabs;
diff --git a/client/src/pages/ApiExplorer.jsx b/client/src/pages/ApiExplorer.jsx
index 35a4b97de6..d9782b1b40 100644
--- a/client/src/pages/ApiExplorer.jsx
+++ b/client/src/pages/ApiExplorer.jsx
@@ -1,7 +1,7 @@
import { useEffect, useMemo, useState } from 'react';
import { Link, Navigate, useNavigate, useParams } from 'react-router';
import {
- Bot, Braces, CheckCircle2, Copy, ExternalLink, RadioTower, Search,
+ BookOpen, Bot, Braces, CheckCircle2, Copy, ExternalLink, RadioTower, Search,
} from 'lucide-react';
import PageHeader from '../components/PageHeader';
import RouteTabsHeader from '../components/ui/RouteTabsHeader';
@@ -30,10 +30,10 @@ function operationsFromOpenApi(spec) {
}
const TABS = [
- { id: 'catalog', label: 'API Catalog', to: '/api-reference/catalog' },
- { id: 'rest', label: 'REST Reference', to: '/api-reference/rest' },
- { id: 'events', label: 'Event API', to: '/api-reference/events' },
- { id: 'tools', label: 'Agent Tools', to: '/api-reference/tools' },
+ { id: 'catalog', label: 'API Catalog', to: '/api-reference/catalog', icon: BookOpen },
+ { id: 'rest', label: 'REST Reference', to: '/api-reference/rest', icon: Braces },
+ { id: 'events', label: 'Event API', to: '/api-reference/events', icon: RadioTower },
+ { id: 'tools', label: 'Agent Tools', to: '/api-reference/tools', icon: Bot },
];
const VALID_TABS = new Set(TABS.map((tab) => tab.id));
diff --git a/client/src/pages/Brain.jsx b/client/src/pages/Brain.jsx
index f5b7217898..d1e2fa1733 100644
--- a/client/src/pages/Brain.jsx
+++ b/client/src/pages/Brain.jsx
@@ -146,8 +146,7 @@ export default function Brain() {
tabs={TABS}
activeTab={activeTab}
onChange={handleTabChange}
- mobileDropdown
- mobileSelectId="brain-sections-select"
+ mobileCompact
ariaLabel="Brain sections"
/>
diff --git a/client/src/pages/Brain.test.jsx b/client/src/pages/Brain.test.jsx
index 9252b271ca..96b4f06731 100644
--- a/client/src/pages/Brain.test.jsx
+++ b/client/src/pages/Brain.test.jsx
@@ -2,9 +2,9 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import { MemoryRouter, Routes, Route } from 'react-router';
-// Regression coverage for #7283 — past MOBILE_DROPDOWN_THRESHOLD tabs, Brain
-// used to pass `hideLabelOnMobile` (an icon-only phone row) instead of the
-// `mobileDropdown` `<select>` every other many-tab section uses.
+// Brain's 14 tabs are past the compact threshold, so the bar collapses on a
+// phone. It collapses to TabPills' ICON ROW, not the `<select>` #7283 briefly
+// made universal — the preferred treatment for any bar whose tabs have icons.
const api = vi.hoisted(() => ({
getBrainSummary: vi.fn(),
getBrainSettings: vi.fn(),
@@ -52,21 +52,22 @@ const renderSettledAt = async (tab) => {
return result;
};
-describe('Brain mobile tab navigation (#7283)', () => {
- it('renders a labelled mobile select naming the current tab instead of unlabelled icons', async () => {
+describe('Brain mobile tab navigation', () => {
+ it('collapses to named icon links on the phone, not a select', async () => {
await renderSettledAt('links');
- const select = screen.getByRole('combobox', { name: 'Brain sections' });
- expect(select).toHaveAttribute('id', 'brain-sections-select');
- expect(select.value).toBe('links');
+ expect(screen.queryByRole('combobox', { name: 'Brain sections' })).toBeNull();
+ const linksTab = screen.getByRole('tab', { name: 'Links' });
+ expect(linksTab).toHaveAttribute('aria-selected', 'true');
+ expect(linksTab.querySelector('svg')).toBeTruthy();
+ expect(linksTab.querySelector('.max-sm\\:sr-only')).toBeTruthy();
});
- it('navigates to the selected tab route when an option is chosen', async () => {
+ it('navigates to the tab route when an icon is clicked', async () => {
await renderSettledAt('inbox');
expect(await screen.findByTestId('inbox-tab')).toBeInTheDocument();
- const select = screen.getByRole('combobox', { name: 'Brain sections' });
- fireEvent.change(select, { target: { value: 'memory' } });
+ fireEvent.click(screen.getByRole('tab', { name: 'Memory' }));
expect(await screen.findByTestId('memory-tab')).toBeInTheDocument();
});
diff --git a/client/src/pages/ChiefOfStaff.jsx b/client/src/pages/ChiefOfStaff.jsx
index 178aae8a8e..5518465286 100644
--- a/client/src/pages/ChiefOfStaff.jsx
+++ b/client/src/pages/ChiefOfStaff.jsx
@@ -1150,8 +1150,7 @@ export default function ChiefOfStaff() {
tabs={TABS}
activeTab={activeTab}
onChange={(id) => navigate(`/cos/${id}`)}
- mobileDropdown
- mobileSelectId="cos-sections-select"
+ mobileCompact
ariaLabel="Chief of Staff sections"
controlsIdPrefix="tabpanel"
className="pb-px"
diff --git a/client/src/pages/ChiefOfStaff.test.jsx b/client/src/pages/ChiefOfStaff.test.jsx
index 7e4a9ad345..2133fdfbbe 100644
--- a/client/src/pages/ChiefOfStaff.test.jsx
+++ b/client/src/pages/ChiefOfStaff.test.jsx
@@ -208,35 +208,29 @@ describe('ChiefOfStaff loading skeleton', () => {
});
});
-// Regression coverage for #7283 — past MOBILE_DROPDOWN_THRESHOLD tabs (16 on
-// this page), ChiefOfStaff used to pass `hideLabelOnMobile` (an icon-only
-// phone row plus hand-rolled scroll arrows) instead of the `mobileDropdown`
-// `<select>` every other many-tab section uses.
-describe('ChiefOfStaff mobile tab navigation (#7283)', () => {
- it('renders a labelled mobile select naming the current tab instead of unlabelled icons', async () => {
+// CoS is the busiest section (16 tabs), so it is past the compact threshold on
+// a phone. It collapses to TabPills' ICON ROW — the same buttons, labels kept
+// for assistive tech — rather than the `<select>` #7283 briefly made universal.
+// The scroll chevrons that used to be hand-rolled here now live in TabPills.
+describe('ChiefOfStaff mobile tab navigation', () => {
+ it('collapses to named icon links on the phone, not a select', async () => {
await renderSettledAt('tasks');
- const select = screen.getByRole('combobox', { name: 'Chief of Staff sections' });
- expect(select).toHaveAttribute('id', 'cos-sections-select');
- expect(select.value).toBe('tasks');
+ expect(screen.queryByRole('combobox', { name: 'Chief of Staff sections' })).toBeNull();
+ const tasksTab = screen.getByRole('tab', { name: 'Tasks' });
+ expect(tasksTab).toHaveAttribute('aria-selected', 'true');
+ expect(tasksTab.querySelector('svg')).toBeTruthy();
+ expect(tasksTab.querySelector('.max-sm\\:sr-only')).toBeTruthy();
});
- it('navigates to the selected tab route when an option is chosen', async () => {
+ it('navigates to the tab route when an icon is clicked', async () => {
await renderSettledAt('tasks');
- const select = screen.getByRole('combobox', { name: 'Chief of Staff sections' });
- fireEvent.change(select, { target: { value: 'agents' } });
+ fireEvent.click(screen.getByRole('tab', { name: 'Agents' }));
const panel = await screen.findByRole('tabpanel');
expect(panel).toHaveAttribute('id', 'tabpanel-agents');
});
-
- it('no longer renders the hand-rolled tab scroll-arrow buttons', async () => {
- await renderSettledAt('tasks');
-
- expect(screen.queryByRole('button', { name: 'Scroll tabs left' })).not.toBeInTheDocument();
- expect(screen.queryByRole('button', { name: 'Scroll tabs right' })).not.toBeInTheDocument();
- });
});
describe('ChiefOfStaff mind tab layout', () => {
diff --git a/client/src/pages/CreativeDirectorDetail.jsx b/client/src/pages/CreativeDirectorDetail.jsx
index cfa3bf2009..715142a985 100644
--- a/client/src/pages/CreativeDirectorDetail.jsx
+++ b/client/src/pages/CreativeDirectorDetail.jsx
@@ -1,6 +1,6 @@
import { useEffect, useState, useCallback, useRef } from 'react';
import { useParams, useNavigate, useSearchParams, Link } from 'react-router';
-import { ArrowLeft, Play, Pause, RefreshCw, SlidersHorizontal, Square, Trash2 } from 'lucide-react';
+import { ArrowLeft, ClipboardList, Eye, Film, FileText, LayoutList, Package, Play, Pause, RefreshCw, ScrollText, SlidersHorizontal, Square, Trash2 } from 'lucide-react';
import TabPills from '../components/ui/TabPills.jsx';
import PageSkeleton from '../components/ui/PageSkeleton';
import toast from '../components/ui/Toast';
@@ -33,14 +33,14 @@ import useMediaJobProgress from '../hooks/useMediaJobProgress';
const TERMINAL_PROJECT_STATUSES = new Set(['complete', 'failed', 'paused', 'draft']);
-const VIDEO_DRAFT_TABS = [{ id: 'overview', label: 'Overview' }, { id: 'review', label: 'Review' }, { id: 'artifacts', label: 'Artifacts' }, { id: 'segments', label: 'Shots' }, { id: 'runs', label: 'Runs' }];
+const VIDEO_DRAFT_TABS = [{ id: 'overview', label: 'Overview', icon: LayoutList }, { id: 'review', label: 'Review', icon: Eye }, { id: 'artifacts', label: 'Artifacts', icon: Package }, { id: 'segments', label: 'Shots', icon: Film }, { id: 'runs', label: 'Runs', icon: ScrollText }];
const TABS = [
- { id: 'overview', label: 'Overview' },
- { id: 'plan', label: 'Plan' },
- { id: 'treatment', label: 'Treatment' },
- { id: 'segments', label: 'Segments' },
- { id: 'runs', label: 'Runs' },
+ { id: 'overview', label: 'Overview', icon: LayoutList },
+ { id: 'plan', label: 'Plan', icon: ClipboardList },
+ { id: 'treatment', label: 'Treatment', icon: FileText },
+ { id: 'segments', label: 'Segments', icon: Film },
+ { id: 'runs', label: 'Runs', icon: ScrollText },
];
export default function CreativeDirectorDetail({ basePath = '/creative-director' } = {}) {
@@ -323,7 +323,7 @@ export default function CreativeDirectorDetail({ basePath = '/creative-director'
)}
</div>
</div>
- <TabPills tabs={tabs} activeTab={activeTab} onChange={goTo} mobileDropdown ariaLabel="Video project sections" className="mt-3" />
+ <TabPills tabs={tabs} activeTab={activeTab} onChange={goTo} mobileCompact ariaLabel="Video project sections" className="mt-3" />
</div>
<div className="flex-1 overflow-auto p-6">
diff --git a/client/src/pages/FableLoomStory.jsx b/client/src/pages/FableLoomStory.jsx
index 9ab38b6246..9f5d51e7d0 100644
--- a/client/src/pages/FableLoomStory.jsx
+++ b/client/src/pages/FableLoomStory.jsx
@@ -567,7 +567,8 @@ export default function FableLoomStory({ view = 'graph' }) {
variant="pills"
size="sm"
ariaLabel="Series and episodes"
- mobileDropdown
+ mobileCompact
+ mobileSelectId="fableloom-series-episode"
mobileSelectClassName="sm:hidden min-w-0 flex-1"
tabs={[
{ id: 'plan', label: 'Series plan' },
diff --git a/client/src/pages/Game.jsx b/client/src/pages/Game.jsx
index 6f366c23da..e651789bc5 100644
--- a/client/src/pages/Game.jsx
+++ b/client/src/pages/Game.jsx
@@ -410,8 +410,7 @@ export default function Game() {
onChange={setActiveTab}
ariaLabel="Game workspace sections"
controlsIdPrefix="game-panel"
- mobileDropdown
- mobileSelectId="game-section"
+ mobileCompact
className="px-4"
/>
diff --git a/client/src/pages/Instances.jsx b/client/src/pages/Instances.jsx
index b2928132b2..0c186e2561 100644
--- a/client/src/pages/Instances.jsx
+++ b/client/src/pages/Instances.jsx
@@ -7,7 +7,8 @@ import {
Database, Brain, CheckCircle2, AlertCircle, Clock,
RefreshCcw, Timer,
Target, Sword, Fingerprint, HeartPulse, ChevronDown, ChevronRight,
- Lock, Globe, Sparkles, Film, Images, Library, BookOpen, FilePen, Music, Music2, Disc3, Clapperboard, Palette, BookText, FolderTree, Video, Waypoints, Gauge, Spade
+ Lock, Globe, Sparkles, Film, Images, Library, BookOpen, FilePen, Music, Music2, Disc3, Clapperboard, Palette, BookText, FolderTree, Video, Waypoints, Gauge, Spade,
+ RadioTower, Route
} from 'lucide-react';
import { useSearchParams } from 'react-router';
import Drawer from '../components/Drawer';
@@ -1638,10 +1639,10 @@ function InstancesContent() {
<Drawer open={drawer === 'settings'} onClose={() => openDrawer(null)}
title="Connection settings" size="md"
tabs={[
- { id: 'instance', label: 'This instance' },
- { id: 'network', label: 'Network' },
- { id: 'relay', label: 'Tailcat' },
- { id: 'routing', label: 'Render routes' },
+ { id: 'instance', label: 'This instance', icon: MonitorSmartphone },
+ { id: 'network', label: 'Network', icon: Network },
+ { id: 'relay', label: 'Tailcat', icon: RadioTower },
+ { id: 'routing', label: 'Render routes', icon: Route },
]}
activeTab={settingsTab} onTabChange={setSettingsTab}>
{settingsTab === 'instance' && (
diff --git a/client/src/pages/Instances.test.jsx b/client/src/pages/Instances.test.jsx
index 964e7c7b66..56adf7e2ac 100644
--- a/client/src/pages/Instances.test.jsx
+++ b/client/src/pages/Instances.test.jsx
@@ -342,8 +342,9 @@ describe('Instances page connection drawers', () => {
const dialog = screen.getByRole('dialog');
fireEvent.click(within(dialog).getByRole('button', { name: 'Edit', exact: true }));
fireEvent.change(screen.getByLabelText('Instance name'), { target: { value: 'Draft name' } });
- fireEvent.change(screen.getByRole('combobox', { name: 'Connection settings sections' }), { target: { value: 'relay' } });
- fireEvent.change(screen.getByRole('combobox', { name: 'Connection settings sections' }), { target: { value: 'instance' } });
+ const sections = () => within(screen.getByRole('tablist', { name: 'Connection settings sections' }));
+ fireEvent.click(sections().getByRole('tab', { name: 'Tailcat' }));
+ fireEvent.click(sections().getByRole('tab', { name: 'This instance' }));
expect(screen.getByLabelText('Instance name')).toHaveValue('Draft name');
fireEvent.click(screen.getByRole('button', { name: 'Close settings' }));
fireEvent.click(screen.getByRole('button', { name: 'Add peer' }));
diff --git a/client/src/pages/MediaGen.jsx b/client/src/pages/MediaGen.jsx
index fca11c7505..9cb98c9a23 100644
--- a/client/src/pages/MediaGen.jsx
+++ b/client/src/pages/MediaGen.jsx
@@ -42,8 +42,7 @@ export default function MediaGen() {
activeTab={activeTab}
onChange={(id) => navigate(id === 'video' ? '/video/generate' : `/media/${id}`)}
ariaLabel="Media Gen sections"
- mobileDropdown
- mobileSelectId="media-gen-section-select"
+ mobileCompact
className="w-full min-w-0"
/>
diff --git a/client/src/pages/MediaGen.test.jsx b/client/src/pages/MediaGen.test.jsx
index b159ad93d1..64bc893d46 100644
--- a/client/src/pages/MediaGen.test.jsx
+++ b/client/src/pages/MediaGen.test.jsx
@@ -6,17 +6,20 @@ import MediaGen, { TABS } from './MediaGen.jsx';
import { expectPageNavTabs } from '../test/pageNavTabAssertions.js';
describe('<MediaGen>', () => {
- it('provides a labeled mobile section selector for the full tab set', () => {
+ it('keeps every tab on the phone as a named icon link rather than a select', () => {
render(
<MemoryRouter initialEntries={['/media/image']}>
<MediaGen />
</MemoryRouter>,
);
- const select = screen.getByRole('combobox', { name: 'Media Gen sections' });
- expect(select).toHaveAttribute('id', 'media-gen-section-select');
- expect(within(select).getAllByRole('option')).toHaveLength(TABS.length);
- expect(select).toHaveValue('image');
+ expect(screen.queryByRole('combobox')).toBeNull();
+ const bar = screen.getByRole('tablist', { name: 'Media Gen sections' });
+ const tabs = within(bar).getAllByRole('tab');
+ expect(tabs).toHaveLength(TABS.length);
+ // Each tab still carries its icon and its name; only the visible label goes.
+ expect(tabs.every((tab) => tab.querySelector('svg') && tab.querySelector('.max-sm\\:sr-only'))).toBe(true);
+ expect(within(bar).getByRole('tab', { name: 'Image' })).toHaveAttribute('aria-selected', 'true');
});
it('marks the Video tab active on /video/generate', () => {
@@ -26,7 +29,7 @@ describe('<MediaGen>', () => {
</MemoryRouter>,
);
- expect(screen.getByRole('combobox', { name: 'Media Gen sections' })).toHaveValue('video');
+ expect(screen.getByRole('tab', { name: 'Video' })).toHaveAttribute('aria-selected', 'true');
expect(container.querySelector('.flex-1.overflow-auto')).toBeTruthy();
});
});
diff --git a/client/src/pages/Models.test.jsx b/client/src/pages/Models.test.jsx
index bed4d5c238..b54c036453 100644
--- a/client/src/pages/Models.test.jsx
+++ b/client/src/pages/Models.test.jsx
@@ -8,7 +8,7 @@
*/
import { describe, it, expect, vi } from 'vitest';
-import { render, screen } from '@testing-library/react';
+import { render, screen, within } from '@testing-library/react';
import { MemoryRouter, Route, Routes } from 'react-router';
import { TABS } from '../components/models/ModelsTabsHeader';
@@ -114,12 +114,15 @@ describe('Models', () => {
}
});
- // The tab bar collapses to a `<select>` under `sm`, so every destination has to
- // be reachable there too — this section is now too wide for a phone pill row.
- it('mirrors every destination into the mobile select', () => {
+ // The tab bar collapses to an icon row under `sm` — this section is now too
+ // wide for a phone pill row — so every destination has to stay reachable and
+ // named there, with an icon of its own to be reachable BY.
+ it('keeps every destination in the phone icon row, named and drawn', () => {
renderAt('/models/performance');
- const select = screen.getByRole('combobox', { name: 'Models sections' });
- expect([...select.options].map((o) => o.textContent)).toEqual(TABS.map((t) => t.label));
+ const bar = screen.getByRole('tablist', { name: 'Models sections' });
+ const tabs = within(bar).getAllByRole('tab');
+ expect(tabs.map((t) => t.textContent)).toEqual(TABS.map((t) => t.label));
+ expect(tabs.every((t) => t.querySelector('svg') && t.querySelector('.max-sm\\:sr-only'))).toBe(true);
});
// A tab listed in the header but missing from TAB_CONTENT falls through to the
diff --git a/client/src/pages/PipelineSeriesRoadmap.jsx b/client/src/pages/PipelineSeriesRoadmap.jsx
index 32f3fba54a..f19766beb3 100644
--- a/client/src/pages/PipelineSeriesRoadmap.jsx
+++ b/client/src/pages/PipelineSeriesRoadmap.jsx
@@ -327,8 +327,7 @@ export default function PipelineSeriesRoadmap() {
onChange={setActiveTab}
size="sm"
ariaLabel="Reader Map view"
- mobileDropdown
- mobileSelectId="reader-map-tab"
+ mobileCompact
/>
{activeTab === 'panel' ? (
diff --git a/client/src/pages/Privacy.jsx b/client/src/pages/Privacy.jsx
index bf0c3718df..c09250b6f6 100644
--- a/client/src/pages/Privacy.jsx
+++ b/client/src/pages/Privacy.jsx
@@ -92,8 +92,7 @@ export default function Privacy() {
tabs={TABS}
activeTab={activeTab}
onChange={goToTab}
- mobileDropdown
- mobileSelectId="privacy-tab-select"
+ mobileCompact
ariaLabel="Privacy Center sections"
/>
<div className="pt-4">
diff --git a/client/src/pages/SongBookViewer.jsx b/client/src/pages/SongBookViewer.jsx
index ba7499450a..e790b3ec33 100644
--- a/client/src/pages/SongBookViewer.jsx
+++ b/client/src/pages/SongBookViewer.jsx
@@ -56,7 +56,7 @@ import { useState, useEffect, useMemo, useRef, useCallback } from 'react';
import { useParams, useNavigate, Link } from 'react-router';
import {
ListMusic, ArrowLeft, Save, Trash2, Pencil, Eye, Play, Pause, Plus, Minus,
- ExternalLink, Paperclip, Upload, FileX2, Timer,
+ ExternalLink, Paperclip, Upload, FileX2, Timer, Guitar, Music, Piano,
} from 'lucide-react';
import toast from '../components/ui/Toast';
import FilePickerButton from '../components/ui/FilePickerButton';
@@ -134,7 +134,11 @@ const toDraft = (song) => ({
});
// Instrument-view toggle tabs (chord-diagram rendering — never mutates the record).
-const VIEW_TABS = VOICING_INSTRUMENTS.map((viewId) => ({ id: viewId, label: instrumentLabel(viewId) }));
+const VIEW_ICONS = { guitar: Guitar, ukulele: Music, piano: Piano };
+// Icons, not just labels: TabPills draws the icon row on a phone only when every
+// tab has one, and this bar sits beside the transport controls where the labels
+// are the first thing squeezed out.
+const VIEW_TABS = VOICING_INSTRUMENTS.map((viewId) => ({ id: viewId, label: instrumentLabel(viewId), icon: VIEW_ICONS[viewId] }));
// Worked example in the editor's placeholder — the grid DSL is easier to copy
// than to describe. Invented groove (privacy convention).
@@ -962,8 +966,7 @@ export default function SongBookViewer() {
activeTab={instrumentView}
onChange={setInstrumentView}
ariaLabel="Instrument view"
- mobileDropdown
- mobileSelectId="song-instrument-view"
+ mobileCompact
/>
)}
diff --git a/client/src/pages/SongBookViewer.test.jsx b/client/src/pages/SongBookViewer.test.jsx
index b3b6e53e41..20f742bf2d 100644
--- a/client/src/pages/SongBookViewer.test.jsx
+++ b/client/src/pages/SongBookViewer.test.jsx
@@ -306,6 +306,11 @@ describe('SongBookViewer', () => {
});
describe('instrument-view toggle (#2656)', () => {
+ // The view picker is a TabPills bar (icon-only on a phone), so the selected
+ // view is the tab carrying aria-selected, not a select's value.
+ const activeInstrumentView = () => within(screen.getByRole('tablist', { name: 'Instrument view' }))
+ .getAllByRole('tab').find((tab) => tab.getAttribute('aria-selected') === 'true')?.textContent;
+
// Sheet with a tab staff so the non-guitar collapse note is observable.
// Six staff lines: identifiably GUITAR tab, so non-guitar views collapse
// it under the guitar-specific label (a ≤4-line staff would stay visible
@@ -323,8 +328,7 @@ E|--3-----|`;
it('defaults to the song instrument (guitar) and shows the chords-used strip', async () => {
renderPage();
expect(await screen.findByText('Chorus')).toBeTruthy();
- const select = screen.getByRole('combobox', { name: 'Instrument view' });
- expect(select.value).toBe('guitar');
+ expect(activeInstrumentView()).toBe('Guitar');
expect(screen.getByRole('button', { name: /Chords used/ })).toBeTruthy();
});
@@ -332,7 +336,7 @@ E|--3-----|`;
api.getSong.mockResolvedValue(song({ instrument: 'piano', content: { format: 'tab', text: TAB_SHEET } }));
renderPage();
expect(await screen.findByText('Chorus')).toBeTruthy();
- expect(screen.getByRole('combobox', { name: 'Instrument view' }).value).toBe('piano');
+ expect(activeInstrumentView()).toBe('Piano');
expect(screen.getByText(/guitar tab — switch to Guitar view/)).toBeTruthy();
expect(screen.queryByText('e|--3--2--|')).toBeNull();
});
@@ -341,14 +345,14 @@ E|--3-----|`;
api.getSong.mockResolvedValue(song({ instrument: 'bass' }));
renderPage();
expect(await screen.findByText('Chorus')).toBeTruthy();
- expect(screen.getByRole('combobox', { name: 'Instrument view' }).value).toBe('guitar');
+ expect(activeInstrumentView()).toBe('Guitar');
});
it('honors a ?view= deep link over the song instrument', async () => {
api.getSong.mockResolvedValue(song({ content: { format: 'tab', text: TAB_SHEET } }));
renderPage('/songbook/abc?view=ukulele');
expect(await screen.findByText('Chorus')).toBeTruthy();
- expect(screen.getByRole('combobox', { name: 'Instrument view' }).value).toBe('ukulele');
+ expect(activeInstrumentView()).toBe('Ukulele');
expect(screen.getByText(/guitar tab — switch to Guitar view/)).toBeTruthy();
});
@@ -357,7 +361,7 @@ E|--3-----|`;
renderPage();
expect(await screen.findByText('Chorus')).toBeTruthy();
expect(screen.getByText('e|--3--2--|')).toBeTruthy();
- fireEvent.change(screen.getByRole('combobox', { name: 'Instrument view' }), { target: { value: 'piano' } });
+ fireEvent.click(screen.getByRole('tab', { name: 'Piano' }));
// Tab staff collapses; a chord popover now shows piano chips.
expect(screen.getByText(/guitar tab — switch to Guitar view/)).toBeTruthy();
fireEvent.click(screen.getAllByRole('button', { name: 'Am' })[0]);
@@ -488,7 +492,7 @@ K: o - - - - - o -`;
expect(await screen.findByLabelText('Play along')).toBeTruthy();
expect(screen.queryByLabelText('Transpose up')).toBeNull();
expect(screen.queryByLabelText('Transpose down')).toBeNull();
- expect(screen.queryByRole('combobox', { name: 'Instrument view' })).toBeNull();
+ expect(screen.queryByRole('tablist', { name: 'Instrument view' })).toBeNull();
// The kit strip scrolls horizontally under its own playhead — a vertical
// autoscroll play button beside it would be a second, conflicting "play".
expect(screen.queryByLabelText('Autoscroll speed')).toBeNull();
diff --git a/client/src/pages/Sprites.jsx b/client/src/pages/Sprites.jsx
index 4d0a9aebef..0bebafcd48 100644
--- a/client/src/pages/Sprites.jsx
+++ b/client/src/pages/Sprites.jsx
@@ -544,8 +544,7 @@ export default function Sprites() {
<TabPills
variant="pills"
size="sm"
- mobileDropdown
- mobileSelectId="sprite-workspace-tab"
+ mobileCompact
ariaLabel="Sprite workspace"
tabs={[
{ id: 'library', label: 'Assets', icon: Images },