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
Add sidebar customization and More menu with stable drag reordering (#7406)
Jacob Beckerman534a7197b784
diff --git a/apps/web/src/components/app/app-sidebar/sidebar.tsx b/apps/web/src/components/app/app-sidebar/sidebar.tsxindex 2e664e7a18..fa7650cc2c 100644--- a/apps/web/src/components/app/app-sidebar/sidebar.tsx+++ b/apps/web/src/components/app/app-sidebar/sidebar.tsx@@ -28,6 +28,7 @@ import {ENABLE_CALLS,enableCrm,enableReminders,+ enableTasksReviews,isFeatureEnabled,} from '@core/constant/featureFlags';import { registerHotkey } from '@core/hotkey/hotkeys';@@ -229,13 +230,15 @@ export const GoToHotkeys = () => {const activityFeedEnabled = useActivityFeedFlag();const recentViewEnabled = useRecentViewFlag();const reminders = useFeatureFlag(enableReminders);+ const reviews = useFeatureFlag(enableTasksReviews);const links = createMemo((): SidebarItem[] =>buildSidebarLinks(gettingStartedEnabled(),calendarUiEnabled(),activityFeedEnabled(),recentViewEnabled(),- reminders().enabled+ reminders().enabled,+ reviews().enabled));@@ -408,9 +411,18 @@ const RECENT_LINK: SidebarItem = {hotkeyToken: TOKENS.sidebar.goTo.recent,};+const REVIEWS_LINK: SidebarItem = {+ id: 'reviews',+ label: 'Reviews',+ href: '/reviews',+ icon: getIconConfig('githubPullRequest').icon,+ hotkey: 'v',+ hotkeyToken: TOKENS.sidebar.goTo.reviews,+};+/*** Assemble the ordered sidebar link list: the static links plus Getting- * started and the flag-gated Recent, Activity, Calendar, Reminders, Calls, and CRM+ * started and the flag-gated Recent, Activity, Calendar, Reminders, Calls, Reviews, and CRM* entries in their correct positions.* Call from a reactive context — it reads `ENABLE_CALLS` / `isFeatureEnabled(enableCrm)`.* `showGettingStarted` is the account-age gate (`useGettingStartedEnabled`),@@ -422,7 +434,8 @@ const buildSidebarLinks = (showCalendar: boolean,showActivity: boolean,showRecent: boolean,- showReminders: boolean+ showReminders: boolean,+ showReviews: boolean): SidebarItem[] => {let links: SidebarItem[] = SIDEBAR_LINKS.filter((link) =>@@ -463,6 +476,11 @@ const buildSidebarLinks = (];}+ if (showReviews) {+ // Reviews sits at the end (accessed via More menu but has a hotkey).+ links = [...links, REVIEWS_LINK];+ }+return links;};diff --git a/apps/web/src/components/app/sidebar-next/customize-sidebar-modal.test.tsx b/apps/web/src/components/app/sidebar-next/customize-sidebar-modal.test.tsxnew file mode 100644index 0000000000..c1f65b49f4--- /dev/null+++ b/apps/web/src/components/app/sidebar-next/customize-sidebar-modal.test.tsx@@ -0,0 +1,135 @@+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';+import { DragDropProvider, DragDropSensors } from '@thisbeyond/solid-dnd';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import { CustomizeSidebarModal } from './customize-sidebar-modal';+import { SidebarPrefsProvider, useSidebarPrefs } from './use-sidebar-prefs';++vi.mock('@core/mobile/isMobile', () => ({ isMobile: () => false }));+vi.mock('@core/mobile/isTouchDevice', () => ({ isTouchDevice: () => false }));++beforeEach(() => {+ localStorage.removeItem('macro:sidebar:prefs');+ vi.stubGlobal('scrollTo', vi.fn());+ vi.stubGlobal(+ 'ResizeObserver',+ class {+ observe() {}+ unobserve() {}+ disconnect() {}+ }+ );+ vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(+ function (this: HTMLElement) {+ const handle = this.querySelector('[aria-label^="Reorder "]');+ const handles = [+ ...document.querySelectorAll('[aria-label^="Reorder "]'),+ ];+ const index = handle ? handles.indexOf(handle) : -1;+ return new DOMRect(100, 100 + Math.max(index, 0) * 40, 320, 40);+ }+ );+});++afterEach(() => {+ cleanup();+ vi.restoreAllMocks();+ vi.unstubAllGlobals();+});++function Modal() {+ const { prefs } = useSidebarPrefs();+ return (+ <CustomizeSidebarModal+ open+ onOpenChange={() => {}}+ gates={{+ showCalendar: true,+ showCustomers: true,+ showReminders: true,+ showCalls: true,+ showReviews: true,+ get prefs() {+ return prefs();+ },+ }}+ />+ );+}++describe('sidebar customization drag sorting', () => {+ it('keeps row targets stable and isolates sorting from the app drag provider', async () => {+ const appCollision = vi.fn(() => null);+ const appDragEnd = vi.fn();+ render(() => (+ <DragDropProvider collisionDetector={appCollision} onDragEnd={appDragEnd}>+ <DragDropSensors />+ <SidebarPrefsProvider>+ <Modal />+ </SidebarPrefsProvider>+ </DragDropProvider>+ ));+ const handle = await screen.findByRole('button', {+ name: 'Reorder Reminders',+ });+ fireEvent.mouseDown(handle, { button: 0, clientX: 115, clientY: 120 });+ fireEvent.mouseMove(document, { clientX: 115, clientY: 200 });++ const drive = screen+ .getByRole('button', { name: 'Reorder Drive' })+ .closest<HTMLElement>('.rounded-lg')!;+ const targetTransform = drive.style.transform;+ expect(targetTransform).not.toBe('');+ // Repeated moves inside one slot must not alternate the sort preview.+ for (let offset = 0; offset < 5; offset++) {+ fireEvent.mouseMove(document, { clientX: 115 + offset, clientY: 200 });+ expect(drive.style.transform).toBe(targetTransform);+ }+ fireEvent.mouseUp(document, { button: 0, clientX: 120, clientY: 200 });+ expect(+ screen+ .getAllByRole('button', { name: /^Reorder / })+ .slice(0, 3)+ .map((button) => button.getAttribute('aria-label'))+ ).toEqual(['Reorder Drive', 'Reorder Email', 'Reorder Reminders']);+ expect(screen.queryByRole('button', { name: 'Reorder Home' })).toBeNull();+ expect(appCollision).not.toHaveBeenCalled();+ expect(appDragEnd).not.toHaveBeenCalled();+ });++ it('reloads persisted preferences for each sidebar mount', async () => {+ const mount = () =>+ render(() => (+ <SidebarPrefsProvider>+ <Modal />+ </SidebarPrefsProvider>+ ));+ mount();+ const reminders = await screen.findByRole<HTMLInputElement>('checkbox', {+ name: 'Reminders',+ });+ expect(reminders.checked).toBe(true);+ fireEvent.click(reminders);+ expect(reminders.checked).toBe(false);+ cleanup();++ mount();+ expect(+ (+ await screen.findByRole<HTMLInputElement>('checkbox', {+ name: 'Reminders',+ })+ ).checked+ ).toBe(false);+ cleanup();++ localStorage.removeItem('macro:sidebar:prefs');+ mount();+ expect(+ (+ await screen.findByRole<HTMLInputElement>('checkbox', {+ name: 'Reminders',+ })+ ).checked+ ).toBe(true);+ });+});diff --git a/apps/web/src/components/app/sidebar-next/customize-sidebar-modal.tsx b/apps/web/src/components/app/sidebar-next/customize-sidebar-modal.tsxnew file mode 100644index 0000000000..76c787c31a--- /dev/null+++ b/apps/web/src/components/app/sidebar-next/customize-sidebar-modal.tsx@@ -0,0 +1,252 @@+import { isTouchDevice } from '@core/mobile/isTouchDevice';+import CaretDownIcon from '@phosphor/caret-down.svg';+import CaretUpIcon from '@phosphor/caret-up.svg';+import DotsSixVerticalIcon from '@phosphor/dots-six-vertical.svg';+import CloseIcon from '@phosphor/x.svg';+import {+ closestCenter,+ createSortable,+ DragDropProvider,+ DragDropSensors,+ type DragEventHandler,+ DragOverlay,+ maybeTransformStyle,+ SortableProvider,+ useDragDropContext,+ useSortableContext,+} from '@thisbeyond/solid-dnd';+import { Button, Checkbox, cn, Dialog, Panel, Tooltip } from '@ui';+import { For, type JSX, Show } from 'solid-js';+import { Dynamic } from 'solid-js/web';+import {+ customizableNavItems,+ type NavItemGates,+ type SidebarNextNavItem,+} from './nav-items';+import { useSidebarPrefs } from './use-sidebar-prefs';++function useNavReorderMode(): 'drag' | 'buttons' {+ const canDrag =+ useDragDropContext() !== null && useSortableContext() !== null;+ return canDrag && !isTouchDevice() ? 'drag' : 'buttons';+}++function CustomizeNavList(props: {+ items: SidebarNextNavItem[];+ onDragEnd: DragEventHandler;+ children: JSX.Element;+}) {+ return (+ // Sort against the original row positions. The app's DOM hit detector+ // follows animated rows and makes the target oscillate as they move away.+ <DragDropProvider+ collisionDetector={closestCenter}+ onDragEnd={props.onDragEnd}+ >+ <DragDropSensors />+ <SortableProvider+ ids={props.items+ .filter((item) => item.id !== 'home')+ .map((item) => item.id)}+ >+ {props.children}+ </SortableProvider>+ <DragOverlay class="z-drag pointer-events-none">+ {(draggable) => (+ <Show when={props.items.find((item) => item.id === draggable?.id)}>+ {(item) => (+ <div class="flex items-center gap-2 rounded-lg bg-surface px-2 py-1.5 text-sm text-ink shadow-md">+ <DotsSixVerticalIcon class="size-7 p-1.5 text-ink-muted" />+ <Dynamic+ component={item().icon}+ class="size-4 text-ink-muted"+ />+ <span>{item().label}</span>+ </div>+ )}+ </Show>+ )}+ </DragOverlay>+ </DragDropProvider>+ );+}++function CustomizeNavRow(props: {+ item: SidebarNextNavItem;+ checked: boolean;+ index: number;+ count: number;+ onMove: (direction: -1 | 1) => void;+}) {+ const { setSidebarItemVisible } = useSidebarPrefs();+ const isHome = () => props.item.id === 'home';+ const canMoveUp = () => !isHome() && props.index > 1;+ const canMoveDown = () => !isHome() && props.index < props.count - 1;+ const reorderMode = useNavReorderMode();+ const [dndState] = useDragDropContext() ?? [];++ const sortable =+ !isHome() && reorderMode === 'drag'+ ? createSortable(props.item.id)+ : undefined;++ const handleKeyDown = (e: KeyboardEvent) => {+ if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') return;+ e.preventDefault();+ if (isHome()) return;+ if (e.key === 'ArrowUp' && canMoveUp()) props.onMove(-1);+ if (e.key === 'ArrowDown' && canMoveDown()) props.onMove(1);+ };++ return (+ <div+ ref={sortable?.ref}+ style={sortable ? maybeTransformStyle(sortable.transform) : undefined}+ class={cn(+ 'flex items-center gap-2 rounded-lg px-2 py-1.5',+ !!dndState?.active.draggable &&+ !sortable?.isActiveDraggable &&+ 'transition-transform',+ sortable?.isActiveDraggable && 'opacity-40'+ )}+ >+ <Show+ when={!isHome()}+ fallback={<span class="size-7 shrink-0" aria-hidden="true" />}+ >+ <Show+ when={reorderMode === 'drag' && sortable}+ fallback={+ <div class="flex shrink-0 flex-col">+ <Button+ variant="ghost"+ size="icon-sm"+ class="size-6"+ label={`Move ${props.item.label} up`}+ disabled={!canMoveUp()}+ onClick={() => props.onMove(-1)}+ >+ <CaretUpIcon class="size-3" />+ </Button>+ <Button+ variant="ghost"+ size="icon-sm"+ class="size-6"+ label={`Move ${props.item.label} down`}+ disabled={!canMoveDown()}+ onClick={() => props.onMove(1)}+ >+ <CaretDownIcon class="size-3" />+ </Button>+ </div>+ }+ >+ <Tooltip label="Drag to reorder">+ <Button+ {...(sortable?.dragActivators ?? {})}+ aria-label={`Reorder ${props.item.label}`}+ variant="ghost"+ size="icon-sm"+ class="size-7 cursor-grab touch-none active:cursor-grabbing"+ onKeyDown={handleKeyDown}+ >+ <DotsSixVerticalIcon class="size-4 text-ink-muted" />+ </Button>+ </Tooltip>+ </Show>+ </Show>++ <Checkbox+ checked={props.checked}+ disabled={isHome()}+ onChange={(checked) => setSidebarItemVisible(props.item.id, checked)}+ class="min-w-0 flex-1 cursor-default"+ >+ <Checkbox.Control>+ <Checkbox.Indicator />+ </Checkbox.Control>+ <Checkbox.Label class="flex min-w-0 flex-1 items-center gap-2 text-sm text-ink">+ <Dynamic+ component={props.item.icon}+ class="size-4 shrink-0 text-ink-muted"+ />+ <span class="min-w-0 truncate">{props.item.label}</span>+ </Checkbox.Label>+ </Checkbox>+ </div>+ );+}++/**+ * Center modal for showing/hiding and reordering outer sidebar items.+ * Opened from the More menu's "Customize sidebar" action.+ */+export function CustomizeSidebarModal(props: {+ gates: NavItemGates;+ open: boolean;+ onOpenChange: (open: boolean) => void;+}) {+ const { reorderSidebarItems } = useSidebarPrefs();+ const items = () => customizableNavItems(props.gates);+ const orderIds = () => items().map((item) => item.id);+ const onDragEnd: DragEventHandler = ({ draggable, droppable }) => {+ if (!droppable) return;+ const ids = orderIds();+ reorderSidebarItems(+ ids.indexOf(String(draggable.id)),+ ids.indexOf(String(droppable.id)),+ ids+ );+ };++ const moveByDirection = (itemId: string, direction: -1 | 1) => {+ const ids = orderIds();+ const from = ids.indexOf(itemId);+ if (from < 0) return;+ reorderSidebarItems(from, from + direction, ids);+ };++ return (+ <Dialog+ open={props.open}+ onOpenChange={props.onOpenChange}+ position="center"+ animate+ class="w-96 max-w-[calc(100vw-16px)]"+ >+ <Panel depth={2} class="max-h-[75vh] text-ink rounded-xl">+ <Panel.Header class="px-2 gap-1">+ <Dialog.CloseButton as={Button} variant="ghost" size="icon-sm">+ <CloseIcon />+ </Dialog.CloseButton>+ <Dialog.Title as="span" class="text-sm font-medium p-0 m-0">+ Customize sidebar+ </Dialog.Title>+ </Panel.Header>++ <Panel.Body scroll class="p-2">+ <Dialog.Description class="px-2 pb-2 text-sm text-ink-muted">+ Choose which apps appear in the sidebar and drag to reorder them.+ Home always stays first.+ </Dialog.Description>++ <CustomizeNavList items={items()} onDragEnd={onDragEnd}>+ <For each={items()}>+ {(item, index) => (+ <CustomizeNavRow+ item={item}+ checked={+ item.id === 'home' || !props.gates.prefs.hidden.has(item.id)+ }+ index={index()}+ count={items().length}+ onMove={(direction) => moveByDirection(item.id, direction)}+ />+ )}+ </For>+ </CustomizeNavList>+ </Panel.Body>+ </Panel>+ </Dialog>+ );+}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.tsxindex aa78eb0457..7472a32420 100644--- a/apps/web/src/components/app/sidebar-next/list-nav.test.tsx+++ b/apps/web/src/components/app/sidebar-next/list-nav.test.tsx@@ -3,6 +3,7 @@ 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';+import { SidebarPrefsProvider } from './use-sidebar-prefs';const mocks = vi.hoisted(() => ({setActiveView: (_view: string) => {},@@ -73,10 +74,10 @@ afterEach(() => {describe('ListNav', () => {it('does not reclaim the highlight when the view it left becomes active again', () => {render(() => (- <>+ <SidebarPrefsProvider><ListNav item={item('home', 'Home')} /><ListNav item={item('agents', 'Agents')} />- </>+ </SidebarPrefsProvider>));const agents = screen.getByRole('button', { name: 'Agents' });diff --git a/apps/web/src/components/app/sidebar-next/list-nav.tsx b/apps/web/src/components/app/sidebar-next/list-nav.tsxindex d777097c1d..78984a6df7 100644--- a/apps/web/src/components/app/sidebar-next/list-nav.tsx+++ b/apps/web/src/components/app/sidebar-next/list-nav.tsx@@ -7,6 +7,7 @@ import {sidebarContent,} from '@components/app/app-sidebar/sidebar';import { useSplitLayout } from '@components/app/split-layout/layout';+import { MenuItem, MenuSeparator } from '@core/component/ContextMenu';import { TOKENS } from '@core/hotkey/tokens';import PhoneCallIcon from '@phosphor-fill/phone-call-fill.svg';import { useLocation } from '@solidjs/router';@@ -15,6 +16,7 @@ import { createSignal, onCleanup, Show } from 'solid-js';import { NavGlyph } from './nav-glyph';import type { SidebarNextNavItem } from './nav-items';import { SidebarUnreadDot } from './unread-dot';+import { useSidebarPrefs } from './use-sidebar-prefs';export type ListNavProps = {item: SidebarNextNavItem;@@ -55,6 +57,7 @@ const activeContentKey = () => {* for that is deliberately absent until there is a data source to fill it.*/export const ListNav = (props: ListNavProps) => {+ const { hideSidebarItem } = useSidebarPrefs();const analytics = useAnalytics();const layout = useSplitLayout();const location = useLocation();@@ -182,6 +185,15 @@ export const ListNav = (props: ListNavProps) => {onOpenChange={props.onContextMenuOpenChange}// The trigger defaults to `w-full h-7`, which clips the round button.triggerClass="size-10"+ additionalActions={+ <Show when={props.item.id !== 'home'}>+ <MenuSeparator />+ <MenuItem+ text="Hide from sidebar"+ onClick={() => hideSidebarItem(props.item.id)}+ />+ </Show>+ }><Buttonvariant="ghost"diff --git a/apps/web/src/components/app/sidebar-next/more-menu.tsx b/apps/web/src/components/app/sidebar-next/more-menu.tsxnew file mode 100644index 0000000000..e8fae0bdbd--- /dev/null+++ b/apps/web/src/components/app/sidebar-next/more-menu.tsx@@ -0,0 +1,98 @@+import { useAnalytics } from '@app/lib/analytics/analytics-context';+import { globalSplitManager } from '@app/signal/splitLayout';+import { navigateToSidebarView } from '@components/app/app-sidebar/sidebar';+import { useSplitLayout } from '@components/app/split-layout/layout';+import DotsThreeIcon from '@phosphor/dots-three.svg';+import { Dropdown } from '@ui';+import { createSignal, For, Show } from 'solid-js';+import { Dynamic } from 'solid-js/web';+import { CustomizeSidebarModal } from './customize-sidebar-modal';+import {+ moreMenuItems,+ type NavItemGates,+ type SidebarNextNavItem,+} from './nav-items';++export type MoreMenuProps = {+ gates: NavItemGates;+};++function navigateToItem(+ item: SidebarNextNavItem,+ openWithSplit: ReturnType<typeof useSplitLayout>['openWithSplit'],+ analytics: ReturnType<typeof useAnalytics>+) {+ analytics.track('sidebar_click', { view: item.id });+ navigateToSidebarView({+ viewId: item.id,+ params: item.params,+ shiftKey: false,+ openWithSplit,+ referredFrom: 'sidebar',+ });+ globalSplitManager()?.returnFocus();+}++/**+ * The "More" menu button in the sidebar rail, shown below the main nav.+ * Lists hidden items for quick open, and opens the Customize sidebar modal.+ */+export function MoreMenu(props: MoreMenuProps) {+ const [customizeSidebarOpen, setCustomizeSidebarOpen] = createSignal(false);+ const analytics = useAnalytics();+ const layout = useSplitLayout();+ const hiddenItems = () => moreMenuItems(props.gates);++ return (+ <>+ <Dropdown placement="right-start" gutter={6}>+ <Dropdown.Trigger+ variant="ghost"+ size="icon-md"+ class="size-10 shrink-0 cursor-default rounded-xl"+ label="More"+ tooltip="More options"+ tooltipPlacement="right"+ draggable={false}+ data-sidebar-next-item="more"+ >+ <DotsThreeIcon class="size-5" />+ </Dropdown.Trigger>+ <Dropdown.Content class="min-w-[14rem]">+ <Show when={hiddenItems().length > 0}>+ <Dropdown.Group>+ <For each={hiddenItems()}>+ {(item) => (+ <Dropdown.Item+ class="gap-2"+ onSelect={() =>+ navigateToItem(item, layout.openWithSplit, analytics)+ }+ >+ <Dynamic+ component={item.icon}+ class="size-4 shrink-0 text-ink-muted"+ />+ <span class="flex-1 truncate text-ink">{item.label}</span>+ </Dropdown.Item>+ )}+ </For>+ </Dropdown.Group>+ </Show>++ <Dropdown.Group>+ <Dropdown.Item onSelect={() => setCustomizeSidebarOpen(true)}>+ <span class="flex-1 truncate text-ink">Customize sidebar</span>+ </Dropdown.Item>+ </Dropdown.Group>+ </Dropdown.Content>+ </Dropdown>++ <CustomizeSidebarModal+ gates={props.gates}+ open={customizeSidebarOpen()}+ onOpenChange={setCustomizeSidebarOpen}+ />+ </>+ );+}diff --git a/apps/web/src/components/app/sidebar-next/nav-items.test.ts b/apps/web/src/components/app/sidebar-next/nav-items.test.tsindex 8cdede7389..6e4f7b0d09 100644--- a/apps/web/src/components/app/sidebar-next/nav-items.test.ts+++ b/apps/web/src/components/app/sidebar-next/nav-items.test.ts@@ -1,18 +1,44 @@import { describe, expect, it } from 'vitest';-import { visibleNavItems } from './nav-items';+import {+ customizableNavItems,+ moreMenuItems,+ type NavItemGates,+ orderNavItems,+ SIDEBAR_NEXT_NAV_ITEMS,+ visibleNavItems,+} from './nav-items';+import { DEFAULT_HIDDEN_IDS, type SidebarPrefs } from './use-sidebar-prefs';++const defaultPrefs = (overrides: Partial<SidebarPrefs> = {}): SidebarPrefs => ({+ hidden: new Set(DEFAULT_HIDDEN_IDS),+ order: [],+ ...overrides,+});++const defaultGates = (overrides: Partial<NavItemGates> = {}): NavItemGates => ({+ showCalendar: true,+ showCustomers: true,+ showReminders: true,+ showCalls: true,+ showReviews: true,+ prefs: defaultPrefs(),+ ...overrides,+});describe('reminders navigation item', () => {it('exposes the canonical list destination only while enabled', () => {- const enabled = visibleNavItems({- showCalendar: true,- showCustomers: true,- showReminders: true,- });- const disabled = visibleNavItems({- showCalendar: true,- showCustomers: true,- showReminders: false,- });+ const enabled = visibleNavItems(+ defaultGates({+ showReminders: true,+ prefs: defaultPrefs({ hidden: new Set() }),+ })+ );+ const disabled = visibleNavItems(+ defaultGates({+ showReminders: false,+ prefs: defaultPrefs({ hidden: new Set() }),+ })+ );expect(enabled.find((item) => item.id === 'reminders')).toMatchObject({label: 'Reminders',@@ -21,3 +47,71 @@ describe('reminders navigation item', () => {expect(disabled.some((item) => item.id === 'reminders')).toBe(false);});});++describe('sidebar visibility preferences', () => {+ it('hides calls and reviews from the rail by default', () => {+ const items = visibleNavItems(defaultGates());++ expect(items.some((item) => item.id === 'calls')).toBe(false);+ expect(items.some((item) => item.id === 'reviews')).toBe(false);+ expect(items.some((item) => item.id === 'home')).toBe(true);+ expect(items.some((item) => item.id === 'tasks')).toBe(true);+ });++ it('puts default-hidden items in the more menu', () => {+ const items = moreMenuItems(defaultGates());++ expect(items.map((item) => item.id)).toEqual(['calls', 'reviews']);+ });++ it('shows an item on the rail when it is not hidden', () => {+ const items = visibleNavItems(+ defaultGates({+ prefs: defaultPrefs({ hidden: new Set(['reviews']) }),+ })+ );++ expect(items.find((item) => item.id === 'calls')).toMatchObject({+ label: 'Calls',+ href: '/calls',+ });+ expect(items.some((item) => item.id === 'reviews')).toBe(false);+ });++ it('never hides home from the rail', () => {+ const items = visibleNavItems(+ defaultGates({+ prefs: defaultPrefs({ hidden: new Set(['home', 'tasks']) }),+ })+ );++ expect(items.some((item) => item.id === 'home')).toBe(true);+ expect(items.some((item) => item.id === 'tasks')).toBe(false);+ });++ it('lists shown and hidden items in the customize menu', () => {+ const items = customizableNavItems(defaultGates());++ expect(items.some((item) => item.id === 'home')).toBe(true);+ expect(items.some((item) => item.id === 'calls')).toBe(true);+ expect(items.some((item) => item.id === 'reviews')).toBe(true);+ });+});++describe('orderNavItems', () => {+ it('keeps home first and applies a custom order', () => {+ const ordered = orderNavItems(SIDEBAR_NEXT_NAV_ITEMS, [+ 'tasks',+ 'mail',+ 'home',+ 'documents',+ ]);++ expect(ordered.map((item) => item.id).slice(0, 4)).toEqual([+ 'home',+ 'tasks',+ 'mail',+ 'documents',+ ]);+ });+});diff --git a/apps/web/src/components/app/sidebar-next/nav-items.ts b/apps/web/src/components/app/sidebar-next/nav-items.tsindex 7cffceb928..5532b65d11 100644--- a/apps/web/src/components/app/sidebar-next/nav-items.ts+++ b/apps/web/src/components/app/sidebar-next/nav-items.ts@@ -8,8 +8,10 @@ import CalendarBlankIcon from '@phosphor/calendar-blank.svg';import ChatsCircleIcon from '@phosphor/chats-circle.svg';import EnvelopeIcon from '@phosphor/envelope.svg';import FolderSimpleIcon from '@phosphor/folder-simple.svg';+import GitPullRequestIcon from '@phosphor/git-pull-request.svg';import HouseIcon from '@phosphor/house.svg';import ListChecksIcon from '@phosphor/list-checks.svg';+import PhoneCallIcon from '@phosphor/phone-call.svg';import AgentIcon from '@phosphor/sparkle.svg';import BellFillIcon from '@phosphor-fill/bell-fill.svg';import BuildingsFillIcon from '@phosphor-fill/buildings-fill.svg';@@ -17,10 +19,13 @@ import CalendarBlankFillIcon from '@phosphor-fill/calendar-blank-fill.svg';import ChatsCircleFillIcon from '@phosphor-fill/chats-circle-fill.svg';import EnvelopeFillIcon from '@phosphor-fill/envelope-fill.svg';import FolderSimpleFillIcon from '@phosphor-fill/folder-simple-fill.svg';+import GitPullRequestFillIcon from '@phosphor-fill/git-pull-request-fill.svg';import HouseFillIcon from '@phosphor-fill/house-fill.svg';import ListChecksFillIcon from '@phosphor-fill/list-checks-fill.svg';+import PhoneCallFillIcon from '@phosphor-fill/phone-call-fill.svg';import AgentFillIcon from '@phosphor-fill/sparkle-fill.svg';import type { NavIcon } from './nav-glyph';+import type { SidebarPrefs } from './use-sidebar-prefs';/*** A SidebarRail nav button's definition: a `SidebarItem` plus the filled icon@@ -34,7 +39,7 @@ export type SidebarNextNavItem = SidebarItem & {};/**- * SidebarRail's nav buttons, in render order.+ * SidebarRail's nav buttons, in default render order.** Phosphor icons rather than the animated `wide-*` set: they are plain* `fill="currentColor"` SVGs, so the active button's `text-ink-muted` colours@@ -44,7 +49,7 @@ export type SidebarNextNavItem = SidebarItem & {* `GoToHotkeys` registers off `buildSidebarLinks` — `g h` reaches Home, `g f`* reaches Drive. These tokens only label the tooltips.*/-const SIDEBAR_NEXT_NAV_ITEMS = [+export const SIDEBAR_NEXT_NAV_ITEMS = [{id: 'home',label: 'Home',@@ -126,17 +131,108 @@ const SIDEBAR_NEXT_NAV_ITEMS = [hotkey: 'o',hotkeyToken: TOKENS.sidebar.goTo.companies,},+ {+ id: 'calls',+ label: 'Calls',+ href: LIST_VIEW_PATHS.calls,+ icon: PhoneCallIcon,+ iconActive: PhoneCallFillIcon,+ hotkey: 'l',+ hotkeyToken: TOKENS.sidebar.goTo.calls,+ },+ {+ id: 'reviews',+ label: 'Reviews',+ href: '/reviews',+ icon: GitPullRequestIcon,+ iconActive: GitPullRequestFillIcon,+ hotkey: 'v',+ hotkeyToken: TOKENS.sidebar.goTo.reviews,+ },] satisfies SidebarNextNavItem[];-/** Feature flag gates for the Calendar and Customers buttons. */+/** Feature flag gates for feature-gated nav buttons. */export type NavItemGates = {showCalendar: boolean;showCustomers: boolean;showReminders: boolean;+ showCalls: boolean;+ showReviews: boolean;+ /** User preferences for which items are shown and in what order. */+ prefs: SidebarPrefs;+};++/** Whether a feature-gated item is available for this account. */+export const isNavItemAvailable = (+ item: SidebarNextNavItem,+ gates: NavItemGates+): boolean => {+ if (item.id === 'calendar') return gates.showCalendar;+ if (item.id === 'companies') return gates.showCustomers;+ if (item.id === 'reminders') return gates.showReminders;+ if (item.id === 'calls') return gates.showCalls;+ if (item.id === 'reviews') return gates.showReviews;+ return true;};/**- * The nav buttons on offer right now.+ * Apply the user's custom order. Home stays first. Ids absent from `order`+ * keep their relative catalog position after ordered ones.+ */+export const orderNavItems = (+ items: SidebarNextNavItem[],+ order: readonly string[]+): SidebarNextNavItem[] => {+ if (order.length === 0) return items;++ const byId = new Map(items.map((item) => [item.id, item]));+ const used = new Set<string>();+ const result: SidebarNextNavItem[] = [];++ const home = byId.get('home');+ if (home) {+ result.push(home);+ used.add('home');+ }++ for (const id of order) {+ if (id === 'home' || used.has(id)) continue;+ const item = byId.get(id);+ if (item) {+ result.push(item);+ used.add(id);+ }+ }++ for (const item of items) {+ if (!used.has(item.id)) result.push(item);+ }++ return result;+};++/**+ * Available items in customize-menu order — includes both shown and hidden.+ * Home is always first.+ */+export const customizableNavItems = (+ gates: NavItemGates+): SidebarNextNavItem[] =>+ orderNavItems(+ SIDEBAR_NEXT_NAV_ITEMS.filter((item) => isNavItemAvailable(item, gates)),+ gates.prefs.order+ );++/**+ * Items hidden from the rail but available for quick open in the More menu.+ */+export const moreMenuItems = (gates: NavItemGates): SidebarNextNavItem[] =>+ customizableNavItems(gates).filter(+ (item) => item.id !== 'home' && gates.prefs.hidden.has(item.id)+ );++/**+ * The nav buttons currently on the outer rail.** Gates are passed in rather than read here: both are PostHog-backed, and the* imperative `ENABLE_CRM()` / `ENABLE_CALENDAR_UI()` readers call@@ -144,9 +240,6 @@ export type NavItemGates = {* would never reach the rendered list. Callers subscribe with `useFeatureFlag`.*/export const visibleNavItems = (gates: NavItemGates): SidebarNextNavItem[] =>- SIDEBAR_NEXT_NAV_ITEMS.filter((item) => {- if (item.id === 'calendar') return gates.showCalendar;- if (item.id === 'companies') return gates.showCustomers;- if (item.id === 'reminders') return gates.showReminders;- return true;- });+ customizableNavItems(gates).filter(+ (item) => item.id === 'home' || !gates.prefs.hidden.has(item.id)+ );diff --git a/apps/web/src/components/app/sidebar-next/sidebar-rail.tsx b/apps/web/src/components/app/sidebar-next/sidebar-rail.tsxindex c4b7ce0adb..76a23e0ee0 100644--- a/apps/web/src/components/app/sidebar-next/sidebar-rail.tsx+++ b/apps/web/src/components/app/sidebar-next/sidebar-rail.tsx@@ -9,10 +9,12 @@ import { For, Show, Suspense } from 'solid-js';import { SidebarRailCreateButton } from './create-button';import { FooterActions } from './footer-actions';import { ListNav, type ListNavProps } from './list-nav';+import { MoreMenu } from './more-menu';import { visibleNavItems } from './nav-items';import { useSidebarUnread } from './queries/use-sidebar-unread';import { SearchRailButton } from './search-bar-button';import { useNavItemGates } from './use-nav-item-gates';+import { SidebarPrefsProvider } from './use-sidebar-prefs';function ChannelsListNav(props: Omit<ListNavProps, 'activeCall'>) {const hasActiveCall = useHasActiveChannelsCall();@@ -29,7 +31,13 @@ function ChannelsListNav(props: Omit<ListNavProps, 'activeCall'>) {* separately. There is no room for leader-key hints on the buttons, so each* button's tooltip carries its shortcut instead.*/-export const SidebarRail = () => {+export const SidebarRail = () => (+ <SidebarPrefsProvider>+ <SidebarRailContent />+ </SidebarPrefsProvider>+);++const SidebarRailContent = () => {const gates = useNavItemGates();const analytics = useAnalytics();const layout = useSplitLayout();@@ -60,7 +68,7 @@ export const SidebarRail = () => {<SidebarRailCreateButton /><SearchRailButton />- <nav class="shrink-0 pt-4">+ <nav class="min-h-0 overflow-y-auto pt-4"><ul class="flex flex-col items-center gap-1"><For each={visibleNavItems(gates())}>{(item) => (@@ -83,6 +91,8 @@ export const SidebarRail = () => {</ul></nav>+ <MoreMenu gates={gates()} />+<div class="min-h-0 flex-1" /><FooterActions />diff --git a/apps/web/src/components/app/sidebar-next/use-nav-item-gates.ts b/apps/web/src/components/app/sidebar-next/use-nav-item-gates.tsindex 10eaac05d3..4f29bfbb67 100644--- a/apps/web/src/components/app/sidebar-next/use-nav-item-gates.ts+++ b/apps/web/src/components/app/sidebar-next/use-nav-item-gates.ts@@ -1,22 +1,34 @@import { useCalendarUiFlag } from '@app/features/calendar/hooks/use-calendar-ui-flag';import { useFeatureFlag } from '@app/lib/analytics/posthog';-import { enableCrm, enableReminders } from '@core/constant/featureFlags';-import type { Accessor } from 'solid-js';+import {+ ENABLE_CALLS,+ enableCrm,+ enableReminders,+ enableTasksReviews,+} from '@core/constant/featureFlags';+import { type Accessor, createMemo } from 'solid-js';import type { NavItemGates } from './nav-items';+import { useSidebarPrefs } from './use-sidebar-prefs';/**- * Subscribes to the flags gating the Calendar and Customers rows, so a flag- * that resolves after mount still reaches the rendered list. Shared by the- * sidebar's nav and the More Apps grid so the two can't disagree about which- * apps exist.+ * Subscribes to the flags gating Calendar, Customers, Calls, and Reviews, so a+ * flag that resolves after mount still reaches the rendered list. Shared by the+ * sidebar's nav and the More menu so the two can't disagree about which apps+ * exist.*/export function useNavItemGates(): Accessor<NavItemGates> {const calendar = useCalendarUiFlag();const crm = useFeatureFlag(enableCrm);const reminders = useFeatureFlag(enableReminders);- return () => ({+ const reviews = useFeatureFlag(enableTasksReviews);+ const { prefs } = useSidebarPrefs();++ return createMemo(() => ({showCalendar: calendar(),showCustomers: crm().enabled,showReminders: reminders().enabled,- });+ showCalls: ENABLE_CALLS,+ showReviews: reviews().enabled,+ prefs: prefs(),+ }));}diff --git a/apps/web/src/components/app/sidebar-next/use-sidebar-prefs.ts b/apps/web/src/components/app/sidebar-next/use-sidebar-prefs.tsnew file mode 100644index 0000000000..3a58aa2452--- /dev/null+++ b/apps/web/src/components/app/sidebar-next/use-sidebar-prefs.ts@@ -0,0 +1,145 @@+import { createAssertedContextProvider } from '@core/context/createContext';+import { createSignal, onMount } from 'solid-js';++const STORAGE_KEY = 'macro:sidebar:prefs';+const LEGACY_PINNED_KEY = 'macro:sidebar:pinned-items';++/** Items hidden from the rail by default (reachable via the More menu). */+export const DEFAULT_HIDDEN_IDS = ['calls', 'reviews'] as const;++export type SidebarPrefs = {+ /** Item ids hidden from the outer rail. Home is never included. */+ hidden: Set<string>;+ /** Custom rail order. Missing ids fall back to the default catalog order. */+ order: string[];+};++type StoredPrefs = {+ hidden?: string[];+ order?: string[];+};++function defaultPrefs(): SidebarPrefs {+ return {+ hidden: new Set(DEFAULT_HIDDEN_IDS),+ order: [],+ };+}++function loadPrefs(): SidebarPrefs {+ try {+ const stored = localStorage.getItem(STORAGE_KEY);+ if (stored) {+ const parsed = JSON.parse(stored) as StoredPrefs;+ return {+ hidden: new Set((parsed.hidden ?? []).filter((id) => id !== 'home')),+ order: Array.isArray(parsed.order) ? parsed.order : [],+ };+ }++ // Migrate the short-lived pinned-items key (calls/reviews only).+ const legacy = localStorage.getItem(LEGACY_PINNED_KEY);+ if (legacy) {+ const pinned = JSON.parse(legacy);+ if (Array.isArray(pinned)) {+ const pinnedSet = new Set(pinned as string[]);+ const hidden = DEFAULT_HIDDEN_IDS.filter((id) => !pinnedSet.has(id));+ localStorage.removeItem(LEGACY_PINNED_KEY);+ const prefs = { hidden: new Set(hidden), order: [] as string[] };+ savePrefs(prefs);+ return prefs;+ }+ }+ } catch {+ // Ignore parse errors+ }+ return defaultPrefs();+}++function savePrefs(prefs: SidebarPrefs): void {+ try {+ const payload: StoredPrefs = {+ hidden: [...prefs.hidden].filter((id) => id !== 'home'),+ order: prefs.order,+ };+ localStorage.setItem(STORAGE_KEY, JSON.stringify(payload));+ } catch {+ // Ignore storage errors+ }+}++export const [SidebarPrefsProvider, useSidebarPrefs] =+ createAssertedContextProvider('SidebarPrefs', () => {+ const [prefs, setPrefs] = createSignal<SidebarPrefs>(defaultPrefs());+ onMount(() => setPrefs(loadPrefs()));++ function updatePrefs(+ mutator: (current: SidebarPrefs) => SidebarPrefs+ ): void {+ setPrefs((current) => {+ const next = mutator(current);+ savePrefs(next);+ return next;+ });+ }++ /** Hide an item from the outer rail (Home is ignored). */+ function hideSidebarItem(itemId: string): void {+ if (itemId === 'home') return;+ updatePrefs((current) => {+ const hidden = new Set(current.hidden);+ hidden.add(itemId);+ return { ...current, hidden };+ });+ }++ /** Show an item on the outer rail. */+ function showSidebarItem(itemId: string): void {+ updatePrefs((current) => {+ const hidden = new Set(current.hidden);+ hidden.delete(itemId);+ return { ...current, hidden };+ });+ }++ /** Toggle whether an item is visible on the outer rail. */+ function setSidebarItemVisible(itemId: string, visible: boolean): void {+ if (visible) showSidebarItem(itemId);+ else hideSidebarItem(itemId);+ }++ /**+ * Reorder items by moving the item at `fromIndex` to `toIndex`.+ * Home stays pinned at index 0 when present.+ */+ function reorderSidebarItems(+ fromIndex: number,+ toIndex: number,+ orderIds: readonly string[]+ ): void {+ if (fromIndex === toIndex) return;+ if (fromIndex < 0 || toIndex < 0) return;+ if (fromIndex >= orderIds.length || toIndex >= orderIds.length) return;++ const nextOrder = [...orderIds];+ const [removed] = nextOrder.splice(fromIndex, 1);+ if (removed === 'home') return;+ nextOrder.splice(toIndex, 0, removed);++ // Keep Home first if it was in the list.+ const homeIndex = nextOrder.indexOf('home');+ if (homeIndex > 0) {+ nextOrder.splice(homeIndex, 1);+ nextOrder.unshift('home');+ }++ updatePrefs((current) => ({ ...current, order: nextOrder }));+ }++ return {+ prefs,+ hideSidebarItem,+ setSidebarItemVisible,+ reorderSidebarItems,+ };+ });diff --git a/apps/web/src/features/tasks-view/components/TasksSidebar.tsx b/apps/web/src/features/tasks-view/components/TasksSidebar.tsxindex f0df384f85..00e2b8ee5c 100644--- a/apps/web/src/features/tasks-view/components/TasksSidebar.tsx+++ b/apps/web/src/features/tasks-view/components/TasksSidebar.tsx@@ -8,9 +8,8 @@ import { FavoriteContextMenu } from '@app/features/favorites/FavoriteContextMenuimport { FavoriteIcon } from '@app/features/favorites/FavoriteIcon';import { openProject } from '@app/features/projects/open-project';import { ProjectsSidebarSection } from '@app/features/projects/projects';-import { useFeatureFlag } from '@app/lib/analytics/posthog';import { useNavigate, useParams } from '@app/lib/split-router';-import { projectDetailRoute, reviewsSplitRoute } from '@app/routes/routes';+import { projectDetailRoute } from '@app/routes/routes';import {favoriteSplitContent,useFavoriteDisplayName,@@ -18,9 +17,7 @@ import {import { useSplitLayout } from '@components/app/split-layout/layout';import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';import { toast } from '@core/component/Toast/Toast';-import { enableTasksReviews } from '@core/constant/featureFlags';import CheckSquareIcon from '@phosphor/check-square.svg';-import GitPullRequestIcon from '@phosphor/git-pull-request.svg';import ListChecksIcon from '@phosphor/list-checks.svg';import NoteIcon from '@phosphor/note-pencil.svg';import StackIcon from '@phosphor/stack.svg';@@ -41,29 +38,11 @@ const TASK_NAV_ITEMS = [{ id: 'projects', label: 'Projects', icon: StackIcon },] satisfies { id: TasksTab; label: string; icon: typeof NoteIcon }[];-export function TasksNavigation(props: {- reviewsEnabled: boolean;- onNavigate?: () => void;-}) {+export function TasksNavigation(props: { onNavigate?: () => void }) {const { state, setTab, projectsEnabled } = useTasksView();- const navigate = useNavigate();return (<ViewSidebar.Nav aria-label="Task views">- <Show when={props.reviewsEnabled}>- <ViewSidebar.Item- class="mb-3"- onClick={() => {- navigate({ route: reviewsSplitRoute, params: {} });- props.onNavigate?.();- }}- >- <ViewSidebar.Icon>- <GitPullRequestIcon class="size-4" />- </ViewSidebar.Icon>- <span class="truncate">Reviews</span>- </ViewSidebar.Item>- </Show><Foreach={TASK_NAV_ITEMS.filter((item) => item.id !== 'projects' || projectsEnabled()@@ -170,8 +149,6 @@ export function TasksSidebar() {const routeParams = useParams<{ projectId?: string }>();const navigate = useNavigate();const panel = useSplitPanelOrThrow();- const reviewsFlag = useFeatureFlag(enableTasksReviews);- const reviewsEnabled = () => reviewsFlag().enabled;const {state,projectsEnabled,@@ -184,17 +161,12 @@ export function TasksSidebar() {useViewTabHotkeys({scopeId: panel.splitHotkeyScope,enabled: panel.isPanelActive,- ids: () => [- ...(reviewsEnabled() ? ['reviews'] : []),- ...TASK_NAV_ITEMS.filter(+ ids: () =>+ TASK_NAV_ITEMS.filter((tab) => tab.id !== 'projects' || projectsEnabled()).map((tab) => tab.id),- ],activeId: () => state.tab,- setActiveId: (id) => {- if (id === 'reviews') navigate({ route: reviewsSplitRoute, params: {} });- else setTab(id as TasksTab);- },+ setActiveId: (id) => setTab(id as TasksTab),});return (@@ -211,7 +183,7 @@ export function TasksSidebar() {/><ViewSidebar.Content>- <TasksNavigation reviewsEnabled={reviewsEnabled()} />+ <TasksNavigation /><TaskFavoritesopen={isSidebarSectionOpen('favorites')}diff --git a/apps/web/src/lib/core/hotkey/tokens.ts b/apps/web/src/lib/core/hotkey/tokens.tsindex fae61b959a..31110ef053 100644--- a/apps/web/src/lib/core/hotkey/tokens.ts+++ b/apps/web/src/lib/core/hotkey/tokens.ts@@ -131,6 +131,7 @@ export const TOKENS = {reminders: 'sidebar.goTo.reminders',channels: 'sidebar.goTo.channels',calls: 'sidebar.goTo.calls',+ reviews: 'sidebar.goTo.reviews',companies: 'sidebar.goTo.companies',folders: 'sidebar.goTo.folders',},diff --git a/docs/AGENT_GUIDE/navigation.md b/docs/AGENT_GUIDE/navigation.mdindex 9c6743a6c6..a5962454a5 100644--- a/docs/AGENT_GUIDE/navigation.md+++ b/docs/AGENT_GUIDE/navigation.md@@ -297,6 +297,14 @@ stay centered and the preview body fills the remaining height below the divider.The outer sidebar is an icon rail; labels appear in tooltips.+Open **More → Customize sidebar** to show, hide, or reorder available apps.+On desktop, drag an app by its **Reorder <name>** handle; Up/Down on the focused+handle also moves it. Touch devices offer move buttons. Home stays first and+cannot be hidden. Verify that hovering within a destination row keeps the drag+preview stable, dropping saves the order, and reopening retains it. In short+desktop windows, the app list scrolls while More and the footer remain reachable.+Touch devices retain the flag-gated Reviews tab in Tasks.+- Top: buttons `Create` and `Search`. Clicking `Search` opens a menuwith `Command Menu` (⌘K on Mac / Ctrl+K elsewhere) and `Search everything`(`/`). Choose the first to open commands, or the second to open and focus