Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(settings): reconfigure settings menu to sidebar nav (#3962)

Aidan Holloway-Bidwell2050f1f18fb9
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsx
index 922fda513a..8ffed4626b 100644
--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx
+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx
@@ -40,26 +40,26 @@ import { ContextMenuContent, MenuItem } from '@core/component/ContextMenu';
import { inboxIconProps } from '@core/component/inboxIcon';
import { UserIcon } from '@core/component/UserIcon';
import {
- DEV_MODE_ENV,
- ENABLE_APP_STORE_QR_CODE,
ENABLE_CALLS,
ENABLE_CRM,
ENABLE_HOME_OVERRIDE,
ENABLE_NEW_PRICING_OVERRIDE,
- ENABLE_TEAMS_OVERRIDE,
} from '@core/constant/featureFlags';
import {
type SettingsTab,
useSettingsState,
} from '@core/constant/SettingsState';
+import {
+ getSettingsTabItem,
+ useSettingsTabAvailable,
+ useSettingsTabs,
+} from '@core/constant/settingsTabsConfig';
import { useUserId } from '@core/context/user';
import { registerHotkey } from '@core/hotkey/hotkeys';
import { clearPressedKeys } from '@core/hotkey/state';
import { type HotkeyToken, TOKENS } from '@core/hotkey/tokens';
import type { ValidHotkey } from '@core/hotkey/types';
import { activateClosestDOMScope } from '@core/hotkey/utils';
-import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
-import { isTouchDevice } from '@core/mobile/isTouchDevice';
import LogoIcon from '@icon/macro-logo.svg';
import { AnimatedSquareCommandKIcon } from '@icon/square-command-k';
import { AnimatedSquareSidebarIcon } from '@icon/square-sidebar';
@@ -79,19 +79,13 @@ import { useNotificationSettings } from '@notifications';
import BellIcon from '@phosphor/bell.svg';
import CaretDownIcon from '@phosphor/caret-down.svg';
import CaretUpIcon from '@phosphor/caret-up.svg';
-import DeviceMobileIcon from '@phosphor/device-mobile-speaker.svg';
import HomeIcon from '@phosphor/house.svg';
-import KeyboardIcon from '@phosphor/keyboard.svg';
-import PaintBucketIcon from '@phosphor/paint-bucket.svg';
import PlayIcon from '@phosphor/play.svg';
-import PlugIcon from '@phosphor/plug.svg';
-import UserIconPhosphor from '@phosphor/user.svg';
-import UsersThreeIcon from '@phosphor/users-three.svg';
import { useEmailLinksQuery } from '@queries/email/link';
import { debounce } from '@solid-primitives/scheduled';
import { makePersisted } from '@solid-primitives/storage';
import { useLocation } from '@solidjs/router';
-import { Button, cn, Dropdown, Hotkey } from '@ui';
+import { Button, cn, Dropdown, Hotkey, NavRow } from '@ui';
import {
type Component,
createEffect,
@@ -485,12 +479,8 @@ const SidebarShortcutLink = (props: SidebarShortcutLinkProps) => {
const [isHovering, setIsHovering] = createSignal(false);
return (
- <Button
+ <NavRow
draggable={false}
- variant="ghost"
- class={cn(
- 'flex items-center justify-start text-sm gap-2 cursor-default w-full rounded-md py-1 text-ink-extra-muted not-disabled:hover:bg-ink/3'
- )}
tooltipPlacement="right"
label={props.isSlim() ? props.label : undefined}
onMouseEnter={() => setIsHovering(true)}
@@ -508,83 +498,10 @@ const SidebarShortcutLink = (props: SidebarShortcutLinkProps) => {
<div class="flex items-center gap-1 group-data-[slim=true]/sidebar:hidden">
<span class="whitespace-nowrap">{props.label}</span>
</div>
- </Button>
+ </NavRow>
);
};
-type SettingsMenuItem = {
- tab: SettingsTab;
- label: string;
- icon: Component<{ class?: string }>;
-};
-
-const SETTINGS_MENU_TOP_ITEMS: SettingsMenuItem[] = [
- {
- tab: 'Mobile App',
- label: 'App',
- icon: DeviceMobileIcon,
- },
- {
- tab: 'Agent',
- label: 'MCPs',
- icon: PlugIcon,
- },
- {
- tab: 'Team',
- label: 'Team',
- icon: UsersThreeIcon,
- },
-];
-
-const SETTINGS_MENU_BOTTOM_ITEMS: SettingsMenuItem[] = [
- {
- tab: 'Shortcuts',
- label: 'Shortcuts',
- icon: KeyboardIcon,
- },
- {
- tab: 'Appearance',
- label: 'Appearance',
- icon: PaintBucketIcon,
- },
- {
- tab: 'Account',
- label: 'Account',
- icon: UserIconPhosphor,
- },
-];
-
-/**
- * Mirrors the gating in `Settings.tsx`'s `settingsTabs()`. Use to filter the
- * sidebar menu/shortcuts and to guard `setActiveTabId` callers so we never
- * activate a tab that the settings panel won't render.
- */
-const useIsSettingsTabAvailable = () => {
- const teamsFlag = useFeatureFlag('enable-teams-settings', {
- enabledOverride: ENABLE_TEAMS_OVERRIDE,
- });
-
- return (tab: SettingsTab): boolean => {
- switch (tab) {
- case 'Appearance':
- case 'Account':
- return true;
- case 'Team':
- return teamsFlag().enabled;
- case 'Shortcuts':
- return !isTouchDevice();
- case 'Mobile App':
- return ENABLE_APP_STORE_QR_CODE && !isNativeMobilePlatform();
- case 'Agent':
- return !isNativeMobilePlatform();
- case 'Mobile':
- return isNativeMobilePlatform() && DEV_MODE_ENV;
- default:
- return false;
- }
- };
-};
-
/**
* A normalised action button for the sidebar footer area.
*
@@ -601,11 +518,8 @@ const SidebarActionButton = (props: SidebarActionButtonProps) => {
: (props.disabled ?? false);
return (
- <Button
- class={cn(
- 'flex items-center justify-start group-data-[slim=true]/sidebar:justify-center text-sm gap-2 cursor-default w-full rounded-md py-1 text-ink-extra-muted not-disabled:hover:bg-ink/3'
- )}
- variant="ghost"
+ <NavRow
+ class="group-data-[slim=true]/sidebar:justify-center"
tooltipPlacement="right"
label={props.isSlim() ? props.label : undefined}
hotkey={props.isSlim() ? props.hotkeyToken : undefined}
@@ -631,7 +545,7 @@ const SidebarActionButton = (props: SidebarActionButtonProps) => {
</div>
)}
</Show>
- </Button>
+ </NavRow>
);
};
@@ -668,19 +582,12 @@ const SidebarHeaderIconButton = (props: {
type SidebarSettingsWidgetProps = {
isSlim: () => boolean;
onSelect: (tab: SettingsTab) => void;
- isTabAvailable: (tab: SettingsTab) => boolean;
};
const SidebarSettingsWidget = (props: SidebarSettingsWidgetProps) => {
const userId = useUserId();
const [onboardingModalOpen, setOnboardingModalOpen] = createSignal(false);
-
- const topItems = createMemo(() =>
- SETTINGS_MENU_TOP_ITEMS.filter((item) => props.isTabAvailable(item.tab))
- );
- const bottomItems = createMemo(() =>
- SETTINGS_MENU_BOTTOM_ITEMS.filter((item) => props.isTabAvailable(item.tab))
- );
+ const { groups: settingGroups } = useSettingsTabs();
return (
<Dropdown placement="top-start" gutter={6}>
@@ -731,42 +638,28 @@ const SidebarSettingsWidget = (props: SidebarSettingsWidgetProps) => {
<span class="text-ink">Play tutorial</span>
</Dropdown.Item>
</Dropdown.Group>
- <Dropdown.Group>
- <For each={topItems()}>
- {(item) => (
- <Dropdown.Item
- class="flex items-center gap-2 px-2.5 py-2 text-sm cursor-default outline-none text-ink-muted"
- onSelect={() => props.onSelect(item.tab)}
- >
- <span class="size-5 flex items-center justify-center">
- <Dynamic
- component={item.icon}
- class="size-4 shrink-0 text-ink-extra-muted"
- />
- </span>
- <span class="text-ink">{item.label}</span>
- </Dropdown.Item>
- )}
- </For>
- </Dropdown.Group>
- <Dropdown.Group>
- <For each={bottomItems()}>
- {(item) => (
- <Dropdown.Item
- class="flex items-center gap-2 px-2.5 py-2 text-sm cursor-default outline-none text-ink-muted"
- onSelect={() => props.onSelect(item.tab)}
- >
- <span class="size-5 flex items-center justify-center">
- <Dynamic
- component={item.icon}
- class="size-4 shrink-0 text-ink-extra-muted"
- />
- </span>
- <span class="text-ink">{item.label}</span>
- </Dropdown.Item>
- )}
- </For>
- </Dropdown.Group>
+ <For each={settingGroups()}>
+ {(group) => (
+ <Dropdown.Group>
+ <For each={group.items}>
+ {(item) => (
+ <Dropdown.Item
+ class="flex items-center gap-2 px-2.5 py-2 text-sm cursor-default outline-none text-ink-muted"
+ onSelect={() => props.onSelect(item.tab)}
+ >
+ <span class="size-5 flex items-center justify-center">
+ <Dynamic
+ component={item.icon}
+ class="size-4 shrink-0 text-ink-extra-muted"
+ />
+ </span>
+ <span class="text-ink">{item.label}</span>
+ </Dropdown.Item>
+ )}
+ </For>
+ </Dropdown.Group>
+ )}
+ </For>
</Dropdown.Content>
<InteractiveOnboardingModal
open={onboardingModalOpen()}
@@ -794,11 +687,18 @@ const DASHBOARD_LINK: SidebarItem = {
hotkeyToken: TOKENS.sidebar.goTo.home,
};
+/**
+ * Settings tabs surfaced as always-visible quick links above the settings
+ * widget. Label/icon come from the settings tab config (see
+ * `getSettingsTabItem`); this list only decides which tabs to promote.
+ */
+const PROMOTED_SETTINGS_TABS: SettingsTab[] = ['Mobile App', 'Agent', 'Team'];
+
export const AppSidebar = (props: AppSidebarProps) => {
const analytics = useAnalytics();
const layout = useSplitLayout();
const { openSettings, setActiveTabId, settingsOpen } = useSettingsState();
- const isTabAvailable = useIsSettingsTabAvailable();
+ const isTabAvailable = useSettingsTabAvailable();
const notificationSettings = useNotificationSettings();
const callCtx = useCallContextOptional();
@@ -1116,38 +1016,26 @@ export const AppSidebar = (props: AppSidebarProps) => {
</Show>
<div class="w-full px-2 flex flex-col gap-1 mb-1">
- <Show when={isTabAvailable('Mobile App')}>
- <SidebarShortcutLink
- label="App"
- isSlim={isSlim}
- onClick={() => openSettingsTab('Mobile App')}
- icon={() => <DeviceMobileIcon class="size-4" />}
- />
- </Show>
- <Show when={isTabAvailable('Agent')}>
- <SidebarShortcutLink
- label="MCPs"
- isSlim={isSlim}
- onClick={() => openSettingsTab('Agent')}
- icon={() => <PlugIcon class="size-4" />}
- />
- </Show>
- <Show when={isTabAvailable('Team')}>
- <SidebarShortcutLink
- label="Team"
- isSlim={isSlim}
- onClick={() => openSettingsTab('Team')}
- icon={() => <UsersThreeIcon class="size-4" />}
- />
- </Show>
+ <For each={PROMOTED_SETTINGS_TABS}>
+ {(tab) => (
+ <Show
+ when={isTabAvailable(tab) ? getSettingsTabItem(tab) : undefined}
+ >
+ {(item) => (
+ <SidebarShortcutLink
+ label={item().label}
+ isSlim={isSlim}
+ onClick={() => openSettingsTab(tab)}
+ icon={item().icon}
+ />
+ )}
+ </Show>
+ )}
+ </For>
</div>
<div class="w-full px-2">
- <SidebarSettingsWidget
- isSlim={isSlim}
- onSelect={openSettingsTab}
- isTabAvailable={isTabAvailable}
- />
+ <SidebarSettingsWidget isSlim={isSlim} onSelect={openSettingsTab} />
</div>
<InviteModal />
</div>
@@ -1233,17 +1121,12 @@ const SidebarLink = (props: SidebarLinkProps) => {
return (
<ContextMenu>
<ContextMenu.Trigger class="w-full">
- <Button
+ <NavRow
draggable={false}
- variant="ghost"
data-sidebar-link={props.id}
data-active={isActive() ? '' : undefined}
- class={cn(
- 'flex items-center justify-start group-data-[slim=true]/sidebar:justify-center text-sm gap-2 cursor-default w-full rounded-md py-1 text-ink-extra-muted not-disabled:hover:bg-ink/3',
- isActive() &&
- !props.suppressActiveStyle &&
- 'bg-ink/6 not-disabled:hover:bg-ink/6 text-ink'
- )}
+ active={isActive() && !props.suppressActiveStyle}
+ class="group-data-[slim=true]/sidebar:justify-center"
tooltipPlacement="right"
onMouseEnter={() => setIsHovering(true)}
label={
@@ -1348,7 +1231,7 @@ const SidebarLink = (props: SidebarLinkProps) => {
<Hotkey token={props.hotkeyToken} />
</div>
</Show>
- </Button>
+ </NavRow>
</ContextMenu.Trigger>
<ContextMenu.Portal>
diff --git a/js/app/packages/app/component/settings/Settings.tsx b/js/app/packages/app/component/settings/Settings.tsx
index 03acf4b9c8..c0b8cdb7aa 100644
--- a/js/app/packages/app/component/settings/Settings.tsx
+++ b/js/app/packages/app/component/settings/Settings.tsx
@@ -1,30 +1,23 @@
-import { onMount, Show, Suspense } from 'solid-js';
+import { For, onMount, Show, Suspense } from 'solid-js';
import { type SettingsTab, useSettingsState } from '@core/constant/SettingsState';
-import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
+import { useSettingsTabs } from '@core/constant/settingsTabsConfig';
import { isMobile } from '@core/mobile/isMobile';
-import { DEV_MODE_ENV, ENABLE_APP_STORE_QR_CODE, ENABLE_TEAMS_OVERRIDE } from '@core/constant/featureFlags';
-import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { MobileApp } from './MobileApp';
import { Agent } from './Agent';
import { Admin } from './Admin';
import { Appearance } from './Appearance';
-import { useHasPermission } from '@core/context/user';
-import { PERMISSION_IDS } from '@core/constant/permissions';
import { MobileTabs } from '@core/component/MobileTabs';
-import { TabsInset } from '@core/component/TabsInset';
-import { TabsInsetDropdown } from '@core/component/TabsInsetDropdown';
import { Account } from './Account';
import { Shortcuts } from './Shortcuts';
import { Team } from './Team';
import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';
import type { ValidHotkey } from '@core/hotkey/types';
+import { SideNav } from '@ui';
import {
SplitHeaderLeft,
SplitHeaderRight,
} from '../split-layout/components/SplitHeader';
-import { CollapsibleHeaderItem } from '../split-layout/components/CollapsibleHeaderItem';
import { SettingsButton } from './SettingsButton';
-import { isTouchDevice } from '@core/mobile/isTouchDevice';
export function SettingsPanelComponentWrapper() {
return (
@@ -45,27 +38,17 @@ type SettingsPanelProps = {
function SettingsPanel(props: SettingsPanelProps) {
const { closeSettings, activeTabId, setActiveTabId } = useSettingsState();
- const teamsFlag = useFeatureFlag('enable-teams-settings', { enabledOverride: ENABLE_TEAMS_OVERRIDE });
- const hasAdminPanel = useHasPermission(PERMISSION_IDS.WRITE_ADMIN_PANEL);
+ const { groups, flatTabs, isAvailable } = useSettingsTabs();
+
+ // A tab's content renders only when it's both selected and still available
+ // (gating lives solely in the settings tab config).
+ const isCurrentTab = (tab: SettingsTab) =>
+ activeTabId() === tab && isAvailable(tab);
// Set up hotkey scope for settings panel
const [attachHotkeys, settingsHotkeyScope] = useHotkeyDOMScope('settings');
let settingsContainerRef: HTMLDivElement | undefined;
- function settingsTabs() {
- const tabs: { value: string; label: string }[] = [
- { value: 'Appearance', label: 'Appearance' },
- { value: 'Account', label: 'Account' },
- ];
- if (teamsFlag().enabled) { tabs.push({ value: 'Team', label: 'Team' }) }
- if (!isTouchDevice()) { tabs.push({ value: 'Shortcuts', label: 'Shortcuts' }) }
- if (ENABLE_APP_STORE_QR_CODE && !isNativeMobilePlatform()) { tabs.push({ value: 'Mobile App', label: 'App' }) }
- if (!isNativeMobilePlatform()) { tabs.push({ value: 'Agent', label: 'MCPs' }) }
- if (isNativeMobilePlatform() && DEV_MODE_ENV) { tabs.push({ value: 'Mobile', label: 'Mobile Dev Tools' }) }
- if (hasAdminPanel()) { tabs.push({ value: 'Admin', label: 'Admin' }) }
- return tabs;
- }
-
// Attach hotkeys to the settings container
onMount(() => {
if (settingsContainerRef) {
@@ -88,11 +71,11 @@ function SettingsPanel(props: SettingsPanelProps) {
// Helper to navigate to a tab by index
function navigateToTabIndex(index: number): boolean {
- const tabs = settingsTabs();
+ const tabs = flatTabs();
if (index >= 0 && index < tabs.length) {
const tab = tabs[index];
if (tab) {
- setActiveTabId(tab.value as SettingsTab);
+ setActiveTabId(tab.tab);
return true;
}
}
@@ -100,19 +83,18 @@ function SettingsPanel(props: SettingsPanelProps) {
}
function getCurrentTabIndex() {
- const tabs = settingsTabs();
- return tabs.findIndex(tab => tab.value === activeTabId());
+ return flatTabs().findIndex(tab => tab.tab === activeTabId());
}
function handleNextTab() {
- const tabs = settingsTabs();
+ const tabs = flatTabs();
const nextIndex = getCurrentTabIndex() >= tabs.length - 1 ? 0 : getCurrentTabIndex() + 1;
navigateToTabIndex(nextIndex);
return true;
}
function handlePreviousTab() {
- const tabs = settingsTabs();
+ const tabs = flatTabs();
const nextIndex = getCurrentTabIndex() <= 0 ? tabs.length - 1 : getCurrentTabIndex() - 1;
navigateToTabIndex(nextIndex);
return true;
@@ -150,7 +132,7 @@ function SettingsPanel(props: SettingsPanelProps) {
}
const handleTabChange = (value: string) => {
- if (settingsTabs().some((tab) => tab.value === value)) {
+ if (flatTabs().some((tab) => tab.tab === value)) {
setActiveTabId(value as SettingsTab);
}
}
@@ -160,7 +142,7 @@ function SettingsPanel(props: SettingsPanelProps) {
<div class="bg-surface border-t border-edge-muted h-11 shrink-0 px-1 flex">
<div class="flex-1 min-w-0 h-full">
<MobileTabs
- list={settingsTabs()}
+ list={flatTabs().map((tab) => ({ value: tab.tab, label: tab.label }))}
value={activeTabId()}
defaultValue="Appearance"
onChange={handleTabChange}
@@ -183,58 +165,59 @@ function SettingsPanel(props: SettingsPanelProps) {
<h1 class="font-semibold text-ink select-none text-sm shrink-0">
Settings
</h1>
- <Show when={!isMobile()}>
- <CollapsibleHeaderItem
- id="settings-tabs"
- priority={1}
- containerClass="h-full"
- expanded={() => (
- <TabsInset
- list={settingsTabs()}
- value={activeTabId()}
- defaultValue="Appearance"
- onChange={handleTabChange}
- />
- )}
- collapsed={() => (
- <TabsInsetDropdown
- list={settingsTabs()}
- value={activeTabId()}
- defaultValue="Appearance"
- onChange={handleTabChange}
- />
- )}
- />
- </Show>
</div>
</SplitHeaderLeft>
- <div class="relative grow min-h-1 overflow-auto">
- <Show when={activeTabId() === 'Account'}>
- <Suspense>
- <Account />
- </Suspense>
- </Show>
- <Show when={activeTabId() === 'Appearance'}>
- <Appearance />
- </Show>
- <Show when={activeTabId() === 'Shortcuts' && !isTouchDevice()}>
- <Shortcuts />
- </Show>
- <Show when={activeTabId() === 'Team' && teamsFlag().enabled}>
- <Suspense>
- <Team />
- </Suspense>
- </Show>
- <Show when={activeTabId() === 'Mobile App' && ENABLE_APP_STORE_QR_CODE && !isNativeMobilePlatform()}>
- <MobileApp />
- </Show>
- <Show when={activeTabId() === 'Agent' && !isNativeMobilePlatform()}>
- <Agent />
- </Show>
- <Show when={activeTabId() === 'Admin' && hasAdminPanel()}>
- <Admin />
+ <div class="flex grow min-h-1 overflow-hidden">
+ <Show when={!isMobile()}>
+ <SideNav>
+ <For each={groups()}>
+ {(group) => (
+ <SideNav.Group label={group.label}>
+ <For each={group.items}>
+ {(item) => (
+ <SideNav.Item
+ icon={item.icon}
+ active={activeTabId() === item.tab}
+ onSelect={() => handleTabChange(item.tab)}
+ >
+ {item.label}
+ </SideNav.Item>
+ )}
+ </For>
+ </SideNav.Group>
+ )}
+ </For>
+ </SideNav>
</Show>
+
+ <div class="relative grow min-h-1 min-w-0 overflow-auto">
+ <Show when={isCurrentTab('Account')}>
+ <Suspense>
+ <Account />
+ </Suspense>
+ </Show>
+ <Show when={isCurrentTab('Appearance')}>
+ <Appearance />
+ </Show>
+ <Show when={isCurrentTab('Shortcuts')}>
+ <Shortcuts />
+ </Show>
+ <Show when={isCurrentTab('Team')}>
+ <Suspense>
+ <Team />
+ </Suspense>
+ </Show>
+ <Show when={isCurrentTab('Mobile App')}>
+ <MobileApp />
+ </Show>
+ <Show when={isCurrentTab('Agent')}>
+ <Agent />
+ </Show>
+ <Show when={isCurrentTab('Admin')}>
+ <Admin />
+ </Show>
+ </div>
</div>
<Show when={isMobile()}>
diff --git a/js/app/packages/core/constant/settingsTabsConfig.tsx b/js/app/packages/core/constant/settingsTabsConfig.tsx
new file mode 100644
index 0000000000..f1b5c34f64
--- /dev/null
+++ b/js/app/packages/core/constant/settingsTabsConfig.tsx
@@ -0,0 +1,131 @@
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
+import BugIcon from '@phosphor/bug.svg';
+import DeviceMobileIcon from '@phosphor/device-mobile-speaker.svg';
+import KeyboardIcon from '@phosphor/keyboard.svg';
+import PaintBucketIcon from '@phosphor/paint-bucket.svg';
+import PlugIcon from '@phosphor/plug.svg';
+import UserIconPhosphor from '@phosphor/user.svg';
+import UsersThreeIcon from '@phosphor/users-three.svg';
+import { type Component, createMemo } from 'solid-js';
+import { useHasPermission } from '../context/user';
+import { isNativeMobilePlatform } from '../mobile/isNativeMobilePlatform';
+import { isTouchDevice } from '../mobile/isTouchDevice';
+import {
+ DEV_MODE_ENV,
+ ENABLE_APP_STORE_QR_CODE,
+ ENABLE_TEAMS_OVERRIDE,
+} from './featureFlags';
+import { PERMISSION_IDS } from './permissions';
+import type { SettingsTab } from './SettingsState';
+
+export type SettingsTabItem = {
+ tab: SettingsTab;
+ label: string;
+ icon: Component<{ class?: string; triggerAnimation?: boolean }>;
+};
+
+export type SettingsTabGroup = {
+ label: string;
+ items: SettingsTabItem[];
+};
+
+/**
+ * Single source of truth for the settings categories: ordering, labels, icons
+ * and grouping. Consumed by the settings panel's side nav (and bottom tabs) and
+ * the app sidebar's settings dropdown. Group order also defines keyboard nav
+ * order (see `flatTabs` in {@link useSettingsTabs}).
+ *
+ * Presentation-free and hook-free: gating lives in {@link useSettingsTabAvailable}.
+ */
+export const SETTINGS_TAB_GROUPS: SettingsTabGroup[] = [
+ {
+ label: 'General',
+ items: [
+ { tab: 'Appearance', label: 'Appearance', icon: PaintBucketIcon },
+ { tab: 'Account', label: 'Account', icon: UserIconPhosphor },
+ { tab: 'Mobile App', label: 'Mobile App', icon: DeviceMobileIcon },
+ { tab: 'Shortcuts', label: 'Shortcuts', icon: KeyboardIcon },
+ ],
+ },
+ {
+ label: 'Workspace',
+ items: [
+ { tab: 'Team', label: 'Team', icon: UsersThreeIcon },
+ { tab: 'Agent', label: 'MCPs', icon: PlugIcon },
+ ],
+ },
+ {
+ label: 'Admin',
+ items: [{ tab: 'Admin', label: 'Debug', icon: BugIcon }],
+ },
+];
+
+/** Flattened view of {@link SETTINGS_TAB_GROUPS} for direct tab lookups. */
+const SETTINGS_TAB_ITEMS = SETTINGS_TAB_GROUPS.flatMap((group) => group.items);
+
+/**
+ * Look up a single tab's presentation (label + icon). Lets consumers that
+ * surface individual tabs (e.g. the sidebar's quick links) reuse the config's
+ * label/icon instead of hardcoding their own.
+ */
+export const getSettingsTabItem = (
+ tab: SettingsTab
+): SettingsTabItem | undefined =>
+ SETTINGS_TAB_ITEMS.find((item) => item.tab === tab);
+
+/**
+ * Returns a predicate gating which settings tabs are available given feature
+ * flags and platform. This is the single gate that the settings panel and the
+ * app sidebar both rely on — keep tab rendering guarded by it so we never
+ * surface a tab the panel won't render.
+ */
+export const useSettingsTabAvailable = () => {
+ const teamsFlag = useFeatureFlag('enable-teams-settings', {
+ enabledOverride: ENABLE_TEAMS_OVERRIDE,
+ });
+ const hasAdminPanel = useHasPermission(PERMISSION_IDS.WRITE_ADMIN_PANEL);
+
+ return (tab: SettingsTab): boolean => {
+ switch (tab) {
+ case 'Appearance':
+ case 'Account':
+ return true;
+ case 'Team':
+ return teamsFlag().enabled;
+ case 'Shortcuts':
+ return !isTouchDevice();
+ case 'Mobile App':
+ return ENABLE_APP_STORE_QR_CODE && !isNativeMobilePlatform();
+ case 'Agent':
+ return !isNativeMobilePlatform();
+ case 'Mobile':
+ return isNativeMobilePlatform() && DEV_MODE_ENV;
+ case 'Admin':
+ return hasAdminPanel();
+ default:
+ return false;
+ }
+ };
+};
+
+/**
+ * Reactive view of the settings tabs: groups filtered to the currently
+ * available tabs (empty groups dropped), plus a flattened ordered list for
+ * keyboard navigation and the mobile bottom tabs.
+ */
+export const useSettingsTabs = () => {
+ const isAvailable = useSettingsTabAvailable();
+
+ const groups = createMemo<SettingsTabGroup[]>(() =>
+ SETTINGS_TAB_GROUPS.map((group) => ({
+ label: group.label,
+ items: group.items.filter((item) => isAvailable(item.tab)),
+ })).filter((group) => group.items.length > 0)
+ );
+
+ const flatTabs = createMemo<SettingsTabItem[]>(() =>
+ groups().flatMap((group) => group.items)
+ );
+
+ return { groups, flatTabs, isAvailable };
+};
diff --git a/js/app/packages/ui/components/NavRow.tsx b/js/app/packages/ui/components/NavRow.tsx
new file mode 100644
index 0000000000..ca4ab89a43
--- /dev/null
+++ b/js/app/packages/ui/components/NavRow.tsx
@@ -0,0 +1,29 @@
+import { splitProps } from 'solid-js';
+import { cn } from '../utils/classname';
+import { Button, type ButtonProps } from './Button';
+
+/**
+ * A vertical nav row rendered as a ghost {@link Button}: the shared base/active
+ * styling for sidebar-style rows (icon + label). Used by the settings `SideNav`
+ * and the app sidebar's row components so the row visuals live in one place.
+ *
+ * Owns only the base + active visuals. Container-specific modifiers — horizontal
+ * padding, slim-mode `justify-center`, etc. — are passed through via `class`,
+ * which is merged last so callers can extend without leaking layout concerns in.
+ */
+const NAV_ROW_BASE =
+ 'flex items-center justify-start text-sm gap-2 cursor-default w-full rounded-md py-1 text-ink-extra-muted not-disabled:hover:bg-ink/3';
+const NAV_ROW_ACTIVE = 'bg-ink/6 not-disabled:hover:bg-ink/6 text-ink';
+
+export type NavRowProps = ButtonProps & { active?: boolean };
+
+export const NavRow = (props: NavRowProps) => {
+ const [local, rest] = splitProps(props, ['active', 'class']);
+ return (
+ <Button
+ variant="ghost"
+ {...rest}
+ class={cn(NAV_ROW_BASE, local.active && NAV_ROW_ACTIVE, local.class)}
+ />
+ );
+};
diff --git a/js/app/packages/ui/components/SideNav.tsx b/js/app/packages/ui/components/SideNav.tsx
new file mode 100644
index 0000000000..f757aaebbc
--- /dev/null
+++ b/js/app/packages/ui/components/SideNav.tsx
@@ -0,0 +1,86 @@
+import { type Component, createSignal, type ParentProps, Show } from 'solid-js';
+import { Dynamic } from 'solid-js/web';
+import { cn } from '../utils/classname';
+import { NavRow } from './NavRow';
+
+/*
+<SideNav>
+ <SideNav.Group label="General">
+ <SideNav.Item icon={SomeIcon} active onSelect={() => {}}>Account</SideNav.Item>
+ </SideNav.Group>
+</SideNav>
+*/
+
+type SideNavProps = ParentProps<{ class?: string }>;
+
+type SideNavGroupProps = ParentProps<{ label?: string; class?: string }>;
+
+type SideNavIcon = Component<{ class?: string; triggerAnimation?: boolean }>;
+
+type SideNavItemProps = ParentProps<{
+ icon?: SideNavIcon;
+ active?: boolean;
+ disabled?: boolean;
+ class?: string;
+ onSelect?: () => void;
+}>;
+
+function SideNavRoot(props: SideNavProps) {
+ return (
+ <nav
+ class={cn(
+ 'w-[220px] shrink-0 overflow-auto border-r border-edge-muted p-2 flex flex-col gap-2',
+ props.class
+ )}
+ >
+ {props.children}
+ </nav>
+ );
+}
+
+function SideNavGroup(props: SideNavGroupProps) {
+ return (
+ <div class={cn('flex flex-col', props.class)}>
+ <Show when={props.label}>
+ <div class="px-2 h-7 flex items-center text-xs text-ink-extra-muted">
+ {props.label}
+ </div>
+ </Show>
+ {props.children}
+ </div>
+ );
+}
+
+function SideNavItem(props: SideNavItemProps) {
+ const [hovering, setHovering] = createSignal(false);
+
+ const handleClick = (event: MouseEvent) => {
+ event.preventDefault();
+ props.onSelect?.();
+ };
+
+ return (
+ <NavRow
+ active={props.active}
+ disabled={props.disabled}
+ class={cn('px-2', props.class)}
+ onClick={handleClick}
+ onMouseEnter={() => setHovering(true)}
+ onMouseLeave={() => setHovering(false)}
+ >
+ <Show when={props.icon}>
+ {(icon) => (
+ <div class="size-4 shrink-0">
+ <Dynamic component={icon()} triggerAnimation={hovering()} />
+ </div>
+ )}
+ </Show>
+ <span class="whitespace-nowrap">{props.children}</span>
+ </NavRow>
+ );
+}
+
+export const SideNav = Object.assign(SideNavRoot, {
+ Group: SideNavGroup,
+ Item: SideNavItem,
+});
diff --git a/js/app/packages/ui/index.ts b/js/app/packages/ui/index.ts
index 9136eb1999..454d46cf96 100644
--- a/js/app/packages/ui/index.ts
+++ b/js/app/packages/ui/index.ts
@@ -34,11 +34,14 @@ export { Hotkey } from './components/Hotkey';
export { HoverCard } from './components/HoverCard';
export { Layer } from './components/Layer';
export { LogoProgress } from './components/LogoProgress';
+export type { NavRowProps } from './components/NavRow';
+export { NavRow } from './components/NavRow';
export { Panel } from './components/Panel';
export { Scroll } from './components/Scroll';
export { SegmentedControl } from './components/SegmentedControl';
export type { SendButtonProps } from './components/SendButton';
export { SendButton } from './components/SendButton';
+export { SideNav } from './components/SideNav';
export { Surface } from './components/Surface';
export { TabbedControl } from './components/TabbedControl';
export type { ToggleSwitchProps } from './components/ToggleSwitch';