Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(settings): open settings as an ordinary split view (#7469)
Jacob Beckerman500f8dfdb174
diff --git a/apps/web/src/components/app/Layout.tsx b/apps/web/src/components/app/Layout.tsxindex 1199b3bb74..cabb828203 100644--- a/apps/web/src/components/app/Layout.tsx+++ b/apps/web/src/components/app/Layout.tsx@@ -51,7 +51,6 @@ import {enableReminders,} from '@core/constant/featureFlags';import { usePaywallState } from '@core/constant/PaywallState';-import { isSoloSettings } from '@core/constant/SettingsState';import { attachGlobalDOMScope } from '@core/hotkey/hotkeys';import { isMobile } from '@core/mobile/isMobile';import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';@@ -116,9 +115,7 @@ export function Layout(props: RouteSectionProps) {() =>!isTouchDevice() &&isAuthenticated() === true &&- !AUTH_URLS.includes(location.pathname) &&- // Settings-as-the-sole-split has its own tab nav — hide app chrome.- !isSoloSettings()+ !AUTH_URLS.includes(location.pathname));return (diff --git a/apps/web/src/components/app/app-sidebar/sidebar.tsx b/apps/web/src/components/app/app-sidebar/sidebar.tsxindex 04b44b1971..2e664e7a18 100644--- a/apps/web/src/components/app/app-sidebar/sidebar.tsx+++ b/apps/web/src/components/app/app-sidebar/sidebar.tsx@@ -4,7 +4,6 @@ import { useActivityFeedFlag } from '@app/features/activity/use-activity-feed-flimport { useCalendarUiFlag } from '@app/features/calendar/hooks/use-calendar-ui-flag';import { calendarPath } from '@app/features/calendar-view/calendar-url';import { CALENDAR_VIEW_ID } from '@app/features/calendar-view/types';-import { CommandState } from '@app/features/command';import { useGettingStartedEnabled } from '@app/features/getting-started/account-gate';import { requestSearchFocus } from '@app/features/next-soup/soup-view/search-controllers';import { useRecentViewFlag } from '@app/features/next-soup/use-recent-view-flag';@@ -22,19 +21,15 @@ import type {SplitContent,SplitHandle,} from '@components/app/split-layout/layoutManager';-import { useLogout } from '@core/auth/logout';import { ContextMenuContent, MenuItem } from '@core/component/ContextMenu';import { getIconConfig } from '@core/component/EntityIcon';import { toast } from '@core/component/Toast/Toast';-import { UserIcon } from '@core/component/UserIcon';import {ENABLE_CALLS,enableCrm,enableReminders,isFeatureEnabled,} from '@core/constant/featureFlags';-import type { SettingsTab } from '@core/constant/SettingsState';-import { useEmail, 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';@@ -43,16 +38,12 @@ import { activateClosestDOMScope } from '@core/hotkey/utils';import { isTouchDevice } from '@core/mobile/isTouchDevice';import { ContextMenu } from '@kobalte/core/context-menu';import BellIcon from '@phosphor/bell.svg';-import CaretUpIcon from '@phosphor/caret-up.svg';import CompassIcon from '@phosphor/compass.svg';-import GearIcon from '@phosphor/gear.svg';import HomeIcon from '@phosphor/house.svg';import SearchIcon from '@phosphor/magnifying-glass.svg';import ActivityIcon from '@phosphor/pulse.svg';-import SignOutIcon from '@phosphor/sign-out.svg';-import { isRealNamePart, useOwnUserName } from '@queries/auth/user-name-self';import { debounce } from '@solid-primitives/scheduled';-import { cn, Dropdown, Hotkey } from '@ui';+import { cn } from '@ui';import {type Component,createEffect,@@ -370,157 +361,6 @@ export const GoToHotkeys = () => {return <InviteModal />;};-type SidebarSettingsWidgetProps = {- isSlim: () => boolean;- onSelect: (tab: SettingsTab) => void;- onMenuOpenChange?: (open: boolean) => void;- /**- * Icon-only: drops the trigger's leading padding and start alignment so the- * avatar centres in its square, and grows the avatar to nearly fill it. For- * `SidebarRail`, where the name and caret are hidden anyway.- */- compact?: boolean;-};--export const SidebarSettingsWidget = (props: SidebarSettingsWidgetProps) => {- const userId = useUserId();- const email = useEmail();- const logout = useLogout();-- const userName = useOwnUserName();-- // Prefer the user's real name (first/last); fall back to their email.- const displayName = createMemo(() => {- const name = userName();- const parts = [name?.first_name, name?.last_name]- .map((part) => part?.trim())- .filter((part): part is string => isRealNamePart(part));- return parts.length > 0 ? parts.join(' ') : (email() ?? 'Macro User');- });-- return (- <Dropdown- placement="top-start"- gutter={6}- onOpenChange={props.onMenuOpenChange}- >- <Dropdown.Trigger- variant="ghost"- class={cn(- 'flex items-center cursor-default text-ink-extra-muted not-disabled:hover:bg-ink/3 h-9',- props.compact- ? 'justify-center gap-0 p-0'- : 'justify-start gap-3 px-1.5 py-1'- )}- label={displayName()}- fullWidth- tooltipDisabled={!props.isSlim()}- tooltipPlacement="right"- onMouseDown={(e: MouseEvent) => {- if (e.button !== 0) return;- e.preventDefault();- }}- >- <Show- when={userId()}- fallback={- <div- class={cn(- 'shrink-0 rounded-full bg-ink/10',- props.compact ? 'size-8' : 'size-5'- )}- />- }- >- {(id) => (- <div class={cn('shrink-0', props.compact ? 'size-8' : 'size-5')}>- <UserIcon- id={id()}- size="fill"- suppressClick- showTooltip={false}- />- </div>- )}- </Show>- <span class="flex-1 min-w-0 text-left whitespace-nowrap text-sm truncate group-data-[slim=true]/sidebar:hidden">- {displayName()}- </span>- <CaretUpIcon class="size-3 text-ink-extra-muted shrink-0 group-data-[slim=true]/sidebar:hidden" />- </Dropdown.Trigger>- {/*- The menu is shrink-to-fit, so without a cap a long name or email- stretches it instead of engaging the `truncate` below.- */}- <Dropdown.Content class="min-w-[min(16rem,calc(100vw-1rem))] max-w-[min(20rem,calc(100vw-1rem))]">- <Dropdown.Group class="p-1.5 gap-0">- <div class="flex items-center gap-3 px-1 py-1">- <Show- when={userId()}- fallback={<div class="size-10 shrink-0 rounded-full bg-ink/10" />}- >- {(id) => (- <div class="size-10 shrink-0">- <UserIcon- id={id()}- size="fill"- suppressClick- showTooltip={false}- />- </div>- )}- </Show>- <div class="min-w-0">- <div class="truncate text-sm font-semibold text-ink">- {displayName()}- </div>- <div class="truncate text-sm text-ink-muted">{email()}</div>- </div>- </div>- <div class="-mx-1.5 mt-2 mb-1.5 h-px bg-edge-divider" />- <Dropdown.Item- class="flex items-center gap-2 px-2.5 py-2 text-sm cursor-default outline-none text-ink-muted"- onSelect={() => CommandState.open()}- >- <span class="size-5 flex items-center justify-center text-ink-extra-muted">- ⌘- </span>- <span class="flex-1 text-ink">Command menu</span>- <Hotkey- token={TOKENS.global.commandMenu}- theme="subtle"- class="ml-6"- />- </Dropdown.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('Account')}- >- <span class="size-5 flex items-center justify-center">- <GearIcon class="size-4 shrink-0 text-ink-extra-muted" />- </span>- <span class="flex-1 text-ink">Settings</span>- <Hotkey- token={TOKENS.global.toggleSettings}- theme="subtle"- class="ml-6"- />- </Dropdown.Item>- <Dropdown.Item- class="flex items-center gap-2 px-2.5 py-2 text-sm cursor-default outline-none text-failure"- onSelect={() => logout()}- >- <span class="size-5 flex items-center justify-center">- <SignOutIcon class="size-4 shrink-0" />- </span>- <span>Log out</span>- </Dropdown.Item>- </Dropdown.Group>- </Dropdown.Content>- </Dropdown>- );-};-const CALLS_LINK: SidebarItem = {id: 'calls',label: 'Calls',diff --git a/apps/web/src/components/app/sidebar-next/footer-actions.tsx b/apps/web/src/components/app/sidebar-next/footer-actions.tsxindex 4e51f1c3d5..5b7f02e69d 100644--- a/apps/web/src/components/app/sidebar-next/footer-actions.tsx+++ b/apps/web/src/components/app/sidebar-next/footer-actions.tsx@@ -1,48 +1,124 @@-import { SidebarSettingsWidget } from '@components/app/app-sidebar/sidebar';-import {- type SettingsTab,- useSettingsState,-} from '@core/constant/SettingsState';-import { useSettingsTabAvailable } from '@core/constant/settingsTabsConfig';+import { useAnalytics } from '@app/lib/analytics/analytics-context';+import { globalSplitManager } from '@app/signal/splitLayout';+import { SidebarOpenInSplitMenu } from '@components/app/app-sidebar/sidebar';+import { UserIcon } from '@core/component/UserIcon';+import { useSettingsState } from '@core/constant/SettingsState';+import { useEmail, useUserId } from '@core/context/user';+import { TOKENS } from '@core/hotkey/tokens';+import GearIcon from '@phosphor/gear.svg';+import GearFillIcon from '@phosphor-fill/gear-fill.svg';+import { isRealNamePart, useOwnUserName } from '@queries/auth/user-name-self';+import { Button, cn, pressHandlers } from '@ui';+import { createMemo, Show } from 'solid-js';+import { NavGlyph } from './nav-glyph';/**- * The rail's bottom actions: the account card. Settings is reached from that- * card's menu rather than its own button.+ * Sizes the gear and punches a gap around the avatar badge (16px, centred at+ * 22px,22px of the 24px glyph), so the badge reads on any button background.+ */+const AVATAR_CUTOUT =+ 'size-6 [mask-image:radial-gradient(circle_at_22px_22px,transparent_10px,black_10.5px)]';++const SETTINGS_CONTENT = { type: 'component', id: 'settings' } as const;++/**+ * The rail's bottom action: Settings, opened like any other rail view. The+ * gear carries the signed-in account's photo as a badge, so people with+ * several accounts can still tell which one they are in.*/export const FooterActions = (props: {onMenuOpenChange?: (open: boolean) => void;}) => {- const { openSettings, selectTab, settingsOpen } = useSettingsState();- const isTabAvailable = useSettingsTabAvailable();-- // Retarget the panel when it is already open rather than reopening it, and- // ignore tabs this account cannot reach.- const openSettingsTab = (tab: SettingsTab) => {- if (!isTabAvailable(tab)) return;- if (settingsOpen()) {- selectTab(tab);- return;- }- openSettings(tab);+ const analytics = useAnalytics();+ const { openSettings, openSettingsInSplit, settingsOpen, activeTabId } =+ useSettingsState();+ const userId = useUserId();+ const email = useEmail();+ const userName = useOwnUserName();++ // Prefer the user's real name (first/last); fall back to their email.+ const accountName = createMemo(() => {+ const name = userName();+ const parts = [name?.first_name, name?.last_name]+ .map((part) => part?.trim())+ .filter((part): part is string => isRealNamePart(part));+ return parts.length > 0 ? parts.join(' ') : email();+ });++ const isActive = () => {+ const content = globalSplitManager()?.activeSplit()?.content();+ return (+ content?.type === SETTINGS_CONTENT.type &&+ content.id === SETTINGS_CONTENT.id+ );+ };++ // An open settings split keeps its section; a fresh open lands on Account.+ const currentTab = () => (settingsOpen() ? activeTabId() : undefined);++ const open = (event: MouseEvent) => {+ event.preventDefault();+ analytics.track('sidebar_click', { view: 'settings' });+ if (event.shiftKey) openSettingsInSplit(currentTab());+ else openSettings(currentTab());};return (- /*- The account card's trigger collapses to the bare avatar under- `group-data-[slim=true]/sidebar`, so the group is scoped to this- wrapper — setting `data-slim` on the rail root would expose every- descendant to those selectors.- */- <div- class="group/sidebar flex w-full shrink-0 justify-center"- data-slim="true"- >- <SidebarSettingsWidget- compact- isSlim={() => true}- onSelect={openSettingsTab}- onMenuOpenChange={props.onMenuOpenChange}- />+ <div class="flex w-full shrink-0 justify-center">+ <SidebarOpenInSplitMenu+ content={() => SETTINGS_CONTENT}+ // Route through settings state so the menu reuses an open settings+ // split (there is only ever one) and keeps its section.+ onOpenCurrentSplit={() => openSettings(currentTab())}+ onOpenNewSplit={() => openSettingsInSplit(currentTab())}+ onOpenChange={props.onMenuOpenChange}+ triggerClass="size-10"+ >+ <Button+ variant="ghost"+ size="icon-md"+ class={cn(+ 'size-10 cursor-default rounded-xl',+ isActive() && 'bg-hover text-ink'+ )}+ label="Settings"+ aria-description={+ accountName() ? `Signed in as ${accountName()}` : undefined+ }+ tooltip="Settings"+ tooltipPlacement="right"+ hotkey={TOKENS.global.toggleSettings}+ draggable={false}+ aria-current={isActive() ? 'page' : undefined}+ data-active={isActive() ? '' : undefined}+ data-sidebar-next-item="settings"+ {...pressHandlers(open)}+ >+ <div class="pointer-events-none relative size-6">+ <NavGlyph+ icon={GearIcon}+ iconActive={GearFillIcon}+ filled={isActive()}+ class={AVATAR_CUTOUT}+ />+ <div class="absolute -right-1.5 -bottom-1.5 size-4 rounded-full">+ <Show+ when={userId()}+ fallback={<div class="size-full rounded-full bg-ink/10" />}+ >+ {(id) => (+ <UserIcon+ id={id()}+ size="fill"+ suppressClick+ showTooltip={false}+ />+ )}+ </Show>+ </div>+ </div>+ </Button>+ </SidebarOpenInSplitMenu></div>);};diff --git a/apps/web/src/components/app/sidebar-next/list-nav.test.tsx b/apps/web/src/components/app/sidebar-next/list-nav.test.tsxnew file mode 100644index 0000000000..aa78eb0457--- /dev/null+++ b/apps/web/src/components/app/sidebar-next/list-nav.test.tsx@@ -0,0 +1,99 @@+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';+import { createSignal, type JSX, type ParentProps, splitProps } from 'solid-js';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import { ListNav } from './list-nav';+import type { SidebarNextNavItem } from './nav-items';++const mocks = vi.hoisted(() => ({+ setActiveView: (_view: string) => {},+ activeView: (): string => 'settings',+ navigate: vi.fn(),+}));++vi.mock('@app/lib/analytics/analytics-context', () => ({+ useAnalytics: () => ({ track: vi.fn() }),+}));+vi.mock('@app/signal/splitLayout', () => ({+ globalSplitManager: () => ({+ activeSplit: () => ({+ content: () => ({ type: 'component', id: mocks.activeView() }),+ }),+ returnFocus: vi.fn(),+ }),+}));+vi.mock('@components/app/app-sidebar/sidebar', () => ({+ navigateToSidebarView: mocks.navigate,+ sidebarContent: (id: string) => ({ type: 'component', id }),+ SidebarOpenInSplitMenu: (props: ParentProps) => props.children,+}));+vi.mock('@components/app/split-layout/layout', () => ({+ useSplitLayout: () => ({ openWithSplit: vi.fn() }),+}));+vi.mock('@solidjs/router', () => ({+ useLocation: () => ({ pathname: '/app' }),+}));+vi.mock('@ui', async () => ({+ ...(await import('@ui/utils/classname')),+ Button: (+ props: JSX.ButtonHTMLAttributes<HTMLButtonElement> & { label: string }+ ) => {+ const [local, rest] = splitProps(props, ['label']);+ return <button type="button" aria-label={local.label} {...rest} />;+ },+}));++const Icon = () => <svg aria-hidden="true" />;++const item = (id: string, label: string) =>+ ({+ id,+ label,+ href: `/${id}`,+ icon: Icon,+ iconActive: Icon,+ hotkeyToken: `sidebar.goTo.${id}`,+ }) as unknown as SidebarNextNavItem;++beforeEach(() => {+ vi.useFakeTimers();+ const [activeView, setActiveView] = createSignal('settings');+ mocks.activeView = activeView;+ mocks.setActiveView = setActiveView;+ mocks.navigate.mockReset();+ mocks.navigate.mockImplementation(({ viewId }: { viewId: string }) =>+ setActiveView(viewId)+ );+});++afterEach(() => {+ cleanup();+ vi.useRealTimers();+});++describe('ListNav', () => {+ it('does not reclaim the highlight when the view it left becomes active again', () => {+ render(() => (+ <>+ <ListNav item={item('home', 'Home')} />+ <ListNav item={item('agents', 'Agents')} />+ </>+ ));+ const agents = screen.getByRole('button', { name: 'Agents' });++ fireEvent.mouseDown(agents, { button: 0 });+ // Optimistic: highlighted before the view swaps in.+ expect(agents.hasAttribute('data-active')).toBe(true);++ vi.runAllTimers();+ expect(mocks.navigate).toHaveBeenCalledOnce();+ expect(mocks.activeView()).toBe('agents');+ expect(agents.hasAttribute('data-active')).toBe(true);++ // Settings opens from outside the rail list (the gear, a hotkey).+ mocks.setActiveView('settings');+ expect(agents.hasAttribute('data-active')).toBe(false);+ expect(+ screen.getByRole('button', { name: 'Home' }).hasAttribute('data-active')+ ).toBe(false);+ });+});diff --git a/apps/web/src/components/app/sidebar-next/list-nav.tsx b/apps/web/src/components/app/sidebar-next/list-nav.tsxindex 67d35c1b3d..d777097c1d 100644--- a/apps/web/src/components/app/sidebar-next/list-nav.tsx+++ b/apps/web/src/components/app/sidebar-next/list-nav.tsx@@ -129,12 +129,11 @@ export const ListNav = (props: ListNavProps) => {const isSameContent =activeContent?.type === expected.type && activeContent.id === expected.id;- setPendingNav({- itemId: props.item.id,- activeContentKey: activeContentKey(),- });-if (!isSameContent || event.shiftKey) {+ setPendingNav({+ itemId: props.item.id,+ activeContentKey: activeContentKey(),+ });const { shiftKey } = event;afterNextPaint(() => {navigateToSidebarView({@@ -144,6 +143,13 @@ export const ListNav = (props: ListNavProps) => {openWithSplit: layout.openWithSplit,referredFrom: 'sidebar',});+ // Navigation is synchronous, so the real state now holds. Drop the+ // press: left in place, it would claim the highlight again whenever+ // the active content returned to what it was at press time (e.g.+ // Settings → Agents → Settings would light up Agents).+ setPendingNav((pending) =>+ pending?.itemId === props.item.id ? undefined : pending+ );globalSplitManager()?.returnFocus();});return;diff --git a/apps/web/src/components/app/split-layout/componentRegistry.tsx b/apps/web/src/components/app/split-layout/componentRegistry.tsxindex 009b2c0041..daed4e86f4 100644--- a/apps/web/src/components/app/split-layout/componentRegistry.tsx+++ b/apps/web/src/components/app/split-layout/componentRegistry.tsx@@ -354,7 +354,11 @@ registerComponent('import-linear',lazy(() => import('@app/features/integrations/import-linear/ImportLinear')));-registerComponent('settings', () => <SettingsRouteView />);+registerComponent(+ 'settings',+ () => <SettingsRouteView />,+ () => composableLayout()+);if (LOCAL_ONLY) {registerComponent(diff --git a/apps/web/src/components/app/split-layout/components/SplitPanel.tsx b/apps/web/src/components/app/split-layout/components/SplitPanel.tsxindex eae476b3a9..3f480a4d01 100644--- a/apps/web/src/components/app/split-layout/components/SplitPanel.tsx+++ b/apps/web/src/components/app/split-layout/components/SplitPanel.tsx@@ -8,7 +8,6 @@ import { ContentLoading } from '@components/app/ContentLoading';import { MobileTopEdgeFade } from '@components/app/mobile/MobileEdgeFade';import { MobilePageActionRow } from '@components/app/mobile/MobilePageActionRow';import { SplitPanelControllerProvider } from '@components/app/split-panel';-import { isSoloSettings } from '@core/constant/SettingsState';import { splitContainerAttribute } from '@core/dom-selectors';import { EVENT_MODIFIER_KEYS } from '@core/hotkey/constants';import { useHotkeyDOMScope } from '@core/hotkey/hotkeys';@@ -17,13 +16,7 @@ import { getSafeAreaInset } from '@core/mobile/safeAreaInsets';import CloseIcon from '@phosphor/x.svg';import { createElementSize } from '@solid-primitives/resize-observer';import { Button, cn, Panel } from '@ui';-import {- createEffect,- createMemo,- createSignal,- Show,- Suspense,-} from 'solid-js';+import { createEffect, createSignal, Show, Suspense } from 'solid-js';import { Dynamic } from 'solid-js/web';import { splitBackInterceptor } from '../back-interceptor';import {@@ -134,10 +127,6 @@ export function SplitPanel(props: SplitPanelProps) {return Boolean(splits && splits.length > 1);}- // On mobile the header stays visible for list views too: it hosts the- // floating filter-pill strip (see MobileSoupViewTabs).- const shouldHideSplitHeader = createMemo(() => isSoloSettings());-const splitFocusStyling = () =>!isTouchDevice() &&props.active &&@@ -243,9 +232,7 @@ export function SplitPanel(props: SplitPanelProps) {'relative size-full touch:isolate': !props.handle.isSpotLight(),}}style={{- '--split-header-height': `${- shouldHideSplitHeader() ? 0 : (headerSize.height ?? 0)- }px`,+ '--split-header-height': `${headerSize.height ?? 0}px`,// The hard spacer for top-anchored content on full-frame// mobile/tablet: status bar + floating header strip.'--mobile-content-inset-top':@@ -302,8 +289,7 @@ export function SplitPanel(props: SplitPanelProps) {'z-split-panel-chrome',// On mobile/tablet the header collapses to a zero-height grid row;// SplitHeader overlays the body as floating islands.- 'touch:min-h-0 touch:border-b-0',- shouldHideSplitHeader() && 'hidden'+ 'touch:min-h-0 touch:border-b-0')}><SplitHeaderdiff --git a/apps/web/src/features/auth/EmailAuth.tsx b/apps/web/src/features/auth/EmailAuth.tsxindex 33f505cbed..9e402e7985 100644--- a/apps/web/src/features/auth/EmailAuth.tsx+++ b/apps/web/src/features/auth/EmailAuth.tsx@@ -7,7 +7,6 @@ import { redirectToEmailAuth } from '@core/auth/email';import { publishLoginSuccess } from '@core/auth/login-events';import { LoadingBlock } from '@core/component/LoadingBlock';import { toast } from '@core/component/Toast/Toast';-import { restoreSettingsReturnTo } from '@core/constant/SettingsState';import { settingsTabToSlug } from '@core/constant/settingsTabsConfig';import { useEmailLinks } from '@core/email-link';import { consumeInboxLinkReturn } from '@core/email-link/return-layout';@@ -142,9 +141,6 @@ function EmailLinkCallback(props: Pick<EmailAuthParams, 'successPath'>) {const restoreLayoutBeforeConsent = (linkId: string) => {const stored = consumeInboxLinkReturn(linkId);if (!stored) return false;- if (stored.settingsReturnTo) {- restoreSettingsReturnTo(stored.settingsReturnTo);- }navigate(stored.url, { replace: true });return true;};diff --git a/apps/web/src/features/channel/Bots/BotCreatePage.tsx b/apps/web/src/features/channel/Bots/BotCreatePage.tsxindex 25b77936d0..450e42fca0 100644--- a/apps/web/src/features/channel/Bots/BotCreatePage.tsx+++ b/apps/web/src/features/channel/Bots/BotCreatePage.tsx@@ -176,7 +176,7 @@ export function BotCreate(props: { channelId?: string; onBack: () => void }) {{/* Mobile chrome insets live inside the scroll content so the page isfull-frame, matching SettingsPage (this create view only rendersinside the settings panel). */}- <main class="mx-auto w-full max-w-[560px] px-8 pt-14 pb-24 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]">+ <main class="mx-auto w-full max-w-[560px] px-8 pt-4 pb-24 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]"><Buttontype="button"variant="ghost"diff --git a/apps/web/src/features/channel/Bots/BotDetailPage.tsx b/apps/web/src/features/channel/Bots/BotDetailPage.tsxindex 03dededb71..e48e83c43c 100644--- a/apps/web/src/features/channel/Bots/BotDetailPage.tsx+++ b/apps/web/src/features/channel/Bots/BotDetailPage.tsx@@ -193,7 +193,7 @@ export function BotDetail(props: { botId: string; onBack: () => void }) {{/* Mobile chrome insets live inside the scroll content so the page isfull-frame, matching SettingsPage (this detail view only rendersinside the settings panel). */}- <main class="mx-auto w-full max-w-[560px] px-8 pt-14 pb-24 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]">+ <main class="mx-auto w-full max-w-[560px] px-8 pt-4 pb-24 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]"><Buttontype="button"variant="ghost"diff --git a/apps/web/src/features/settings/Settings.tsx b/apps/web/src/features/settings/Settings.tsxindex f655ca3ea0..bb4ebb583e 100644--- a/apps/web/src/features/settings/Settings.tsx+++ b/apps/web/src/features/settings/Settings.tsx@@ -1,21 +1,18 @@+import { SearchBar, ViewShell, ViewSidebar } from '@app/components/view-shell';import {useParams,useNavigate as useSplitNavigate,} from '@app/lib/split-router';import { PillTabs } from '@components/app/mobile/PillTabs';-import { HeaderIsland } from '@components/app/split-layout/components/HeaderIsland';-import {- SplitHeaderLeft,- SplitHeaderRight,-} from '@components/app/split-layout/components/SplitHeader';+import { SplitHeaderLeft } from '@components/app/split-layout/components/SplitHeader';+import { SplitPanel } from '@components/app/split-panel';import { useLogout } from '@core/auth/logout';-import { TabsInsetDropdown } from '@core/component/TabsInsetDropdown';import {- isSoloSettings,type SettingsTab,useSettingsState,} from '@core/constant/SettingsState';import {+ type SettingsTabGroup,settingsSlugToTab,settingsTabToSlug,useSettingsTabs,@@ -25,35 +22,21 @@ import type { ValidHotkey } from '@core/hotkey/types';import { isMobile } from '@core/mobile/isMobile';import { isTouchDevice } from '@core/mobile/isTouchDevice';import { activeTabId, setActiveTabId } from '@core/signal/settingsTab';-import ArrowsIn from '@phosphor/arrows-in.svg';-import ArrowsOut from '@phosphor/arrows-out.svg';-import CaretLeftIcon from '@phosphor/caret-left.svg';-import MagnifyingGlassIcon from '@phosphor/magnifying-glass.svg';import SignOutIcon from '@phosphor/sign-out.svg';-import { Button, cn, Input, Layer, SideNav } from '@ui';+import { pressHandlers } from '@ui';import {createMemo,createRenderEffect,createSignal,For,- onCleanup,onMount,Show,untrack,} from 'solid-js';+import { Dynamic } from 'solid-js/web';import { SettingsTabContent } from './SettingsTabContent';import { filterSettingsTabGroups } from './settingsSearch';-/** Where the settings panel is mounted, which determines its header chrome. */-export type SettingsVariant = 'split' | 'fullscreen';--// Panel-width breakpoints (the panel can be a full-screen page or a resizable-// split, so we measure the panel itself rather than the viewport). Below-// `COMPACT` the sidebar collapses into a horizontal tab bar; between `COMPACT`-// and `NARROW` the gutter around the content card tightens.-const COMPACT_WIDTH = 660;-const NARROW_WIDTH = 820;-export function SettingsPanelComponentWrapper() {const params = useParams<{ tab?: string }>();@@ -73,7 +56,7 @@ export function SettingsPanelComponentWrapper() {return (<Show when={!isMobile()} fallback={<MobileSettingsDeepLink />}>- <SettingsPanel variant={isSoloSettings() ? 'fullscreen' : 'split'} />+ <SettingsPanel /></Show>);}@@ -93,23 +76,14 @@ function MobileSettingsDeepLink() {type SettingsPanelProps = {hide?: boolean;- /** Defaults to 'split' so the split-layout mount keeps its existing chrome. */- variant?: SettingsVariant;};export function SettingsPanel(props: SettingsPanelProps) {- const {- closeSettings,- moveSettingsToSplit,- moveSettingsToSolo,- activeTabId,- selectTab,- } = useSettingsState();+ const { closeSettings, activeTabId, selectTab } = useSettingsState();const splitNavigate = useSplitNavigate();const { searchGroups, flatTabs } = useSettingsTabs();const logout = useLogout();- const variant = () => props.variant ?? 'split';const activeNavigationTab = () =>activeTabId() === 'Harness' ? 'Agents' : activeTabId();@@ -129,15 +103,9 @@ export function SettingsPanel(props: SettingsPanelProps) {activeTabId() === tab ||(tab === 'Agents' && activeTabId() === 'Harness' && !showsHarnessResult());- // Responsive state, driven by the panel's own width (see breakpoints above).- const [panelWidth, setPanelWidth] = createSignal(Number.POSITIVE_INFINITY);- const compact = () => !isTouchDevice() && panelWidth() < COMPACT_WIDTH;- const narrow = () => !isTouchDevice() && panelWidth() < NARROW_WIDTH;-// Set up hotkey scope for settings panelconst [attachHotkeys, settingsHotkeyScope] = useHotkeyDOMScope('settings');let settingsContainerRef: HTMLDivElement | undefined;- let resizeObserver: ResizeObserver | undefined;onMount(() => {if (!settingsContainerRef) return;@@ -147,15 +115,8 @@ export function SettingsPanel(props: SettingsPanelProps) {// only after the user clicks into it (the scope only activates on// `focusin`).settingsContainerRef.focus();- resizeObserver = new ResizeObserver((entries) => {- const width = entries[0]?.contentRect.width;- if (width) setPanelWidth(width);- });- resizeObserver.observe(settingsContainerRef);});- onCleanup(() => resizeObserver?.disconnect());-function handleEscapeKey() {closeSettings();return true;@@ -247,30 +208,14 @@ export function SettingsPanel(props: SettingsPanelProps) {}};- // Tab list for the compact segmented control / dropdown.+ // Tab list for the touch pill strip.const tabItems = () =>flatTabs().map((tab) => ({ value: tab.tab, label: tab.label }));- // "Back to app" — the close affordance for solo settings. Laid out like a nav row.- const backToApp = () => (- <button- type="button"- onClick={() => closeSettings()}- class="flex items-center gap-2 px-2 py-1.5 rounded-md text-xs text-ink-extra-muted cursor-default hover:bg-ink/4 hover:text-ink-muted"- >- <CaretLeftIcon class="size-4 shrink-0" />- <span class="whitespace-nowrap">Back to app</span>- </button>- );-- const moveToSplitButton = () => (- <Button- class="p-1"- label="Move to split"- onClick={() => moveSettingsToSplit()}- >- <ArrowsIn class="size-4" />- </Button>+ const content = () => (+ <Show when={activeTabId()}>+ {(tab) => <SettingsTabContent tab={tab()} />}+ </Show>);return (@@ -281,17 +226,17 @@ export function SettingsPanel(props: SettingsPanelProps) {data-settings-panelref={settingsContainerRef}>- <Show when={variant() === 'split'}>- <SplitHeaderLeft>- <Show- when={!isTouchDevice()}- fallback={- // On mobile the header strip hosts the tab pills (the bottom- // accessory region belongs to the global views row). Full-bleed- // breakout: span the header container (100cqw), opting out of- // the row's flex sizing, with -ml cancelling the row gutter so- // the pills scroll device edge to device edge — see- // MOBILE_TAB_STRIP_CLASS in soup-view-tabs.tsx.+ <Show+ when={!isTouchDevice()}+ fallback={+ <>+ <SplitHeaderLeft>+ {/* On touch the header strip hosts the tab pills (the bottom+ accessory region belongs to the global views row).+ Full-bleed breakout: span the header container (100cqw),+ opting out of the row's flex sizing, with -ml cancelling the+ row gutter so the pills scroll device edge to device edge —+ see MOBILE_TAB_STRIP_CLASS in soup-view-tabs.tsx. */}<PillTabsscrollableclass="-ml-(--mobile-chrome-gutter) w-[100cqw] max-w-none flex-none"@@ -300,155 +245,126 @@ export function SettingsPanel(props: SettingsPanelProps) {value={activeNavigationTab()}onChange={handleTabChange}/>- }- >- <HeaderIsland>- <div class="h-full flex gap-3 items-center">- <h1 class="font-semibold text-ink select-none text-sm shrink-0">- Settings- </h1>- </div>- </HeaderIsland>- {/* When the sidebar collapses, tab selection moves into the split's- top bar as a dropdown of the current tab. (Rendered directly- rather than via CollapsibleHeaderItem so the wide segmented- control never flashes before measuring.) */}- <Show when={compact()}>- <div class="mx-2 shrink-0">- <TabsInsetDropdown- list={tabItems()}- value={activeNavigationTab()}- onChange={handleTabChange}- />- </div>- </Show>- </Show>- </SplitHeaderLeft>- {/* Collapse the other splits so settings becomes the sole one (desktop only). */}- <Show when={!isMobile()}>- <SplitHeaderRight>- <Button- class="p-1"- label="Open fullscreen"- onClick={() => moveSettingsToSolo()}+ </SplitHeaderLeft>+ {/* Full-frame on touch: the tab pages own the chrome insets+ inside their scrollers (see SettingsPage in primitives.tsx), so+ content scrolls under the floating header/dock like every other+ block instead of being boxed between them. */}+ <div class="relative min-h-0 flex-1 overflow-hidden">+ {content()}+ </div>+ </>+ }+ >+ <SplitPanel.Root>+ <SplitPanel.Body>+ <ViewShell.Root+ asidePreferenceKey="settings"+ resizable+ aside={{ preserveDuringResize: false }}+ main={{ preferredWidth: 720 }}>- <ArrowsOut class="size-4" />- </Button>- </SplitHeaderRight>- </Show>+ <ViewShell.Aside>+ <SettingsSidebar+ groups={filteredGroups()}+ searchQuery={searchQuery()}+ onSearchQueryChange={setSearchQuery}+ isItemActive={isItemActive}+ onSelect={selectRoutedTab}+ onLogout={() => logout()}+ />+ </ViewShell.Aside>+ <ViewShell.Main>+ <ViewShell.TopBar />+ <div class="relative min-h-0 flex-1 overflow-hidden">+ {content()}+ </div>+ </ViewShell.Main>+ </ViewShell.Root>+ </SplitPanel.Body>+ </SplitPanel.Root></Show>+ </div>+ );+}- <div class="flex grow min-h-1 overflow-hidden">- {/* Inline sidebar — hidden once the panel gets too narrow. */}- <Show when={!isTouchDevice() && !compact()}>- <SideNav- class={cn(- 'w-[clamp(208px,20%,248px)] gap-3',- narrow() ? 'pr-1' : 'pr-2'- )}- >- {/* The full-screen page has no surrounding chrome, so the sidebar- carries the "back" and "move to split" affordances itself. */}- <Show when={variant() === 'fullscreen'}>- <div class="flex items-center justify-between gap-1">- {backToApp()}- {moveToSplitButton()}- </div>- </Show>- <div class="relative">- <MagnifyingGlassIcon class="absolute left-2 top-1/2 -translate-y-1/2 size-4 text-ink-muted pointer-events-none" />- <Input- type="text"- placeholder="Search settings..."- value={searchQuery()}- onInput={(e) => setSearchQuery(e.currentTarget.value)}- size="sm"- class="pl-8"- />- </div>- <Show- when={filteredGroups().length > 0}- fallback={- <div class="text-xs text-ink-muted text-center py-4">- No settings found- </div>- }- >- <For each={filteredGroups()}>- {(group) => (- <SideNav.Group label={group.label}>- <For each={group.items}>- {(item) => (- <SideNav.Item- icon={item.icon}- active={isItemActive(item.tab)}- onSelect={() => selectRoutedTab(item.tab)}- class="text-xs py-1.5"- >- {item.label}- </SideNav.Item>- )}- </For>- </SideNav.Group>- )}- </For>- </Show>- <div class="mt-auto border-t border-edge-muted pt-2">- <button- type="button"- onClick={() => logout()}- class="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs text-ink-extra-muted cursor-default hover:bg-ink/3 hover:text-ink"- >- <SignOutIcon class="size-4 shrink-0" />- <span class="whitespace-nowrap">Log out</span>- </button>+/**+ * Settings' inner navigation, laid out like every other view's sidebar: a+ * title bar, a search field, the grouped section pills, and Log out pinned to+ * the bottom.+ */+function SettingsSidebar(props: {+ groups: SettingsTabGroup[];+ searchQuery: string;+ onSearchQueryChange: (query: string) => void;+ isItemActive: (tab: SettingsTab) => boolean;+ onSelect: (tab: SettingsTab) => void;+ onLogout: () => void;+}) {+ return (+ <ViewSidebar.Root aria-label="Settings navigation">+ <ViewSidebar.Header>+ <div class="flex min-w-0 items-center gap-1">+ <ViewSidebar.CloseButton class="shrink-0" />+ <ViewSidebar.Title>Settings</ViewSidebar.Title>+ </div>+ </ViewSidebar.Header>++ <ViewSidebar.Primary>+ <SearchBar+ label="Search settings"+ placeholder="Search"+ autocomplete="off"+ value={props.searchQuery}+ onValueChange={props.onSearchQueryChange}+ class="h-9"+ />+ </ViewSidebar.Primary>++ <ViewSidebar.Content class="gap-4">+ <Show+ when={props.groups.length > 0}+ fallback={+ <div class="py-4 text-center text-sm text-ink-muted">+ No settings found</div>- </SideNav>- </Show>-- {/* Content sits in its own subtly-raised, rounded card. The gutter- around it tightens as the panel narrows, and goes uniform once the- sidebar collapses. Full-bleed on mobile. */}- <div- class="flex-1 min-w-0 overflow-hidden touch:p-0"- classList={{- 'py-2 pr-2 pl-0': !compact() && !narrow(),- 'py-1 pr-1 pl-0': !compact() && narrow(),- 'p-1': compact(),- }}+ }>- <Layer depth={1}>- <div class="relative flex size-full flex-col overflow-hidden rounded-xl border border-ink/[0.06] bg-surface shadow-menu touch:rounded-none touch:border-0 touch:bg-transparent">- {/* Compact full-screen chrome: no split header to host the tabs,- so the sidebar collapses into a top bar here — back / tab- dropdown / move-to-split. (Split mode puts the tabs in its- header.) */}- <Show when={variant() === 'fullscreen' && compact()}>- <div class="flex shrink-0 items-center gap-2 h-13 px-2 border-b border-ink/[0.05]">- {backToApp()}- <TabsInsetDropdown- list={tabItems()}- value={activeNavigationTab()}- onChange={handleTabChange}- />- <div class="flex-1" />- {moveToSplitButton()}- </div>- </Show>-- {/* Full-frame on mobile: the tab pages own the chrome insets- inside their scrollers (see SettingsPage in primitives.tsx),- so content scrolls under the floating header/dock like every- other block instead of being boxed between them. */}- <div class="relative min-h-0 flex-1 overflow-hidden">- <Show when={activeTabId()}>- {(tab) => <SettingsTabContent tab={tab()} />}- </Show>- </div>- </div>- </Layer>- </div>- </div>- </div>+ <For each={props.groups}>+ {(group) => (+ <section class="flex min-w-0 flex-col gap-0.5">+ <h2 class="flex h-7 min-w-0 items-center px-(--sidebar-item-inset) text-sm font-medium text-ink-extra-muted">+ <span class="truncate">{group.label}</span>+ </h2>+ <ViewSidebar.Nav aria-label={group.label}>+ <For each={group.items}>+ {(item) => (+ <ViewSidebar.Item+ active={props.isItemActive(item.tab)}+ {...pressHandlers(() => props.onSelect(item.tab))}+ >+ <ViewSidebar.Icon>+ <Dynamic component={item.icon} class="size-4" />+ </ViewSidebar.Icon>+ <span class="truncate">{item.label}</span>+ </ViewSidebar.Item>+ )}+ </For>+ </ViewSidebar.Nav>+ </section>+ )}+ </For>+ </Show>+ </ViewSidebar.Content>++ <ViewSidebar.Footer class="py-(--sidebar-gutter)">+ <ViewSidebar.Item {...pressHandlers(() => props.onLogout())}>+ <ViewSidebar.Icon>+ <SignOutIcon class="size-4" />+ </ViewSidebar.Icon>+ <span class="truncate">Log out</span>+ </ViewSidebar.Item>+ </ViewSidebar.Footer>+ </ViewSidebar.Root>);}diff --git a/apps/web/src/features/settings/connections/primitives.tsx b/apps/web/src/features/settings/connections/primitives.tsxindex 39529b6cc1..32ef45dcbe 100644--- a/apps/web/src/features/settings/connections/primitives.tsx+++ b/apps/web/src/features/settings/connections/primitives.tsx@@ -50,7 +50,7 @@ export function SettingsPage(props: {'mx-auto w-full max-w-[710px]',inSheet? 'px-3 pt-2 pb-[max(24px,var(--mobile-sheet-safe-padding))]'- : 'px-10 pt-14 pb-24 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]'+ : 'px-10 pt-4 pb-24 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]')}><Show when={props.onBack}>diff --git a/apps/web/src/features/settings/primitives.tsx b/apps/web/src/features/settings/primitives.tsxindex 5b3974aa76..73c64f0abd 100644--- a/apps/web/src/features/settings/primitives.tsx+++ b/apps/web/src/features/settings/primitives.tsx@@ -49,7 +49,7 @@ export function SettingsPage(props: {'mx-auto w-full max-w-[710px]',inSheet? '@container px-3 pt-2 pb-[max(24px,var(--mobile-sheet-safe-padding))]'- : 'px-10 pt-14 pb-24 @max-[480px]/settings-page:px-4 @max-[480px]/settings-page:pt-6 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]'+ : 'px-10 pt-4 pb-24 @max-[480px]/settings-page:px-4 touch:px-5 touch:pt-[calc(var(--mobile-content-inset-top,0px)+2rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]')}>{/* Headers are inset by the card's inner padding so the title anddiff --git a/apps/web/src/lib/core/constant/SettingsState.test.tsx b/apps/web/src/lib/core/constant/SettingsState.test.tsxindex c16c0d6f36..c1bef8411c 100644--- a/apps/web/src/lib/core/constant/SettingsState.test.tsx+++ b/apps/web/src/lib/core/constant/SettingsState.test.tsx@@ -20,8 +20,10 @@ const mocks = vi.hoisted(() => ({mobile: true,hasSettingsSplit: false,otherSplit: false,- solo: false,+ canGoBack: false,updateCurrentEntry: vi.fn(),+ goBack: vi.fn(),+ activateSplit: vi.fn(),removeSplit: vi.fn(),openWithSplit: vi.fn(),managerOpenWithSplit: vi.fn(),@@ -46,18 +48,15 @@ vi.mock('@app/signal/splitLayout', () => ({]: []),],- getVisibleSplits: () =>- mocks.solo- ? [- {- id: 'settings-split',- content: { type: 'component', id: 'settings' },- },- ]- : [],removeSplit: mocks.removeSplit,openWithSplit: mocks.managerOpenWithSplit,- getSplit: () => ({ updateCurrentEntry: mocks.updateCurrentEntry }),+ activateSplit: mocks.activateSplit,+ activeSplitId: () => undefined,+ getSplit: () => ({+ updateCurrentEntry: mocks.updateCurrentEntry,+ canGoBack: () => mocks.canGoBack,+ goBack: mocks.goBack,+ }),}),}));vi.mock('@components/app/split-layout/layout', () => ({@@ -65,11 +64,6 @@ vi.mock('@components/app/split-layout/layout', () => ({}));vi.mock('@solidjs/router', () => ({useNavigate: () => mocks.navigate,- useLocation: () => ({- pathname: '/app/home',- search: '?keep=1',- hash: '#position',- }),}));vi.mock('./settingsTabsConfig', () => ({settingsTabToSlug: (tab: string) => tab.toLowerCase(),@@ -101,7 +95,7 @@ beforeEach(() => {mocks.mobile = true;mocks.hasSettingsSplit = false;mocks.otherSplit = false;- mocks.solo = false;+ mocks.canGoBack = false;setSplitActiveTabId('Account');});afterEach(cleanup);@@ -247,15 +241,25 @@ describe('settings entry points', () => {expect(mobile.page()).toBe('Billing');});- it('keeps desktop fullscreen and explicit split entry points', () => {+ it('opens desktop settings in the active split like any other view', () => {mocks.mobile = false;const { state, mobile } = mountSettings();state.openSettings('Billing');expect(mobile.open()).toBe(false);expect(state.activeTabId()).toBe('Billing');- expect(mocks.navigate).toHaveBeenCalledWith('/settings/billing');- state.openSettingsInSplit('Appearance');+ expect(mocks.navigate).not.toHaveBeenCalled();expect(mocks.openWithSplit).toHaveBeenCalledWith(+ {+ type: 'component',+ id: 'settings',+ entryMetadata: {+ route: paneRoute({ id: 'settings', params: { tab: 'billing' } }),+ },+ },+ { allowDuplicate: false, mergeHistory: false }+ );+ state.openSettingsInSplit('Appearance');+ expect(mocks.openWithSplit).toHaveBeenLastCalledWith({type: 'component',id: 'settings',@@ -267,6 +271,17 @@ describe('settings entry points', () => {);});+ it('retargets and activates an already-open desktop settings split', () => {+ mocks.mobile = false;+ mocks.hasSettingsSplit = true;+ const { state } = mountSettings();+ state.openSettings('Billing');+ expect(state.activeTabId()).toBe('Billing');+ expect(mocks.updateCurrentEntry).toHaveBeenCalledTimes(1);+ expect(mocks.activateSplit).toHaveBeenCalledWith('settings-split');+ expect(mocks.openWithSplit).not.toHaveBeenCalled();+ });+it('cancels pending panel focus when the settings owner unmounts', () => {vi.useFakeTimers();try {@@ -288,38 +303,25 @@ describe('settings entry points', () => {}});- it('restores the previous split URL when closing fullscreen settings', () => {+ it('closes desktop settings by going back, or removing a shared split', () => {mocks.mobile = false;- const { state } = mountSettings();- state.openSettings('Billing');mocks.hasSettingsSplit = true;- mocks.solo = true;+ const { state } = mountSettings();++ mocks.canGoBack = true;state.closeSettings();- expect(mocks.navigate).toHaveBeenLastCalledWith('/home?keep=1#position', {- replace: true,- });- });+ expect(mocks.goBack).toHaveBeenCalledTimes(1);- it('restores the app and docks the selected page without constructing a split URL', async () => {- mocks.mobile = false;- const { state } = mountSettings();- state.openSettingsInSplit('Account');- mocks.hasSettingsSplit = true;- state.moveSettingsToSolo('Connected');- expect(mocks.navigate).toHaveBeenCalledWith('/settings/connected');- mocks.solo = true;- await state.moveSettingsToSplit('Billing');- expect(mocks.navigate).toHaveBeenLastCalledWith('/home?keep=1#position', {+ mocks.canGoBack = false;+ state.closeSettings();+ expect(mocks.navigate).toHaveBeenLastCalledWith('/home', {replace: true,});- expect(mocks.managerOpenWithSplit).toHaveBeenCalledWith(- expect.objectContaining({- entryMetadata: {- route: paneRoute({ id: 'settings', params: { tab: 'billing' } }),- },- }),- expect.objectContaining({ allowDuplicate: false, preferNewSplit: true })- );++ mocks.otherSplit = true;+ state.closeSettings();+ expect(mocks.removeSplit).toHaveBeenCalledWith('settings-split');+ expect(mocks.goBack).toHaveBeenCalledTimes(1);});it('restores mobile deep links by closing the pane or using Inbox alone', () => {diff --git a/apps/web/src/lib/core/constant/SettingsState.tsx b/apps/web/src/lib/core/constant/SettingsState.tsxindex fcfa6495b8..e0180c7e14 100644--- a/apps/web/src/lib/core/constant/SettingsState.tsx+++ b/apps/web/src/lib/core/constant/SettingsState.tsx@@ -1,5 +1,4 @@import { DEFAULT_ROUTE } from '@app/constants/defaultRoute';-import { toBaseRelative } from '@app/constants/routerBase';import { useMobileSettings } from '@app/features/settings/context/mobile-settings';import { routeParams, type SplitLocation } from '@app/lib/split-router';import { paneRootMatch, paneRoute } from '@app/routes/app-route';@@ -8,8 +7,8 @@ import { useSplitLayout } from '@components/app/split-layout/layout';import { isMobile } from '@core/mobile/isMobile';import { isTouchDevice } from '@core/mobile/isTouchDevice';import { activeTabId, setActiveTabId } from '@core/signal/settingsTab';-import { useLocation, useNavigate } from '@solidjs/router';-import { createMemo, createSignal, onCleanup } from 'solid-js';+import { useNavigate } from '@solidjs/router';+import { createMemo, onCleanup } from 'solid-js';import { settingsTabToSlug } from './settingsTabsConfig';export type SettingsTab =@@ -39,59 +38,10 @@ export type SettingsTab =| 'GitHub'| 'Admin';-// Where "Back to app" (and move-to-split) should return to: the layout the user-// was on when they opened settings. A full base-relative URL — path plus query-// and hash — so content locations survive the round trip.-// Undefined when settings was deep-linked, in which case we fall back to-// DEFAULT_ROUTE.-const [settingsReturnTo, setSettingsReturnTo] = createSignal<string>();--/**- * Re-seed {@link settingsReturnTo} after a full page load has wiped it. The- * Gmail consent round trip tears the app down, so the add-inbox flow captures- * this alongside the layout it left from and the callback hands it back — the- * user returns to solo settings with "Back to app" still pointing at the- * layout they had before they opened settings.- */-export const restoreSettingsReturnTo = (url: string) => {- setSettingsReturnTo(url);-};--/** Read-only view of {@link settingsReturnTo} for capture across a reload. */-export const currentSettingsReturnTo = settingsReturnTo;--/**- * Whether settings is the only visible split — the "clobbered" mode that- * looks and behaves like the old fullscreen route (app sidebar hidden,- * settings owns its own back/move-to-split affordances). Mobile is excluded:- * its stacked panes always show exactly one, which would otherwise- * misidentify every mobile settings-open as "solo".- */-export const isSoloSettings = () => {- if (isMobile()) return false;-- const splitManager = globalSplitManager();-- if (!splitManager) return false;-- // Derive the sole split from the visible set (not `splits()[0]`) so the- // count check and the identity check agree.- const visible = splitManager.getVisibleSplits();-- if (visible.length !== 1) return false;-- const [sole] = visible;-- return sole?.content.type === 'component' && sole.content.id === 'settings';-};-export const useSettingsState = () => {const mobileSettings = useMobileSettings();const { openWithSplit } = useSplitLayout();const navigate = useNavigate();- const location = useLocation();- const currentUrl = () =>- `${toBaseRelative(location.pathname)}${location.search}${location.hash}`;let focusTimer: ReturnType<typeof setTimeout> | undefined;let disposed = false;onCleanup(() => {@@ -163,16 +113,10 @@ export const useSettingsState = () => {}, 10);};- // The standalone settings URL is a normal history entry. Browser Back- // restores the exact docked layout (if there was one).- const collapseToSoloSettings = (tab: SettingsTab) => {- if (!splitOpen()) setSettingsReturnTo(currentUrl());- setActiveTabId(tab);- navigate(`/settings/${settingsTabToSlug(tab)}`);- };-// Mobile opens an in-place settings sheet; a fresh open lands on its index.- // Desktop keeps the solo/split layout and defaults to Account.+ // Desktop treats settings like any other sidebar view: an already-open+ // settings split is retargeted and brought forward, otherwise settings opens+ // in the active split, defaulting to Account.const openSettings = (tab?: SettingsTab) => {if (isMobile()) {mobileSettings.openSettings(tab);@@ -180,14 +124,22 @@ export const useSettingsState = () => {return;}- if (splitOpen()) {- const nextTab = tab ?? 'Account';- setActiveTabId(nextTab);+ const nextTab = tab ?? 'Account';+ setActiveTabId(nextTab);++ const settingsSplit = getSettingsSplit();+ if (settingsSplit) {updateSettingsRoute(nextTab);+ globalSplitManager()?.activateSplit(settingsSplit.id);+ focusSettingsPanel();return;}- collapseToSoloSettings(tab ?? 'Account');+ openWithSplit(settingsContent(nextTab), {+ allowDuplicate: false,+ mergeHistory: false,+ });+ focusSettingsPanel();};// Mobile selection belongs to the sheet, including while it is closed.@@ -212,7 +164,7 @@ export const useSettingsState = () => {updateSettingsRoute(tab);};- // Opt-in: dock settings into the split layout (the pre-route behavior).+ // Opt-in: open settings in a new split beside the current one.const openSettingsInSplit = (activeTabId?: SettingsTab) => {if (isMobile()) {openSettings(activeTabId);@@ -223,12 +175,11 @@ export const useSettingsState = () => {if (activeTabId) setActiveTabId(activeTabId);const tab = activeTabId ?? 'Account';- if (!splitOpen()) setSettingsReturnTo(currentUrl());openWithSplit(settingsContent(tab), {activate: true,- // Single settings split only: getSettingsSplit/removeSettingsSplit- // assume one exists, so reuse an existing one instead of duplicating.+ // Single settings split only: getSettingsSplit assumes at most one+ // exists, so reuse an existing one instead of duplicating.allowDuplicate: false,preferNewSplit: true,mergeHistory: false,@@ -236,46 +187,30 @@ export const useSettingsState = () => {focusSettingsPanel();};- const removeSettingsSplit = () => {- const settingsSplit = getSettingsSplit();- if (settingsSplit) globalSplitManager()?.removeSplit(settingsSplit.id);- setSettingsReturnTo(undefined);- };-+ // A settings split shared with others is dismissed; a sole one steps back to+ // whatever the user had open before, like any other view.const closeSettings = () => {if (isMobile()) {mobileSettings.close();return;}- if (isSoloSettings()) {- const returnTo = settingsReturnTo() ?? DEFAULT_ROUTE;- setSettingsReturnTo(undefined);- navigate(returnTo, { replace: true });+ const settingsSplit = getSettingsSplit();+ const manager = globalSplitManager();+ if (!settingsSplit || !manager) return;++ if (manager.splits().length > 1) {+ manager.removeSplit(settingsSplit.id);return;}- removeSettingsSplit();- };-- // Restore the layout from before settings opened, then dock the current tab.- // The layout manager owns URL serialization for the new settings pane.- const moveSettingsToSplit = async (tab?: SettingsTab) => {- const currentTab = tab ?? activeTabId();- setActiveTabId(currentTab);- await navigate(settingsReturnTo() ?? DEFAULT_ROUTE, { replace: true });- globalSplitManager()?.openWithSplit(settingsContent(currentTab), {- activate: true,- allowDuplicate: false,- preferNewSplit: true,- mergeHistory: false,- });- focusSettingsPanel();- };+ const handle = manager.getSplit(settingsSplit.id);+ if (handle?.canGoBack()) {+ handle.goBack();+ return;+ }- // Fullscreen has its own URL; browser Back restores the docked layout.- const moveSettingsToSolo = (tab?: SettingsTab) => {- collapseToSoloSettings(tab ?? activeTabId());+ navigate(DEFAULT_ROUTE, { replace: true });};// Focus-aware toggle: bring settings to the user rather than destroying it,@@ -287,23 +222,16 @@ export const useSettingsState = () => {return;}- // Solo takes priority: if it's the only thing showing, leave it.- if (isSoloSettings()) {- closeSettings();-- return;- }-const settingsSplit = getSettingsSplit();if (settingsSplit) {const manager = globalSplitManager();- // Docked but not active: bring settings forward. Otherwise minimize it.+ // Open but not active: bring settings forward. Otherwise close it.if (manager && manager.activeSplitId() !== settingsSplit.id) {manager.activateSplit(settingsSplit.id);focusSettingsPanel();return;}- removeSettingsSplit();+ closeSettings();return;}@@ -327,8 +255,6 @@ export const useSettingsState = () => {selectTab,restoreMobileDeepLink,closeSettings,- moveSettingsToSplit,- moveSettingsToSolo,// Undefined represents the mobile settings index.activeTabId: () => (isMobile() ? mobileSettings.page() : activeTabId()),toggleSettings,diff --git a/apps/web/src/lib/core/email-link/index.ts b/apps/web/src/lib/core/email-link/index.tsindex 07cd0014c2..da4a174146 100644--- a/apps/web/src/lib/core/email-link/index.ts+++ b/apps/web/src/lib/core/email-link/index.ts@@ -3,7 +3,6 @@ import { updateUserAuth } from '@core/auth';import { createNativeAuthSession } from '@core/auth/native-auth';import { toast } from '@core/component/Toast/Toast';import { PaywallKey, usePaywallState } from '@core/constant/PaywallState';-import { currentSettingsReturnTo } from '@core/constant/SettingsState';import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';import { useInitGmailLink } from '@queries/auth';import { invalidateUserInfo } from '@queries/auth/user-info';@@ -310,7 +309,6 @@ export function useAddInboxFlow() {// everyone on a default layout.rememberInboxLinkReturn(result.value.link_id, {url: `${toBaseRelative(window.location.pathname)}${window.location.search}${window.location.hash}`,- settingsReturnTo: currentSettingsReturnTo(),});window.location.href = result.value.authorization_url;} else if (isPaymentRequired(result.error)) {diff --git a/apps/web/src/lib/core/email-link/native-link.test.ts b/apps/web/src/lib/core/email-link/native-link.test.tsindex 091cde1ba4..38375ee94c 100644--- a/apps/web/src/lib/core/email-link/native-link.test.ts+++ b/apps/web/src/lib/core/email-link/native-link.test.ts@@ -28,9 +28,6 @@ vi.mock('@core/constant/PaywallState', () => ({PaywallKey: { MULTI_INBOX: 'multi-inbox' },usePaywallState: () => ({ showPaywall: vi.fn() }),}));-vi.mock('@core/constant/SettingsState', () => ({- currentSettingsReturnTo: () => undefined,-}));vi.mock('@core/mobile/isNativeMobilePlatform', () => ({isNativeMobilePlatform: () => true,}));diff --git a/apps/web/src/lib/core/email-link/return-layout.test.ts b/apps/web/src/lib/core/email-link/return-layout.test.tsindex 625fe305e6..5b29bba47e 100644--- a/apps/web/src/lib/core/email-link/return-layout.test.ts+++ b/apps/web/src/lib/core/email-link/return-layout.test.ts@@ -19,19 +19,6 @@ describe('inbox link return layout', () => {expect(consumeInboxLinkReturn(LINK_ID)).toEqual({url: '/calendar/view/component/documents?preview=0#sel',- settingsReturnTo: undefined,- });- });-- it('round-trips the settings return layout alongside it', () => {- rememberInboxLinkReturn(LINK_ID, {- url: '/settings/connections',- settingsReturnTo: '/home/md/doc-1',- });-- expect(consumeInboxLinkReturn(LINK_ID)).toEqual({- url: '/settings/connections',- settingsReturnTo: '/home/md/doc-1',});});diff --git a/apps/web/src/lib/core/email-link/return-layout.ts b/apps/web/src/lib/core/email-link/return-layout.tsindex 155172d929..9ba1718333 100644--- a/apps/web/src/lib/core/email-link/return-layout.ts+++ b/apps/web/src/lib/core/email-link/return-layout.ts@@ -8,12 +8,6 @@ export type InboxLinkReturn = {* survives with it.*/url: string;- /**- * `settingsReturnTo` as it stood at capture time, present when the flow- * started from solo settings. Restoring it keeps "Back to app" pointing at- * the layout behind settings instead of the default route.- */- settingsReturnTo?: string;};type StoredInboxLinkReturn = InboxLinkReturn & { linkId: string };@@ -78,11 +72,5 @@ export function consumeInboxLinkReturn(if (!stored || stored.linkId !== linkId || typeof stored.url !== 'string') {return undefined;}- return {- url: stored.url,- settingsReturnTo:- typeof stored.settingsReturnTo === 'string'- ? stored.settingsReturnTo- : undefined,- };+ return { url: stored.url };}diff --git a/docs/AGENT_GUIDE/navigation.md b/docs/AGENT_GUIDE/navigation.mdindex 45619aa6bb..71c5e6b253 100644--- a/docs/AGENT_GUIDE/navigation.md+++ b/docs/AGENT_GUIDE/navigation.md@@ -304,8 +304,10 @@ The outer sidebar is an icon rail; labels appear in tooltips.- Nav: `Home`, `Drive`, `Email`, `Chat`, `Tasks`, `Reminders`, `Calendar`,`Agents`, `Customers`. Reminders, Calendar, and Customers appear only whentheir features are enabled.-- Bottom: button named after the user (their name, or email when unset) — menu- with `Command menu (Ctrl K)`, `Settings (Ctrl ;)`, `Log out`.+- Bottom: `Settings` (`Ctrl ;`) — a gear with the signed-in account's profile+ photo as a badge in its corner. It opens Settings directly in the active+ split (Shift-click for a new split); there is no account menu. Log out lives+ at the bottom of the Settings sidebar, and the command menu is `Ctrl K`.Start a new AI chat from the Agents workspace; the rail has no separatenew-chat-in-a-new-split button. Its tooltipsdiff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.mdindex b713a4bd0a..292c12f6e8 100644--- a/docs/AGENT_GUIDE/surfaces.md+++ b/docs/AGENT_GUIDE/surfaces.md@@ -1884,12 +1884,18 @@ menu opened inside the sheet leaves the sheet itself open. Opening Settings agaistarts at the main page; explicit links (for example Account) open theirsection directly. Existing settings URLs open the requested section in the sheetand restore the underlying app route. The header stays visible while forms-scroll, including with the keyboard open. On desktop, `/app/settings/<tab>`-opens settings fullscreen, while `/app/home/~/settings/<tab>` docks it beside-Home. **Open fullscreen** pushes a standalone settings URL; browser Back-restores the preceding split layout. **Move to split** restores the app layout-and docks the selected tab, while closing a docked settings pane minimizes it.-A direct fullscreen link returns to Home when there is no prior app layout.+scroll, including with the keyboard open. On desktop, Settings is an ordinary+split view: the rail's gear button (or `Ctrl ;`) opens it in the active split+like any other rail item, and Shift-click opens it in a new split.+`/app/settings/<tab>` opens it as the only split with the app rail still+visible, and `/app/home/~/settings/<tab>` places it beside Home. Its inner+sidebar matches Email and Tasks: a **Settings** title bar with the+**Hide navigation** toggle (`Cmd .`), a rounded **Search settings** field, the+grouped section pills, and **Log out** pinned to the bottom. Below 720px the+sidebar becomes an overlay opened from **Show navigation**. Escape closes a+settings split that shares the layout, or steps back to the previous view when+it is the only split (Home when there is none). Leave settings by picking any+other rail item; there is no separate back or fullscreen control.Left nav: General → `Account` (profile, delete account), `API Keys` (create /list / delete personal keys; the secret is shown only once and is sent as@@ -1949,7 +1955,7 @@ Cursor stays in Agents → Runtimes with its API key and default model controls;featured or offered in the Connections catalog. Personal Gmail and GitHub accountlinks remain in Settings → Integrations. The native-only Connections page remainsavailable when `pipedream-mcp` is disabled.-`Back to app` returns to the previous surface. Open via user-email button menu or `Ctrl+;`.+Open Settings with the rail's gear button or `Ctrl+;`; leave it by picking any other rail item.`Agents` → `New agent` (or edit an existing agent) opens a full-page form. The`Instructions` field is a Lexical contenteditable textbox, not a textarea. It