Skip to content

armgit / macro

Public Imported from GitHub
0

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

feat(calls): add desktop sidebar navigation and filtering (#7668)

Jacob Beckerman2addbdb329b6
diff --git a/apps/web/src/components/app/split-layout/componentRegistry.tsx b/apps/web/src/components/app/split-layout/componentRegistry.tsx
index 8bc0f0d80c..176bb0a001 100644
--- a/apps/web/src/components/app/split-layout/componentRegistry.tsx
+++ b/apps/web/src/components/app/split-layout/componentRegistry.tsx
@@ -352,7 +352,11 @@ registerComponent(
() => <ChannelsRouteView />,
() => composableLayout()
);
-registerComponent('calls', () => <CallsRouteView />);
+registerComponent(
+ 'calls',
+ () => <CallsRouteView />,
+ () => composableLayout()
+);
registerComponent('companies', () => <CompaniesRouteView />, {
ownsCollectionState: true,
splitPanelLayout: 'composable',
diff --git a/apps/web/src/features/calls-view/components/calls-header.tsx b/apps/web/src/features/calls-view/components/calls-header.tsx
new file mode 100644
index 0000000000..61bcdbfc6d
--- /dev/null
+++ b/apps/web/src/features/calls-view/components/calls-header.tsx
@@ -0,0 +1,45 @@
+import { ViewShell } from '@app/components/view-shell';
+import { SoupActiveFiltersBar } from '@app/features/next-soup/soup-view/filters-bar/soup-active-filters-bar';
+import { SoupViewContextGroup } from '@app/features/next-soup/soup-view/filters-bar/soup-view-context-group';
+import { SoupViewContextSort } from '@app/features/next-soup/soup-view/filters-bar/soup-view-context-sort';
+import { UnifiedFilterDropdown } from '@app/features/next-soup/soup-view/filters-bar/unified-filter-dropdown';
+import { useFilterRefinements } from '@app/features/next-soup/soup-view/filters-bar/use-filter-refinements';
+import { NewCallButton } from '@app/features/next-soup/soup-view/NewCallButton';
+import { useSoupView } from '@app/features/next-soup/soup-view/soup-view-context';
+import { VIEW_TAB_LISTS } from '@app/features/next-soup/soup-view/tab-lists';
+import { callViewLabel } from '../core/call-filters';
+
+/** Title, list controls, and active filter chips above the Calls list. */
+export function CallsHeader() {
+ const view = useSoupView();
+ const { consolidatedFiltersList, resetToTabDefaults } =
+ useFilterRefinements();
+ const title = () => {
+ const tab = VIEW_TAB_LISTS.calls.find(
+ (item) => item.value === view.activeTab()
+ );
+ return !tab || tab.value === 'all'
+ ? 'Calls'
+ : `${callViewLabel(tab)} calls`;
+ };
+
+ return (
+ <>
+ <ViewShell.TopBar>
+ <h1 class="min-w-0 flex-1 truncate px-1 text-sm font-semibold tracking-[-0.03em] text-ink">
+ {title()}
+ </h1>
+ <div class="flex shrink-0 items-center gap-2 [&_button]:h-8 [&_button]:min-w-8 [&_button>svg]:size-4!">
+ <SoupViewContextSort />
+ <SoupViewContextGroup hideLabel variant="ghost" />
+ <UnifiedFilterDropdown hideLabel variant="ghost" />
+ <NewCallButton />
+ </div>
+ </ViewShell.TopBar>
+ <SoupActiveFiltersBar
+ filters={consolidatedFiltersList()}
+ onClearAll={resetToTabDefaults}
+ />
+ </>
+ );
+}
diff --git a/apps/web/src/features/calls-view/components/calls-sidebar.tsx b/apps/web/src/features/calls-view/components/calls-sidebar.tsx
new file mode 100644
index 0000000000..895379c0b9
--- /dev/null
+++ b/apps/web/src/features/calls-view/components/calls-sidebar.tsx
@@ -0,0 +1,222 @@
+import { CollapsibleSection, ViewSidebar } from '@app/components/view-shell';
+import { VIEW_TAB_PRESETS } from '@app/features/next-soup/sidebar/soup-filter-presets';
+import { useSoup } from '@app/features/next-soup/soup-context';
+import { SoupSearchbar } from '@app/features/next-soup/soup-view/filters-bar/soup-view-search-bar';
+import { useSoupView } from '@app/features/next-soup/soup-view/soup-view-context';
+import { useApplyPreset } from '@app/features/next-soup/soup-view/soup-view-tabs';
+import { VIEW_TAB_LISTS } from '@app/features/next-soup/soup-view/tab-lists';
+import { usePreference } from '@app/preferences/use-preference';
+import BuildingsIcon from '@phosphor/buildings.svg';
+import GlobeIcon from '@phosphor/globe.svg';
+import HashIcon from '@phosphor/hash.svg';
+import PhoneIcon from '@phosphor/phone.svg';
+import PhoneSlashIcon from '@phosphor/phone-slash.svg';
+import PhoneXIcon from '@phosphor/phone-x.svg';
+import {
+ SidebarTagsSection,
+ selectSidebarTag,
+} from '@property/tags/SidebarTagsSection';
+import { Layer } from '@ui';
+import {
+ type Component,
+ createEffect,
+ createMemo,
+ For,
+ type JSX,
+ Show,
+} from 'solid-js';
+import { Dynamic } from 'solid-js/web';
+import {
+ CALL_AUDIENCES,
+ type CallAudienceId,
+ type CallChannelOption,
+ callViewLabel,
+ collectCallChannels,
+ selectCallAudience,
+} from '../core/call-filters';
+
+type IconComponent = Component<{ class?: string }>;
+
+const TAB_ICONS: Record<string, IconComponent> = {
+ all: PhoneIcon,
+ missed: PhoneXIcon,
+ unattended: PhoneSlashIcon,
+};
+
+const AUDIENCE_ICONS: Record<CallAudienceId, IconComponent> = {
+ 'call-internal': BuildingsIcon,
+ 'call-external': GlobeIcon,
+};
+
+const MIN_FILTERED_CALLS = 30;
+
+type SectionId = 'type' | 'channels' | 'tags';
+
+function Row(props: {
+ active: boolean;
+ icon: IconComponent;
+ label: string;
+ onClick: () => void;
+}) {
+ return (
+ <ViewSidebar.Item
+ active={props.active}
+ title={props.label}
+ onClick={props.onClick}
+ >
+ <ViewSidebar.Icon>
+ <Dynamic component={props.icon} class="size-4" />
+ </ViewSidebar.Icon>
+ <span class="truncate">{props.label}</span>
+ </ViewSidebar.Item>
+ );
+}
+
+function Section(props: {
+ title: string;
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ children: JSX.Element;
+}) {
+ return (
+ <CollapsibleSection.Root
+ open={props.open}
+ onOpenChange={props.onOpenChange}
+ >
+ <CollapsibleSection.Trigger>
+ <span class="min-w-0 truncate">{props.title}</span>
+ <CollapsibleSection.Indicator />
+ </CollapsibleSection.Trigger>
+ <CollapsibleSection.Content>
+ <ViewSidebar.Nav aria-label={props.title}>
+ {props.children}
+ </ViewSidebar.Nav>
+ </CollapsibleSection.Content>
+ </CollapsibleSection.Root>
+ );
+}
+
+/** Views, audience, channel, and tag navigation for the Calls list. */
+export function CallsSidebar() {
+ const soup = useSoup();
+ const view = useSoupView();
+ const { applyTabPreset } = useApplyPreset();
+ const [collapsed, setCollapsed] = usePreference<SectionId[]>(
+ 'macro:pref:calls:sidebar-collapsed',
+ { default: [] }
+ );
+ const isOpen = (id: SectionId) => !collapsed().includes(id);
+ const setOpen = (id: SectionId, open: boolean) =>
+ setCollapsed((ids) =>
+ open ? ids.filter((value) => value !== id) : [...ids, id]
+ );
+
+ const activeTab = () => view.activeTab() ?? VIEW_TAB_PRESETS.calls.default;
+
+ const selectAudience = (id: CallAudienceId) =>
+ soup.predicates.set(({ andIds, orIds }) => ({
+ and: selectCallAudience(andIds, id),
+ or: orIds,
+ }));
+
+ // Audience filters only narrow loaded pages, and a sparse page leaves no
+ // list to scroll, so keep paging until enough matches show or pages run out.
+ createEffect(() => {
+ const audienceActive = CALL_AUDIENCES.some((a) =>
+ soup.predicates.isActive(a.id)
+ );
+ if (
+ audienceActive &&
+ view.items().length < MIN_FILTERED_CALLS &&
+ view.source.hasNextPage() &&
+ !view.source.isFetching()
+ ) {
+ void view.source.fetchNextPage();
+ }
+ });
+
+ const channels = createMemo<CallChannelOption[]>(
+ (known) => collectCallChannels(known, view.source.data()),
+ []
+ );
+ const activeChannelIds = () =>
+ view.queryFilters.state.include.callChannelId ?? [];
+ const selectChannel = (id: string) =>
+ view.queryFilters.set({
+ include: { callChannelId: selectSidebarTag(activeChannelIds(), id) },
+ });
+
+ return (
+ <ViewSidebar.Root aria-label="Calls navigation">
+ <ViewSidebar.Header>
+ <div class="flex min-w-0 items-center gap-1">
+ <ViewSidebar.CloseButton class="shrink-0" />
+ <ViewSidebar.Title>Calls</ViewSidebar.Title>
+ </div>
+ </ViewSidebar.Header>
+ <ViewSidebar.Primary>
+ <Layer depth={2}>
+ <SoupSearchbar variant="secondary" placeholder="Search calls" />
+ </Layer>
+ </ViewSidebar.Primary>
+
+ <ViewSidebar.Content>
+ <ViewSidebar.Nav aria-label="Call views">
+ <For each={VIEW_TAB_LISTS.calls}>
+ {(tab) => (
+ <Row
+ active={activeTab() === tab.value}
+ icon={TAB_ICONS[tab.value] ?? PhoneIcon}
+ label={callViewLabel(tab)}
+ onClick={() => applyTabPreset('calls', tab.value)}
+ />
+ )}
+ </For>
+ </ViewSidebar.Nav>
+
+ <Section
+ title="Type"
+ open={isOpen('type')}
+ onOpenChange={(open) => setOpen('type', open)}
+ >
+ <For each={CALL_AUDIENCES}>
+ {(audience) => (
+ <Row
+ active={soup.predicates.isActive(audience.id)}
+ icon={AUDIENCE_ICONS[audience.id]}
+ label={audience.label}
+ onClick={() => selectAudience(audience.id)}
+ />
+ )}
+ </For>
+ </Section>
+
+ <Show when={channels().length > 0}>
+ <Section
+ title="Channels"
+ open={isOpen('channels')}
+ onOpenChange={(open) => setOpen('channels', open)}
+ >
+ <For each={channels()}>
+ {(channel) => (
+ <Row
+ active={activeChannelIds().includes(channel.id)}
+ icon={HashIcon}
+ label={channel.name}
+ onClick={() => selectChannel(channel.id)}
+ />
+ )}
+ </For>
+ </Section>
+ </Show>
+
+ <SidebarTagsSection
+ activeIds={view.tagFilter.activeIds()}
+ onActiveIdsChange={view.tagFilter.onChange}
+ open={isOpen('tags')}
+ onOpenChange={(open) => setOpen('tags', open)}
+ />
+ </ViewSidebar.Content>
+ </ViewSidebar.Root>
+ );
+}
diff --git a/apps/web/src/features/calls-view/core/call-filters.test.ts b/apps/web/src/features/calls-view/core/call-filters.test.ts
new file mode 100644
index 0000000000..20521ec9f8
--- /dev/null
+++ b/apps/web/src/features/calls-view/core/call-filters.test.ts
@@ -0,0 +1,74 @@
+import type { CallEntity, EntityData } from '@entity';
+import { describe, expect, it } from 'vitest';
+import {
+ externalCallFilter,
+ internalCallFilter,
+} from '../../next-soup/filters/call-audience';
+import { collectCallChannels, selectCallAudience } from './call-filters';
+
+const call = (overrides: Partial<CallEntity> = {}): CallEntity => ({
+ type: 'call',
+ id: overrides.id ?? 'call-1',
+ name: 'Call',
+ ownerId: 'user-1',
+ isActive: false,
+ status: 'ATTENDED',
+ attended: true,
+ participantIds: ['user-1'],
+ ...overrides,
+});
+
+describe('call audience predicates', () => {
+ it('treats calls with guests as external', () => {
+ const entity = call({ guests: [{ id: 'g', displayName: 'Guest' }] });
+ expect(externalCallFilter(entity)).toBe(true);
+ expect(internalCallFilter(entity)).toBe(false);
+ });
+
+ it('treats calls without guests as internal', () => {
+ expect(externalCallFilter(call())).toBe(false);
+ expect(internalCallFilter(call({ guests: [] }))).toBe(true);
+ });
+
+ it('rejects entities that are not calls', () => {
+ const doc = { type: 'document', id: 'd' } as EntityData;
+ expect(externalCallFilter(doc)).toBe(false);
+ expect(internalCallFilter(doc)).toBe(false);
+ });
+});
+
+describe('selectCallAudience', () => {
+ it('replaces the other audience and keeps unrelated predicates', () => {
+ expect(
+ selectCallAudience(['calls', 'call-internal'], 'call-external')
+ ).toEqual(['calls', 'call-external']);
+ });
+
+ it('clears the audience when the active one is chosen again', () => {
+ expect(
+ selectCallAudience(['calls', 'call-external'], 'call-external')
+ ).toEqual(['calls']);
+ });
+});
+
+describe('collectCallChannels', () => {
+ it('adds channels from calls sorted by name and keeps known ones', () => {
+ const known = [{ id: 'c-z', name: 'Zeta' }];
+ const result = collectCallChannels(known, [
+ call({ id: '1', channelId: 'c-a', channelName: 'Alpha' }),
+ call({ id: '2', channelId: null }),
+ call({ id: '3', channelId: 'c-a', channelName: 'Alpha' }),
+ ]);
+ expect(result).toEqual([
+ { id: 'c-a', name: 'Alpha' },
+ { id: 'c-z', name: 'Zeta' },
+ ]);
+ });
+
+ it('returns the same array when nothing new is seen', () => {
+ const known = [{ id: 'c-a', name: 'Alpha' }];
+ expect(collectCallChannels(known, [call({ channelId: 'c-a' })])).toBe(
+ known
+ );
+ });
+});
diff --git a/apps/web/src/features/calls-view/core/call-filters.ts b/apps/web/src/features/calls-view/core/call-filters.ts
new file mode 100644
index 0000000000..7057534379
--- /dev/null
+++ b/apps/web/src/features/calls-view/core/call-filters.ts
@@ -0,0 +1,56 @@
+import type { TabItem } from '@core/component/Tabs';
+import type { EntityData } from '@entity';
+
+/** A Calls tab's text label; tab items may carry rich labels elsewhere. */
+export function callViewLabel(tab: TabItem): string {
+ return typeof tab.label === 'string' ? tab.label : tab.value;
+}
+
+/** Client predicate ids that narrow the Calls list by who attended. */
+export const CALL_AUDIENCES = [
+ { id: 'call-internal', label: 'Internal' },
+ { id: 'call-external', label: 'External' },
+] as const;
+
+export type CallAudienceId = (typeof CALL_AUDIENCES)[number]['id'];
+
+const AUDIENCE_IDS = new Set<string>(CALL_AUDIENCES.map((a) => a.id));
+
+/**
+ * The next AND predicate ids after choosing an audience. Audiences are
+ * exclusive, and choosing the active one clears it.
+ */
+export function selectCallAudience(
+ andIds: readonly string[],
+ id: CallAudienceId
+): string[] {
+ const rest = andIds.filter((active) => !AUDIENCE_IDS.has(active));
+ return andIds.includes(id) ? rest : [...rest, id];
+}
+
+export type CallChannelOption = { id: string; name: string };
+
+/**
+ * Adds the channels of loaded calls to the ones already known, sorted by name.
+ * Known channels stay listed after a channel filter hides their calls.
+ */
+export function collectCallChannels(
+ known: readonly CallChannelOption[],
+ entities: readonly EntityData[]
+): CallChannelOption[] {
+ const byId = new Map(known.map((channel) => [channel.id, channel]));
+ let changed = false;
+ for (const entity of entities) {
+ if (entity.type !== 'call' || !entity.channelId) continue;
+ const name = entity.channelName?.trim();
+ const current = byId.get(entity.channelId);
+ if (current && (!name || current.name === name)) continue;
+ byId.set(entity.channelId, {
+ id: entity.channelId,
+ name: name || 'Untitled channel',
+ });
+ changed = true;
+ }
+ if (!changed) return known as CallChannelOption[];
+ return [...byId.values()].sort((a, b) => a.name.localeCompare(b.name));
+}
diff --git a/apps/web/src/features/calls-view/views/calls-view.tsx b/apps/web/src/features/calls-view/views/calls-view.tsx
new file mode 100644
index 0000000000..a855ec48fe
--- /dev/null
+++ b/apps/web/src/features/calls-view/views/calls-view.tsx
@@ -0,0 +1,58 @@
+import { ViewShell } from '@app/components/view-shell';
+import { getViewPreset } from '@app/features/next-soup/sidebar/soup-filter-presets';
+import { SoupRowMetadataProvider } from '@app/features/next-soup/soup-view/soup-row-metadata-provider';
+import { SoupView } from '@app/features/next-soup/soup-view/soup-view';
+import { callsTour } from '@app/features/next-soup/tour';
+import { ViewTour } from '@app/features/tours/ViewTour';
+import { SplitPanel } from '@components/app/split-panel';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import { type JSX, Show, Suspense } from 'solid-js';
+import { CallsHeader } from '../components/calls-header';
+import { CallsSidebar } from '../components/calls-sidebar';
+
+/**
+ * Calls list. Desktop navigates and filters from a sidebar; touch keeps the
+ * shared soup header with pill tabs.
+ */
+export function CallsView() {
+ const preset = getViewPreset('calls');
+ const list = (header?: JSX.Element) => (
+ <SoupView
+ viewName="Calls"
+ initialFilters={preset?.filters}
+ initialClientFilters={preset?.clientFilters}
+ initialGroupBy={preset?.groupBy}
+ tour={<ViewTour tour={callsTour} />}
+ header={header}
+ />
+ );
+
+ return (
+ <Show when={!isTouchDevice()} fallback={list()}>
+ <SplitPanel.Root>
+ <SplitPanel.Body>
+ <ViewShell.Root
+ asidePreferenceKey="calls"
+ resizable
+ aside={{ preserveDuringResize: false }}
+ >
+ <ViewShell.Aside>
+ <Suspense>
+ <SoupRowMetadataProvider>
+ <CallsSidebar />
+ </SoupRowMetadataProvider>
+ </Suspense>
+ </ViewShell.Aside>
+ <ViewShell.Main>
+ {list(
+ <Suspense>
+ <CallsHeader />
+ </Suspense>
+ )}
+ </ViewShell.Main>
+ </ViewShell.Root>
+ </SplitPanel.Body>
+ </SplitPanel.Root>
+ </Show>
+ );
+}
diff --git a/apps/web/src/features/next-soup/filters/call-audience.ts b/apps/web/src/features/next-soup/filters/call-audience.ts
new file mode 100644
index 0000000000..4cf0e3fbd9
--- /dev/null
+++ b/apps/web/src/features/next-soup/filters/call-audience.ts
@@ -0,0 +1,13 @@
+import type { EntityData } from '@entity';
+
+// Kept free of runtime imports so tests can load it without the app graph.
+
+/** A call with at least one guest, i.e. someone joined without a Macro account. */
+export function externalCallFilter(entity: EntityData): boolean {
+ return entity.type === 'call' && (entity.guests?.length ?? 0) > 0;
+}
+
+/** A call attended only by Macro users. */
+export function internalCallFilter(entity: EntityData): boolean {
+ return entity.type === 'call' && (entity.guests?.length ?? 0) === 0;
+}
diff --git a/apps/web/src/features/next-soup/filters/configs/entity.ts b/apps/web/src/features/next-soup/filters/configs/entity.ts
index 45fe37fd7d..61692ac68d 100644
--- a/apps/web/src/features/next-soup/filters/configs/entity.ts
+++ b/apps/web/src/features/next-soup/filters/configs/entity.ts
@@ -6,6 +6,10 @@ export {
} from '../../../crm/collection-filters';
import { getEntityProjectId } from '@entity';
+import {
+ externalCallFilter as externalCallPredicate,
+ internalCallFilter as internalCallPredicate,
+} from '../call-audience';
import { defineQueryFilters } from '../filter-store/compile';
import {
activeAgentFilter as activeAgentPredicate,
@@ -72,6 +76,19 @@ export const callsFilter = config({
query: defineQueryFilters({}, { skipTargets: ['callf'] }),
});
+// Guests are not modeled server-side, so audience narrows loaded calls only.
+export const callExternalFilter = config({
+ id: 'call-external',
+ predicate: externalCallPredicate,
+ query: {},
+});
+
+export const callInternalFilter = config({
+ id: 'call-internal',
+ predicate: internalCallPredicate,
+ query: {},
+});
+
// Calendar events are searchable by title. Scoping to them alone means
// NIL-excluding every other entity type's id target while leaving `calf`
// untouched, which is exactly what skipping `calf` produces.
diff --git a/apps/web/src/features/next-soup/filters/configs/index.ts b/apps/web/src/features/next-soup/filters/configs/index.ts
index 3bd897f903..ea741f46f4 100644
--- a/apps/web/src/features/next-soup/filters/configs/index.ts
+++ b/apps/web/src/features/next-soup/filters/configs/index.ts
@@ -33,6 +33,8 @@ import {
import {
activeAgentFilter,
calendarFilter,
+ callExternalFilter,
+ callInternalFilter,
callsFilter,
channelsFilter,
crmCompanyActiveFilter,
@@ -96,6 +98,8 @@ export const SOUP_FILTERS = [
activeTaskFilter,
calendarFilter,
callsFilter,
+ callExternalFilter,
+ callInternalFilter,
crmCompanyFilter,
crmCompanyActiveFilter,
crmCompanyHiddenFilter,
diff --git a/apps/web/src/features/next-soup/route-views.tsx b/apps/web/src/features/next-soup/route-views.tsx
index 9bfcf76faf..89a080cac7 100644
--- a/apps/web/src/features/next-soup/route-views.tsx
+++ b/apps/web/src/features/next-soup/route-views.tsx
@@ -11,9 +11,14 @@ import { lazy, Show } from 'solid-js';
import type { SetPredicatesInput } from './filters/filter-store/predicates-store';
import type { Query } from './filters/filter-store/types';
import { getViewPreset } from './sidebar/soup-filter-presets';
-import { callsTour, foldersTour } from './tour';
+import { foldersTour } from './tour';
import { useRecentViewFlag } from './use-recent-view-flag';
+const CallsView = lazy(async () => ({
+ default: (await import('@app/features/calls-view/views/calls-view'))
+ .CallsView,
+}));
+
const SoupView = lazy(async () => ({
default: (await import('./soup-view/soup-view')).SoupView,
}));
@@ -51,16 +56,7 @@ export const RecentRouteView = withAuth(() => {
export const CallsRouteView = withAuth(() => {
usePageViewTracking('calls');
- const preset = getViewPreset('calls');
- return (
- <SoupView
- viewName="Calls"
- initialFilters={preset?.filters}
- initialClientFilters={preset?.clientFilters}
- initialGroupBy={preset?.groupBy}
- tour={<ViewTour tour={callsTour} />}
- />
- );
+ return <CallsView />;
});
export const FoldersRouteView = withAuth(() => {
diff --git a/apps/web/src/features/next-soup/soup-view/filters-bar/soup-view-context-sort.tsx b/apps/web/src/features/next-soup/soup-view/filters-bar/soup-view-context-sort.tsx
index 54fbf4f81f..3860b5f51b 100644
--- a/apps/web/src/features/next-soup/soup-view/filters-bar/soup-view-context-sort.tsx
+++ b/apps/web/src/features/next-soup/soup-view/filters-bar/soup-view-context-sort.tsx
@@ -73,6 +73,9 @@ export const SoupViewContextSort = () => {
<Match when={isComponentListView('channels')}>
<ChannelsSort {...openProps()} />
</Match>
+ <Match when={isComponentListView('calls')}>
+ <InboxSort {...openProps()} />
+ </Match>
<Match when={isComponentListView('folders')}>
<FilesSort {...openProps()} />
</Match>
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx b/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
index bc79a3c79e..3a5aefb0db 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
@@ -49,7 +49,13 @@ export const useVisibleViewTabs = () => {
return (view: TabbedListView): TabItem[] => VIEW_TAB_LISTS[view];
};
-const PRESERVE_FILTERS_ON_TAB_CHANGE: ListView[] = ['documents', 'tasks'];
+const PRESERVE_FILTERS_ON_TAB_CHANGE: ListView[] = [
+ 'documents',
+ 'tasks',
+ 'calls',
+];
+
+const VIEW_SCOPED_REFINEMENTS: ListView[] = ['calls'];
export const shouldPreserveFiltersOnTabChange = (view: ListView) =>
PRESERVE_FILTERS_ON_TAB_CHANGE.includes(view);
@@ -156,6 +162,15 @@ export const useApplyPreset = () => {
: undefined;
}
+ // A channel chosen in the Calls sidebar is a direct server refinement,
+ // and no tab scopes by channel, so it carries over unchanged.
+ const channelIds = queryFilters.state.include.callChannelId;
+ if (channelIds?.length) {
+ mergedFilters = mergeQuery(mergedFilters, {
+ include: { callChannelId: [...channelIds] },
+ });
+ }
+
nextFilters = mergedFilters;
nextClientFilters = {
@@ -164,12 +179,15 @@ export const useApplyPreset = () => {
};
}
+ // Calls sidebar refinements belong to the view, not to one tab, so a
+ // tab's persisted state must not replace them.
+ const restoreTab = !VIEW_SCOPED_REFINEMENTS.includes(view);
batch(() => {
setActiveTab(tabId);
- if (!restorePersistedQueryFilters(tabId)) {
+ if (!(restoreTab && restorePersistedQueryFilters(tabId))) {
queryFilters.replace(nextFilters);
}
- if (!restorePersistedPredicates(tabId)) {
+ if (!(restoreTab && restorePersistedPredicates(tabId))) {
soup.predicates.set(nextClientFilters);
}
soup.grouping.setActiveGroupId(preset.groupBy);
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view.tsx b/apps/web/src/features/next-soup/soup-view/soup-view.tsx
index c9010109b1..6c57dee8ac 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view.tsx
@@ -232,6 +232,11 @@ interface SoupViewProps {
additionalEntities?: Accessor<EntityData[]>;
/** The view's tour, e.g. `<ViewTour tour={callsTour} />`. */
tour?: JSX.Element;
+ /**
+ * Replaces the split-header title, tabs, search, and filter toolbar for
+ * views that compose their own chrome (e.g. a sidebar layout).
+ */
+ header?: JSX.Element;
}
export const SoupView = (props: SoupViewProps) => {
@@ -377,7 +382,7 @@ export const SoupView = (props: SoupViewProps) => {
class="size-full flex flex-col @container"
data-list-view={activeListView()}
>
- <Show when={true}>
+ <Show when={props.header === undefined} fallback={props.header}>
<div class="flex flex-col w-full">
<SplitHeaderLeft>
<div
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index a46b93ff24..f94834cbcf 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -1749,7 +1749,14 @@ separate diff and discussion requests are outside this subscription behavior.
## Calls — `/app/component/calls`
-Tabs `All` / `Missed` / `Unattended`; `New call` offers `Call a channel or contact`
+On desktop a collapsible sidebar holds the search field (`Search calls`, `⌘F`),
+the views `All` / `Missed` / `Unattended`, a `Type` section (`Internal` /
+`External`; External means at least one guest without a Macro account joined),
+a `Channels` section listing channels seen in loaded calls, and `Tags`. Choosing
+a type, channel, or tag shows only that one; choosing it again clears it. These
+refinements carry across the three views. Sort, group, filter, and `New call`
+sit in the list's top bar. Phones keep pill tabs and the header search.
+`New call` offers `Call a channel or contact`
and, with `enable-quick-calls` enabled, `Manage call links`. Create Quick Calls
with `New Call` beside Calendar's
`New event`, or with `Create` → `Call` (`C C`). Scheduled calls are created through