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(new-layout): new inbox view behind FF (#6083)

dev-rb311ad8f060a7
diff --git a/apps/web/src/components/app/PreviewPanel.tsx b/apps/web/src/components/app/PreviewPanel.tsx
index 81b75401e2..df73b93f9b 100644
--- a/apps/web/src/components/app/PreviewPanel.tsx
+++ b/apps/web/src/components/app/PreviewPanel.tsx
@@ -14,6 +14,7 @@ import type {
} from '@core/block';
import { fileTypeToResolvedBlockName } from '@core/constant/allBlocks';
import { USE_MACRO_PR_SUMMARY_BLOCK } from '@core/constant/featureFlags';
+import { useHotkeyDOMScope } from '@core/hotkey/hotkeys';
import type { BlockOrchestrator } from '@core/orchestrator';
import {
type EntityData,
@@ -66,6 +67,8 @@ function PreviewPanelContent(
) {
const scopedLayoutRefs: SplitPanelContextType['layoutRefs'] = {};
const [interactedWith, setInteractedWith] = createSignal(false);
+ const [attachHotkeys, previewHotkeyScope] =
+ useHotkeyDOMScope('preview-panel');
const blockInstance = createMemo(() => {
const entity = props.selectedEntity;
@@ -172,7 +175,10 @@ function PreviewPanelContent(
return (
<div
- ref={props.ref}
+ ref={(element) => {
+ attachHotkeys(element);
+ props.ref?.(element);
+ }}
class="flex size-full min-h-0 flex-col"
onFocusIn={(event) => {
if (interactedWith()) return;
@@ -186,6 +192,8 @@ function PreviewPanelContent(
!event.currentTarget.contains(relatedTarget)
) {
relatedTarget.focus();
+ } else if (props.onFocusOut) {
+ props.onFocusOut();
} else {
(event.target as HTMLElement).blur?.();
}
@@ -225,6 +233,8 @@ function PreviewPanelContent(
<SplitPanelContext.Provider
value={{
...props.splitPanelContext,
+ splitHotkeyScope: previewHotkeyScope,
+ isInlinePreview: true,
layoutRefs: scopedLayoutRefs,
}}
>
diff --git a/apps/web/src/components/app/split-layout/componentRegistry.tsx b/apps/web/src/components/app/split-layout/componentRegistry.tsx
index ef2f6c31e9..768889dc7f 100644
--- a/apps/web/src/components/app/split-layout/componentRegistry.tsx
+++ b/apps/web/src/components/app/split-layout/componentRegistry.tsx
@@ -3,6 +3,7 @@ import type { EventEditorInitialValues } from '@app/features/calendar/components
import type { CalendarEvent } from '@app/features/calendar/types';
import { GettingStarted } from '@app/features/getting-started';
import { Home } from '@app/features/home';
+import { InboxView } from '@app/features/inbox-view/inbox-view';
import { queryStateFrom } from '@app/features/next-soup/filters/filter-store';
import type { SetPredicatesInput } from '@app/features/next-soup/filters/filter-store/predicates-store';
import { mergeQuery } from '@app/features/next-soup/filters/filter-store/query-store';
@@ -14,7 +15,7 @@ import { useRecentViewFlag } from '@app/features/next-soup/use-recent-view-flag'
import { ReminderEditorSplit } from '@app/features/reminders/ReminderEditorSplit';
import { SettingsPanelComponentWrapper } from '@app/features/settings/Settings';
import { useAnalytics } from '@app/lib/analytics/analytics-context';
-import { usePosthog } from '@app/lib/analytics/posthog';
+import { useFeatureFlag, usePosthog } from '@app/lib/analytics/posthog';
import { globalSplitManager } from '@app/signal/splitLayout';
import { EventComposerSplit } from '@block-calendar/components/EventComposerSplit';
import { ChannelCompose } from '@block-channel/component/Compose';
@@ -31,6 +32,8 @@ import { LoadingBlock } from '@core/component/LoadingBlock';
import {
DEV_MODE_ENV,
ENABLE_CRM,
+ ENABLE_NEW_APP_VIEWS_FLAG,
+ ENABLE_NEW_APP_VIEWS_OVERRIDE,
ENABLE_REMINDERS,
LOCAL_ONLY,
} from '@core/constant/featureFlags';
@@ -39,7 +42,14 @@ import type { ViewId } from '@core/types/view';
import EmptyStatePreviewIcon from '@design/empty-state-doc.svg';
import { useAutomationEntities } from '@queries/agent-schedule/entities';
import { EmptyStatePanel } from '@ui';
-import { type Component, type JSXElement, lazy, onMount, Show } from 'solid-js';
+import {
+ type Component,
+ createRenderEffect,
+ type JSXElement,
+ lazy,
+ onMount,
+ Show,
+} from 'solid-js';
import type { SplitContent } from './layoutManager';
import { useSplitPanelOrThrow } from './layoutUtils';
import { previewEmptyStateForContent } from './previewController';
@@ -52,6 +62,26 @@ function usePageViewTracking(pageTitle: string) {
});
}
+function useNewAppViews() {
+ const panel = useSplitPanelOrThrow();
+ const posthog = usePosthog();
+ const flag = useFeatureFlag(ENABLE_NEW_APP_VIEWS_FLAG, {
+ enabledOverride: ENABLE_NEW_APP_VIEWS_OVERRIDE,
+ });
+ const ready = () =>
+ ENABLE_NEW_APP_VIEWS_OVERRIDE !== undefined || posthog.flagsLoaded();
+ const enabled = () => ready() && flag().enabled;
+
+ createRenderEffect(() => {
+ if (!ready()) return;
+ panel.handle.updateMeta?.({
+ splitPanelLayout: enabled() ? 'composable' : 'legacy',
+ });
+ });
+
+ return { ready, enabled };
+}
+
/**
* Guard that delays rendering until user is authenticated.
* Use for components that require user context (userId, email).
@@ -190,22 +220,32 @@ registerComponent(
})
);
-registerComponent(
- 'inbox',
- withAuth(() => {
- usePageViewTracking('inbox');
- const preset = getViewPreset('inbox');
- return (
- <SoupView
- viewName="Inbox"
- initialFilters={preset?.filters}
- initialClientFilters={preset?.clientFilters}
- initialGroupBy={preset?.groupBy}
- disableLocalSearch
- />
- );
- })
-);
+function LegacyInboxView() {
+ const preset = getViewPreset('inbox');
+ return (
+ <SoupView
+ viewName="Inbox"
+ initialFilters={preset?.filters}
+ initialClientFilters={preset?.clientFilters}
+ initialGroupBy={preset?.groupBy}
+ disableLocalSearch
+ />
+ );
+}
+
+function RegisteredInboxView() {
+ usePageViewTracking('inbox');
+ const newAppViews = useNewAppViews();
+ return (
+ <Show when={newAppViews.ready()} fallback={<LoadingBlock />}>
+ <Show when={newAppViews.enabled()} fallback={<LegacyInboxView />}>
+ <InboxView />
+ </Show>
+ </Show>
+ );
+}
+
+registerComponent('inbox', withAuth(RegisteredInboxView));
registerComponent('recent', withAuth(RecentViewWrapper));
diff --git a/apps/web/src/components/app/split-layout/components/PopoverSplitRenderer.tsx b/apps/web/src/components/app/split-layout/components/PopoverSplitRenderer.tsx
index 642713457e..ac35022ee2 100644
--- a/apps/web/src/components/app/split-layout/components/PopoverSplitRenderer.tsx
+++ b/apps/web/src/components/app/split-layout/components/PopoverSplitRenderer.tsx
@@ -16,6 +16,7 @@ import type {
SplitId,
SplitMount,
} from '../layoutManager';
+import { createOwnedSlots } from '../utils/createOwnedSlots';
false && clickOutside;
@@ -58,6 +59,7 @@ function PopoverSplitModal(props: {
createSignal<() => void>();
const [titleFileMenuActions, setTitleFileMenuActions] =
createSignal<SplitFileMenuActionGroups>();
+ const ownedSlots = createOwnedSlots();
const stubHandle: SplitHandle = {
id: props.popover.id as SplitId,
@@ -134,14 +136,7 @@ function PopoverSplitModal(props: {
setTitleFileMenuTrigger,
titleFileMenuActions,
setTitleFileMenuActions,
- list: () => undefined,
- setList: (factory) => {
- if (import.meta.env.DEV) {
- console.warn('Popover splits do not register lists');
- }
-
- return factory();
- },
+ replaceOwnedSlot: ownedSlots.replace,
headerCollapser: { register: () => () => {} },
toolbarCollapser: { register: () => () => {} },
};
diff --git a/apps/web/src/components/app/split-layout/components/SplitPanel.tsx b/apps/web/src/components/app/split-layout/components/SplitPanel.tsx
index e99cc6b77a..a610625624 100644
--- a/apps/web/src/components/app/split-layout/components/SplitPanel.tsx
+++ b/apps/web/src/components/app/split-layout/components/SplitPanel.tsx
@@ -2,7 +2,6 @@ import { isListViewID, LIST_VIEW_ID } from '@app/constants/list-views';
import { createSoupState } from '@app/features/next-soup/create-soup-state';
import { SoupContextProvider } from '@app/features/next-soup/soup-context';
import { SoupViewContextProvider } from '@app/features/next-soup/soup-view/soup-view-context';
-import { openEntityInSplitFromUnifiedList } from '@app/features/next-soup/utils';
import { globalSplitManager } from '@app/signal/splitLayout';
import { MobileTopEdgeFade } from '@components/app/mobile/MobileEdgeFade';
import { SplitPanelControllerProvider } from '@components/app/split-panel';
@@ -37,8 +36,7 @@ import { useSplitLayout } from '../layout';
import type { SplitHandle, SplitState } from '../layoutManager';
import { shouldShowSplitCloseButton } from '../layoutUtils';
import { registerSplitHotkeys } from '../registerSplitHotkeys';
-import { useSplitList } from '../useSplitList';
-import { useSplitListNavigationHotkeys } from '../useSplitListNavigationHotkeys';
+import { createOwnedSlots } from '../utils/createOwnedSlots';
import { createPriorityCollapseController } from './PriorityCollapseOverflowSensor';
import { SplitDrawerGroup } from './SplitDrawerContext';
import { SplitHeader } from './SplitHeader';
@@ -77,6 +75,7 @@ export function SplitPanel(props: SplitPanelProps) {
const layoutRefs: SplitPanelContextType['layoutRefs'] = {};
const headerCollapseController = createPriorityCollapseController();
const toolbarCollapseController = createPriorityCollapseController();
+ const ownedSlots = createOwnedSlots();
const splitLayoutHelpers = useSplitLayout();
const isNotUnifiedList = () => {
@@ -112,20 +111,6 @@ export function SplitPanel(props: SplitPanelProps) {
splitHotkeyScope,
});
- const splitList = useSplitList();
-
- useSplitListNavigationHotkeys({
- splitHotkeyScope,
- list: splitList.list,
- handle: props.handle,
- openEntityInSplit: (entity, options) => {
- void openEntityInSplitFromUnifiedList(entity, {
- splitHandle: props.handle,
- ...options,
- });
- },
- });
-
const nextSoup = createSoupState({
initialPredicates: { and: ['explicit-noise'] },
});
@@ -306,8 +291,7 @@ export function SplitPanel(props: SplitPanelProps) {
setTitleFileMenuTrigger,
titleFileMenuActions,
setTitleFileMenuActions,
- list: splitList.list,
- setList: splitList.setList,
+ replaceOwnedSlot: ownedSlots.replace,
panelSize,
panelRef,
}}
diff --git a/apps/web/src/components/app/split-layout/context.ts b/apps/web/src/components/app/split-layout/context.ts
index 9632455b2e..8c26e8e3a1 100644
--- a/apps/web/src/components/app/split-layout/context.ts
+++ b/apps/web/src/components/app/split-layout/context.ts
@@ -1,8 +1,4 @@
-import type { ListController, ListDataSource } from '@app/components/list';
-import type { ListView } from '@app/constants/list-views';
-import type { SoupRow } from '@app/features/soup';
import type { HotkeyToken } from '@core/hotkey/tokens';
-import type { EntityData } from '@entity';
import type { NullableSize } from '@solid-primitives/resize-observer';
import {
type Accessor,
@@ -12,6 +8,7 @@ import {
type Setter,
} from 'solid-js';
import type { SplitHandle, SplitManager } from './layoutManager';
+import type { ReplaceOwnedSlot } from './utils/createOwnedSlots';
import type { PriorityCollapser } from './utils/createPriorityCollapser';
export const SplitLayoutContext = createContext<{
@@ -65,37 +62,6 @@ export type SplitFileMenuActionSection = {
actions: SplitFileMenuAction[];
};
-export type SplitListRow = SoupRow<EntityData>;
-
-export type SplitListActivationMetadata = {
- event?: MouseEvent;
- newSplit?: boolean;
-};
-
-export type SplitListController = ListController<
- SplitListRow,
- SplitListActivationMetadata
->;
-
-export type SplitListRegistration<
- TDataSource extends
- ListDataSource<SplitListRow> = ListDataSource<SplitListRow>,
-> = {
- viewId: ListView;
- dataSource: TDataSource;
- controller: SplitListController;
-};
-
-export type SetSplitList = <TDataSource extends ListDataSource<SplitListRow>>(
- factory: () => SplitListRegistration<TDataSource>
-) => SplitListRegistration<TDataSource>;
-
-export type SplitListBinding = {
- viewId: ListView | undefined;
- dataSource: ListDataSource<SplitListRow>;
- controller: SplitListController;
-};
-
export function getSplitFileMenuActionSections(
groups: SplitFileMenuActionGroups
): SplitFileMenuActionSection[] {
@@ -114,6 +80,8 @@ export function getSplitFileMenuActionSections(
export type SplitPanelContextType = {
handle: SplitHandle;
splitHotkeyScope: string;
+ /** Whether mounted block content is rendered in a passive inline preview. */
+ isInlinePreview?: boolean;
isPanelActive: Accessor<boolean>;
panelRef: Accessor<HTMLElement | null>;
panelSize: NullableSize;
@@ -133,8 +101,7 @@ export type SplitPanelContextType = {
setTitleFileMenuTrigger: Setter<(() => void) | undefined>;
titleFileMenuActions: Accessor<SplitFileMenuActionGroups | undefined>;
setTitleFileMenuActions: Setter<SplitFileMenuActionGroups | undefined>;
- list: Accessor<SplitListBinding | undefined>;
- setList: SetSplitList;
+ replaceOwnedSlot: ReplaceOwnedSlot;
headerCollapser: PriorityCollapser;
toolbarCollapser: PriorityCollapser;
};
diff --git a/apps/web/src/components/app/split-layout/layoutUtils.ts b/apps/web/src/components/app/split-layout/layoutUtils.ts
index 5bc9c397fb..af9184f6fd 100644
--- a/apps/web/src/components/app/split-layout/layoutUtils.ts
+++ b/apps/web/src/components/app/split-layout/layoutUtils.ts
@@ -96,6 +96,13 @@ export function useSplitPanelOrThrow() {
return ctxValue;
}
+/**
+ * Creates or replaces a named resource under the current split panel's owner.
+ */
+export function withSplitPanelOwner<T>(name: string, factory: () => T): T {
+ return useSplitPanelOrThrow().replaceOwnedSlot(name, factory);
+}
+
/**
* Get the context value for the the SplitPanel with possible undefined.
* @returns
@@ -119,13 +126,15 @@ export function shouldShowSplitCloseButton(
/**
* Whether content may claim focus automatically when it mounts in the current
- * split. Preview Pair Viewers stay passive until the user focuses them.
+ * split. Preview Pair Viewers and inline previews stay passive until the user
+ * focuses them.
*
* This is intentionally a snapshot: dissolving a Preview Pair later must not
* trigger delayed autofocus in content that is already mounted.
*/
export function useCanAutofocusSplitContent() {
- return !useSplitPanel()?.handle.isViewerSplit();
+ const panel = useSplitPanel();
+ return !panel?.handle.isViewerSplit() && !panel?.isInlinePreview;
}
/**
diff --git a/apps/web/src/components/app/split-layout/previewController.ts b/apps/web/src/components/app/split-layout/previewController.ts
index 1f8f8fd8d3..0681d621c4 100644
--- a/apps/web/src/components/app/split-layout/previewController.ts
+++ b/apps/web/src/components/app/split-layout/previewController.ts
@@ -41,6 +41,11 @@ const PREVIEW_CONTROLLER_CONTENT_CONFIG: readonly PreviewControllerContentConfig
description: 'Select an item from the list to get started.',
},
},
+ {
+ type: 'component',
+ id: LIST_VIEW_ID.inbox,
+ redistributionWidth: { preferredPx: 360 },
+ },
{
type: 'component',
id: LIST_VIEW_ID.channels,
diff --git a/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts b/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts
index c2c11e8331..66a3881447 100644
--- a/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts
+++ b/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts
@@ -756,7 +756,7 @@ describe('layoutManager', () => {
const { manager, controllerId } = setup();
manager.engagePreviewMode(controllerId);
- expect(manager.previewControllerWidth(controllerId)).toBe(440);
+ expect(manager.previewControllerWidth(controllerId)).toBe(360);
expect(manager.splits()).toHaveLength(2);
const viewerId = manager.splits()[1].id;
expect(manager.viewerOf(controllerId)).toBe(viewerId);
@@ -1022,7 +1022,7 @@ describe('layoutManager', () => {
expect(manager.splits()).toHaveLength(2);
expect(manager.viewerOf(controllerId)).toBe(viewerId);
expect(manager.controllerOf(viewerId)).toBe(controllerId);
- expect(manager.previewControllerWidth(controllerId)).toBe(440);
+ expect(manager.previewControllerWidth(controllerId)).toBe(360);
expect(manager.activeSplitId()).toBe(controllerId);
dispose();
diff --git a/apps/web/src/components/app/split-layout/tests/previewController.test.ts b/apps/web/src/components/app/split-layout/tests/previewController.test.ts
index ef3aaede8e..b06e9eeff0 100644
--- a/apps/web/src/components/app/split-layout/tests/previewController.test.ts
+++ b/apps/web/src/components/app/split-layout/tests/previewController.test.ts
@@ -23,7 +23,7 @@ describe('preview controller content', () => {
});
it('resolves default and content-specific widths from the same config', () => {
- const defaultWidth = previewControllerWidthForContent({
+ const inboxWidth = previewControllerWidthForContent({
type: 'component',
id: 'inbox',
});
@@ -40,10 +40,10 @@ describe('preview controller content', () => {
id: 'companies',
});
- expect(defaultWidth).toBeDefined();
- expect(channelsWidth).not.toBe(defaultWidth);
- expect(mailWidth).not.toBe(defaultWidth);
- expect(companiesWidth).not.toBe(defaultWidth);
+ expect(inboxWidth).toBe(360);
+ expect(channelsWidth).not.toBe(inboxWidth);
+ expect(mailWidth).not.toBe(inboxWidth);
+ expect(companiesWidth).not.toBe(inboxWidth);
const companiesWidthInNarrowViewport = previewControllerWidthForContent(
{ type: 'component', id: 'companies' },
@@ -64,7 +64,7 @@ describe('preview controller content', () => {
type: 'project',
id: 'project-1',
})
- ).toBe(defaultWidth);
+ ).toBe(440);
});
it('uses the configured list-view minimum only for Preview Controllers', () => {
diff --git a/apps/web/src/components/app/split-layout/useSplitList.ts b/apps/web/src/components/app/split-layout/useSplitList.ts
deleted file mode 100644
index 4466775839..0000000000
--- a/apps/web/src/components/app/split-layout/useSplitList.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-import {
- createListController,
- createStaticListDataSource,
- type ListDataSource,
-} from '@app/components/list';
-import {
- type Accessor,
- createRoot,
- createSignal,
- getOwner,
- onCleanup,
-} from 'solid-js';
-import type {
- SetSplitList,
- SplitListActivationMetadata,
- SplitListBinding,
- SplitListRegistration,
- SplitListRow,
-} from './context';
-
-export type UseSplitListResult = {
- list: Accessor<SplitListBinding>;
- setList: SetSplitList;
-};
-
-export function useSplitList(): UseSplitListResult {
- const splitOwner = getOwner();
- if (!splitOwner) {
- throw new Error('useSplitList requires a Solid owner');
- }
-
- const emptyDataSource = createStaticListDataSource<SplitListRow>(() => []);
- const emptyController = createListController<
- SplitListRow,
- SplitListActivationMetadata
- >({
- items: emptyDataSource.items,
- getKey: (row) => row.id,
- });
- const [list, setListBinding] = createSignal<SplitListBinding>({
- viewId: undefined,
- dataSource: emptyDataSource,
- controller: emptyController,
- });
-
- let disposeListRoot: (() => void) | undefined;
-
- function setList<TDataSource extends ListDataSource<SplitListRow>>(
- factory: () => SplitListRegistration<TDataSource>
- ): SplitListRegistration<TDataSource> {
- let disposeNextRoot: (() => void) | undefined;
- let nextRegistration: SplitListRegistration<TDataSource>;
-
- try {
- nextRegistration = createRoot((dispose) => {
- disposeNextRoot = dispose;
- return factory();
- }, splitOwner);
- } catch (error) {
- disposeNextRoot?.();
- throw error;
- }
-
- if (!disposeNextRoot) {
- throw new Error('Split list root did not provide a disposer');
- }
-
- const disposePreviousRoot = disposeListRoot;
-
- disposeListRoot = disposeNextRoot;
- setListBinding(nextRegistration);
-
- disposePreviousRoot?.();
-
- return nextRegistration;
- }
-
- onCleanup(() => disposeListRoot?.());
-
- return { list, setList };
-}
diff --git a/apps/web/src/components/app/split-layout/utils/createOwnedSlots.ts b/apps/web/src/components/app/split-layout/utils/createOwnedSlots.ts
new file mode 100644
index 0000000000..2d78ce0c9b
--- /dev/null
+++ b/apps/web/src/components/app/split-layout/utils/createOwnedSlots.ts
@@ -0,0 +1,50 @@
+import { createRoot, getOwner, onCleanup } from 'solid-js';
+
+export type ReplaceOwnedSlot = <T>(name: string, factory: () => T) => T;
+
+export type OwnedSlots = {
+ replace: ReplaceOwnedSlot;
+};
+
+export function createOwnedSlots(): OwnedSlots {
+ const owner = getOwner();
+ if (!owner) {
+ throw new Error('createOwnedSlots requires a Solid owner');
+ }
+
+ const disposers = new Map<string, () => void>();
+
+ function replace<T>(name: string, factory: () => T): T {
+ let disposeNext: (() => void) | undefined;
+ let value: T;
+
+ try {
+ value = createRoot((dispose) => {
+ disposeNext = dispose;
+ return factory();
+ }, owner);
+ } catch (error) {
+ disposeNext?.();
+ throw error;
+ }
+
+ if (!disposeNext) {
+ throw new Error(`Owned slot "${name}" did not provide a disposer`);
+ }
+
+ const disposePrevious = disposers.get(name);
+ disposers.set(name, disposeNext);
+ disposePrevious?.();
+
+ return value;
+ }
+
+ onCleanup(() => {
+ for (const dispose of disposers.values()) {
+ dispose();
+ }
+ disposers.clear();
+ });
+
+ return { replace };
+}
diff --git a/apps/web/src/components/list/index.ts b/apps/web/src/components/list/index.ts
index 78457e19c1..81fab3cd83 100644
--- a/apps/web/src/components/list/index.ts
+++ b/apps/web/src/components/list/index.ts
@@ -19,6 +19,7 @@ export {
createStaticListDataSource,
type ListDataSource,
} from './list-data-source';
+export { listOwnedSlotName } from './owned-slots';
export type {
ListActivateOptions,
ListActivation,
diff --git a/apps/web/src/components/list/owned-slots.ts b/apps/web/src/components/list/owned-slots.ts
new file mode 100644
index 0000000000..4143df3aad
--- /dev/null
+++ b/apps/web/src/components/list/owned-slots.ts
@@ -0,0 +1,4 @@
+const slotNameWithPrefix = (prefix: string) => (name: string) =>
+ `${prefix}:${name}`;
+
+export const listOwnedSlotName = slotNameWithPrefix('list');
diff --git a/apps/web/src/components/view-shell/ListDropdowns.tsx b/apps/web/src/components/view-shell/ListDropdowns.tsx
index a8d367476a..f1dd72ba5a 100644
--- a/apps/web/src/components/view-shell/ListDropdowns.tsx
+++ b/apps/web/src/components/view-shell/ListDropdowns.tsx
@@ -118,6 +118,8 @@ export type ListFilterGroup<
id: TGroupId;
label: string;
options: ListControlOption<TOptionId>[];
+ selectionMode?: 'single' | 'multiple';
+ defaultOptionId?: TOptionId;
contentClass?: string;
};
@@ -160,9 +162,15 @@ export function ListFilterDropdown<
<For each={props.groups}>
{(group) => {
const hasSelection = () =>
- group.options.some((option) =>
- props.isSelected(group.id, option.id)
+ group.options.some(
+ (option) =>
+ option.id !== group.defaultOptionId &&
+ props.isSelected(group.id, option.id)
);
+ const selectedOptionId = () =>
+ group.options.find((option) =>
+ props.isSelected(group.id, option.id)
+ )?.id;
return (
<Dropdown.Sub>
@@ -178,41 +186,85 @@ export function ListFilterDropdown<
</Dropdown.SubTrigger>
<Dropdown.SubContent
class={cn(
- 'max-h-72 w-65 max-w-[90vw] overflow-y-auto',
+ 'max-h-72 min-w-24 max-w-[90vw] overflow-y-auto',
group.contentClass
)}
>
<Dropdown.Group>
- <For each={group.options}>
- {(option) => (
- <Dropdown.CheckboxItem
- checked={props.isSelected(group.id, option.id)}
- closeOnSelect={false}
- disabled={option.disabled}
- onChange={(selected) =>
- props.onSelectionChange(
- group.id,
- option.id,
- selected
- )
- }
- >
- <span class="ml-1 flex min-w-0 flex-1 items-center gap-1.5">
- <Show when={option.icon}>
- <span
- aria-hidden="true"
- class="flex size-3.5 shrink-0 items-center justify-center [&_svg]:size-3.5"
- >
- {option.icon?.()}
+ <Show
+ when={group.selectionMode === 'single'}
+ fallback={
+ <For each={group.options}>
+ {(option) => (
+ <Dropdown.CheckboxItem
+ checked={props.isSelected(group.id, option.id)}
+ closeOnSelect={false}
+ disabled={option.disabled}
+ onChange={(selected) =>
+ props.onSelectionChange(
+ group.id,
+ option.id,
+ selected
+ )
+ }
+ >
+ <span class="ml-1 flex min-w-0 flex-1 items-center gap-1.5">
+ <Show when={option.icon}>
+ <span
+ aria-hidden="true"
+ class="flex size-3.5 shrink-0 items-center justify-center [&_svg]:size-3.5"
+ >
+ {option.icon?.()}
+ </span>
+ </Show>
+ <span class="flex-1 truncate">
+ {option.label}
+ </span>
+ </span>
+ </Dropdown.CheckboxItem>
+ )}
+ </For>
+ }
+ >
+ <Dropdown.RadioGroup
+ value={selectedOptionId()}
+ onChange={(value) => {
+ const option = group.options.find(
+ (candidate) => candidate.id === value
+ );
+ if (!option) return;
+
+ props.onSelectionChange(group.id, option.id, true);
+ }}
+ >
+ <For each={group.options}>
+ {(option) => (
+ <Dropdown.RadioItem
+ value={option.id}
+ closeOnSelect={false}
+ disabled={option.disabled}
+ >
+ <span class="ml-1 flex min-w-0 flex-1 items-center gap-1.5">
+ <Show when={option.icon}>
+ <span
+ aria-hidden="true"
+ class="flex size-3.5 shrink-0 items-center justify-center [&_svg]:size-3.5"
+ >
+ {option.icon?.()}
+ </span>
+ </Show>
+ <span class="flex-1 truncate">
+ {option.label}
+ </span>
</span>
- </Show>
- <span class="flex-1 truncate">
- {option.label}
- </span>
- </span>
- </Dropdown.CheckboxItem>
- )}
- </For>
+ <Dropdown.ItemIndicator>
+ <CheckIcon class="size-3.5 text-accent" />
+ </Dropdown.ItemIndicator>
+ </Dropdown.RadioItem>
+ )}
+ </For>
+ </Dropdown.RadioGroup>
+ </Show>
</Dropdown.Group>
</Dropdown.SubContent>
</Dropdown.Sub>
diff --git a/apps/web/src/features/inbox-view/components/InboxDateGroupHeader.tsx b/apps/web/src/features/inbox-view/components/InboxDateGroupHeader.tsx
new file mode 100644
index 0000000000..576b8819af
--- /dev/null
+++ b/apps/web/src/features/inbox-view/components/InboxDateGroupHeader.tsx
@@ -0,0 +1,27 @@
+import type { SoupGroupHeaderRow } from '@app/features/soup';
+import { SOUP_ROW_CLASS } from '@entity/composed/list-entity/row-geometry';
+import { cn } from '@ui';
+
+export function InboxDateGroupHeader(props: {
+ row: SoupGroupHeaderRow;
+ isFirst: boolean;
+}) {
+ return (
+ <div id={props.row.id} role="row">
+ <div role="gridcell">
+ <div
+ class={cn(
+ SOUP_ROW_CLASS.card,
+ 'group/header relative flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-xs font-semibold tracking-tight',
+ 'border-none my-0 text-ink-extra-muted/80',
+ 'mx-0 w-full',
+ 'pl-(--soup-row-padding-l)',
+ !props.isFirst && 'pt-5'
+ )}
+ >
+ <span class="truncate">{props.row.label}</span>
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/inbox-view/components/InboxEmptyState.tsx b/apps/web/src/features/inbox-view/components/InboxEmptyState.tsx
new file mode 100644
index 0000000000..c828ccc35a
--- /dev/null
+++ b/apps/web/src/features/inbox-view/components/InboxEmptyState.tsx
@@ -0,0 +1,94 @@
+import { DOCS_BASE } from '@app/constants/docs-links';
+import { useAddInboxFlow, useEmailLinksStatus } from '@core/email-link';
+import EmptyStateInboxTrayGraphic from '@design/empty-state-inbox-tray.svg';
+import EmptyStateNoFilterMatchGraphic from '@design/empty-state-no-filter-match.svg';
+import EmptyStateNoSearchMatchGraphic from '@design/empty-state-no-search-match.svg';
+import { EmptyStatePanel, FilteredHiddenBanner } from '@ui';
+import { Match, Switch } from 'solid-js';
+import { useInboxView } from '../inbox-view-context';
+
+export function InboxEmptyState() {
+ const { state, setFacets } = useInboxView();
+ const emailActive = useEmailLinksStatus();
+ const startAddInbox = useAddInboxFlow();
+ const searchText = () => state.search.trim();
+ const hasActiveFilters = () =>
+ Object.values(state.facets).some((optionIds) => optionIds.length > 0);
+
+ return (
+ <Switch>
+ <Match when={searchText()}>
+ {(search) => (
+ <EmptyStatePanel
+ centered
+ graphic={EmptyStateNoSearchMatchGraphic}
+ title={`No results for "${search()}"`}
+ description="Search across messages, documents, tasks, and more. Try a different query or broaden your filters."
+ documentationUrl={`${DOCS_BASE}/product/search`}
+ />
+ )}
+ </Match>
+
+ <Match when={hasActiveFilters()}>
+ <EmptyStatePanel
+ centered
+ graphic={EmptyStateNoFilterMatchGraphic}
+ title="No items matching the filters"
+ description="Try adjusting or clearing your filters to see more results."
+ >
+ <FilteredHiddenBanner
+ hasHiddenItems={false}
+ onClearFilters={() => setFacets({})}
+ />
+ </EmptyStatePanel>
+ </Match>
+
+ <Match when={!emailActive()}>
+ <EmptyStatePanel
+ graphic={EmptyStateInboxTrayGraphic}
+ title="Your inbox is empty"
+ description="Bring your inbox into Macro to triage signal from noise, reply faster, and let agents work alongside your mail."
+ primaryAction={{
+ label: 'Connect email',
+ onClick: () => void startAddInbox(),
+ }}
+ documentationUrl={`${DOCS_BASE}/product/inbox`}
+ />
+ </Match>
+
+ <Match when={state.tab === 'noise'}>
+ <EmptyStatePanel
+ graphic={EmptyStateInboxTrayGraphic}
+ title="No noise"
+ description={
+ <>
+ Low-priority items like newsletters and notifications collect
+ here.
+ <br />
+ Nothing to clear right now.
+ </>
+ }
+ documentationUrl={`${DOCS_BASE}/product/inbox`}
+ />
+ </Match>
+
+ <Match when={state.tab === 'all'}>
+ <EmptyStatePanel
+ graphic={EmptyStateInboxTrayGraphic}
+ title="Inbox zero"
+ description="You're all caught up. New items will appear here as they arrive."
+ documentationUrl={`${DOCS_BASE}/product/inbox`}
+ />
+ </Match>
+
+ <Match when={true}>
+ <EmptyStatePanel
+ graphic={EmptyStateInboxTrayGraphic}
+ title="Inbox zero"
+ description="You're all caught up. Important items will appear here as they arrive."
+ documentationUrl={`${DOCS_BASE}/product/inbox`}
+ />
+ </Match>
+ </Switch>
+ );
+}
diff --git a/apps/web/src/features/inbox-view/components/InboxFilters.tsx b/apps/web/src/features/inbox-view/components/InboxFilters.tsx
new file mode 100644
index 0000000000..c0baf06cf5
--- /dev/null
+++ b/apps/web/src/features/inbox-view/components/InboxFilters.tsx
@@ -0,0 +1,295 @@
+import { ListFilterDropdown } from '@app/components/view-shell';
+import { addUnique, removeValue } from '@app/lib/signals/store-array-updaters';
+import { MobileDrawer } from '@components/app/mobile/MobileDrawer';
+import { pressPulse } from '@components/app/mobile/pressPulse';
+import { EntityIcon } from '@core/component/EntityIcon';
+import { ScrollIndicators } from '@core/component/VerticalScrollIndicators';
+import { Accordion } from '@kobalte/core/accordion';
+import BellSimpleIcon from '@phosphor/bell-simple.svg';
+import ChevronDownIcon from '@phosphor/caret-down.svg';
+import CheckIcon from '@phosphor/check.svg';
+import XIcon from '@phosphor/x.svg';
+import SlidersHorizontalIcon from '@phosphor-icons/core/regular/sliders-horizontal.svg?component-solid';
+import { Button, cn } from '@ui';
+import { createMemo, createSignal, For, type JSX, Show } from 'solid-js';
+import { INBOX_FILTER_GROUPS } from '../inbox-facets';
+import { useInboxView } from '../inbox-view-context';
+
+const FILTER_ICONS = new Map<string, () => JSX.Element>([
+ ['documents', () => <EntityIcon targetType="md" size="xs" />],
+ ['tasks', () => <EntityIcon targetType="task" size="xs" />],
+ ['email', () => <EntityIcon targetType="email" size="xs" />],
+ ['channels', () => <EntityIcon targetType="channel" size="xs" />],
+ ['agents', () => <EntityIcon targetType="chat" size="xs" />],
+ ['projects', () => <EntityIcon targetType="project" size="xs" />],
+ ['github', () => <EntityIcon targetType="githubPullRequest" size="xs" />],
+ ['reminders', () => <BellSimpleIcon class="size-3.5 text-ink-muted" />],
+ ['calendar', () => <EntityIcon targetType="calendar" size="xs" />],
+]);
+
+const FILTER_GROUPS = INBOX_FILTER_GROUPS.map((group) => ({
+ ...group,
+ options: group.options.map((option) => ({
+ ...option,
+ icon: FILTER_ICONS.get(option.id),
+ })),
+}));
+
+function useInboxFilters() {
+ const { state, setFacets } = useInboxView();
+
+ const isSelected = (groupId: string, optionId: string) => {
+ const selectedIds = state.facets[groupId] ?? [];
+ if (groupId === 'read' && optionId === 'all') {
+ return selectedIds.length === 0;
+ }
+
+ return selectedIds.includes(optionId);
+ };
+
+ const setSelected = (
+ groupId: string,
+ optionId: string,
+ selected: boolean
+ ) => {
+ if (groupId === 'read') {
+ if (!selected) return;
+
+ setFacets({
+ ...state.facets,
+ [groupId]: optionId === 'all' ? [] : [optionId],
+ });
+ return;
+ }
+
+ const update = selected ? addUnique(optionId) : removeValue(optionId);
+ setFacets({
+ ...state.facets,
+ [groupId]: update(state.facets[groupId]),
+ });
+ };
+
+ const activeCount = () =>
+ Object.values(state.facets).reduce(
+ (count, optionIds) => count + optionIds.length,
+ 0
+ );
+
+ return {
+ activeCount,
+ clear: () => setFacets({}),
+ isSelected,
+ setSelected,
+ };
+}
+
+function scrollAccordionItemToTop(
+ event: MouseEvent,
+ scrollElement: HTMLElement | undefined
+) {
+ if (!scrollElement) return;
+
+ const item = (event.currentTarget as HTMLElement).closest(
+ '[data-closed],[data-expanded]'
+ );
+ if (!(item instanceof HTMLElement)) return;
+
+ requestAnimationFrame(() => {
+ if (!item.hasAttribute('data-expanded')) return;
+
+ const containerRect = scrollElement.getBoundingClientRect();
+ const itemRect = item.getBoundingClientRect();
+ scrollElement.scrollTo({
+ top: scrollElement.scrollTop + (itemRect.top - containerRect.top),
+ behavior: 'smooth',
+ });
+ });
+}
+
+function FilterCountBadge(props: { count: number }) {
+ return (
+ <Show when={props.count > 0}>
+ <span class="absolute -top-0.5 right-0 flex size-4 translate-x-1/2 items-center justify-center rounded-full bg-accent text-xxs font-medium leading-none text-surface">
+ {props.count}
+ </span>
+ </Show>
+ );
+}
+
+export function InboxFilterDropdown() {
+ const filters = useInboxFilters();
+
+ return (
+ <div class="relative ml-auto shrink-0">
+ <ListFilterDropdown
+ groups={FILTER_GROUPS}
+ isSelected={filters.isSelected}
+ onSelectionChange={filters.setSelected}
+ onClear={filters.clear}
+ label="Filter Inbox"
+ />
+
+ <FilterCountBadge count={filters.activeCount()} />
+ </div>
+ );
+}
+
+export function InboxFilterDrawer() {
+ const filters = useInboxFilters();
+ const [scrollRef, setScrollRef] = createSignal<HTMLElement>();
+
+ return (
+ <MobileDrawer
+ side="bottom"
+ preventScroll={false}
+ preventScrollbarShift={false}
+ breakPoints={[0.85]}
+ >
+ <MobileDrawer.Trigger
+ as={Button}
+ aria-label="Open Inbox filters"
+ variant="ghost"
+ size="sm"
+ depth={3}
+ class="island pointer-events-auto relative size-10 shrink-0 rounded-full bg-chrome [&_svg]:size-6"
+ ref={pressPulse}
+ >
+ <SlidersHorizontalIcon />
+ <FilterCountBadge count={filters.activeCount()} />
+ </MobileDrawer.Trigger>
+
+ <MobileDrawer.Portal>
+ <MobileDrawer.Overlay class="fixed inset-0 z-modal-overlay bg-modal-overlay pattern-diagonal-4 pattern-edge-muted" />
+ <MobileDrawer.Content aria-label="Inbox filters" class="h-[80vh]">
+ <MobileDrawer.Handle class="pb-1" />
+
+ <div class="relative min-h-0 flex-1">
+ <ScrollIndicators scrollRef={scrollRef} noBorderStart noBorderEnd />
+ <div
+ ref={setScrollRef}
+ class="h-full overflow-y-auto pb-1 scrollbar-hidden"
+ >
+ <MobileDrawer.Label class="pt-4">Filters</MobileDrawer.Label>
+
+ <Accordion
+ multiple
+ collapsible
+ defaultValue={[FILTER_GROUPS[0]?.id ?? 'type']}
+ >
+ <div class="flex flex-col">
+ <For each={FILTER_GROUPS}>
+ {(group) => {
+ const activeCount = createMemo(
+ () =>
+ group.options.filter(
+ (option) =>
+ option.id !== group.defaultOptionId &&
+ filters.isSelected(group.id, option.id)
+ ).length
+ );
+
+ return (
+ <MobileDrawer.Section
+ as={Accordion.Item}
+ value={group.id}
+ class="mb-3"
+ >
+ <Accordion.Header>
+ <Accordion.Trigger
+ class="group mb-px flex w-full items-center justify-between bg-surface p-3 text-sm text-ink outline-none transition-colors hover:bg-hover"
+ onClick={(event) =>
+ scrollAccordionItemToTop(event, scrollRef())
+ }
+ >
+ <span class="font-medium">{group.label}</span>
+ <div class="flex items-center gap-2">
+ <Show when={activeCount() > 0}>
+ <span class="group-data-expanded:hidden flex size-4 items-center justify-center rounded-full bg-accent text-xxs font-medium leading-none text-surface">
+ {activeCount()}
+ </span>
+ </Show>
+ <ChevronDownIcon class="size-3.5 text-ink-muted transition-transform duration-200 group-data-expanded:rotate-180" />
+ </div>
+ </Accordion.Trigger>
+ </Accordion.Header>
+
+ <Accordion.Content>
+ <For each={group.options}>
+ {(option) => {
+ const selected = () =>
+ filters.isSelected(group.id, option.id);
+
+ return (
+ <button
+ type="button"
+ role={
+ group.selectionMode === 'single'
+ ? 'radio'
+ : 'checkbox'
+ }
+ aria-checked={selected()}
+ class="not-last:mb-px flex w-full items-center gap-3 bg-surface px-3 py-2.5 text-left text-sm transition-colors hover:bg-hover"
+ onClick={() =>
+ filters.setSelected(
+ group.id,
+ option.id,
+ group.selectionMode === 'single'
+ ? true
+ : !selected()
+ )
+ }
+ >
+ <span
+ class={cn(
+ 'flex size-4 shrink-0 items-center justify-center border transition-colors',
+ selected()
+ ? 'border-accent bg-accent'
+ : 'border-edge'
+ )}
+ >
+ <Show when={selected()}>
+ <CheckIcon class="size-2.5 text-surface" />
+ </Show>
+ </span>
+ <Show when={option.icon}>
+ {(icon) => (
+ <span class="flex size-4 shrink-0 items-center justify-center">
+ {icon()()}
+ </span>
+ )}
+ </Show>
+ <span class="min-w-0 flex-1 truncate">
+ {option.label}
+ </span>
+ </button>
+ );
+ }}
+ </For>
+ </Accordion.Content>
+ </MobileDrawer.Section>
+ );
+ }}
+ </For>
+ </div>
+ </Accordion>
+ </div>
+ </div>
+
+ <Show when={filters.activeCount() > 0}>
+ <div class="shrink-0 border-edge-muted border-t p-2">
+ <Button
+ variant="outline"
+ size="sm"
+ class="min-h-10 rounded-lg bg-active!"
+ onClick={filters.clear}
+ >
+ <XIcon class="size-3!" />
+ Clear all
+ </Button>
+ </div>
+ </Show>
+ </MobileDrawer.Content>
+ </MobileDrawer.Portal>
+ </MobileDrawer>
+ );
+}
diff --git a/apps/web/src/features/inbox-view/components/InboxHeader.tsx b/apps/web/src/features/inbox-view/components/InboxHeader.tsx
new file mode 100644
index 0000000000..0277b085b6
--- /dev/null
+++ b/apps/web/src/features/inbox-view/components/InboxHeader.tsx
@@ -0,0 +1,29 @@
+import { SplitPanel } from '@components/app/split-panel';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import { type ParentProps, Show } from 'solid-js';
+
+export function InboxHeader(props: ParentProps) {
+ return (
+ <header class="shrink-0 px-4 pb-3 pt-2 touch:px-(--mobile-chrome-gutter) touch:pt-[calc(var(--safe-top,0px)+0.5rem)] @max-[480px]/view-shell:px-2 @max-[720px]/view-shell:px-3">
+ <Show when={!isTouchDevice()}>
+ <div class="flex min-h-7 items-center">
+ <SplitPanel.ControlGroup>
+ <SplitPanel.CloseButton />
+ <SplitPanel.BackButton />
+ <SplitPanel.ForwardButton />
+ </SplitPanel.ControlGroup>
+ </div>
+ </Show>
+ <Show when={!isTouchDevice()}>
+ <div class="mt-1 flex min-h-10 min-w-0 items-center">
+ <h1 class="m-0 min-w-0 flex-1 truncate text-2xl font-semibold tracking-[-0.035em] text-ink">
+ Inbox
+ </h1>
+ </div>
+ </Show>
+ <div class="mt-3 flex min-h-10 min-w-0 items-center touch:mt-0">
+ {props.children}
+ </div>
+ </header>
+ );
+}
diff --git a/apps/web/src/features/inbox-view/components/InboxList.tsx b/apps/web/src/features/inbox-view/components/InboxList.tsx
new file mode 100644
index 0000000000..34d60fd2f1
--- /dev/null
+++ b/apps/web/src/features/inbox-view/components/InboxList.tsx
@@ -0,0 +1,649 @@
+import '@entity/composed/ListEntity.css';
+import {
+ createListController,
+ type ListActivation,
+ listOwnedSlotName,
+ useListInteractions,
+} from '@app/components/list';
+import {
+ resolveEntityActionViewContext,
+ toEntityActionListState,
+ useEntityActionHotkeys,
+} from '@app/features/next-soup/actions';
+import { InboxListEntity } from '@app/features/next-soup/soup-view/views/inbox/InboxListEntity';
+import {
+ createSoupEntityActions,
+ MaybeSoupEntityActionDrawerManager,
+ SoupEntityContextMenu,
+ useSoupListNavigationHotkeys,
+ viewedProjectIdFromContent,
+} from '@app/features/soup';
+import { DEBUG_SETTING_KEYS, useDebugSetting } from '@app/lib/debugSettings';
+import { makePersistedState } from '@app/lib/persistence';
+import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
+import { PullToRefresh } from '@components/app/mobile/PullToRefresh';
+import { SwipableRowProvider } from '@components/app/mobile/SwipableRow';
+import {
+ useSplitPanelOrThrow,
+ withSplitPanelOwner,
+} from '@components/app/split-layout/layoutUtils';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import {
+ type EntityData,
+ EntitySelectionToolbar,
+ isNonMemberChannelEntity,
+ type WithNotification,
+} from '@entity';
+import CaretDownIcon from '@phosphor/caret-down.svg';
+import CheckIcon from '@phosphor/check.svg';
+import SpinnerIcon from '@phosphor/spinner.svg';
+import { Button, cn } from '@ui';
+import {
+ createEffect,
+ createMemo,
+ createSignal,
+ Match,
+ type Setter,
+ Show,
+ Switch,
+} from 'solid-js';
+import { Virtualizer, type VirtualizerHandle } from 'virtua/solid';
+import {
+ persistSoupNavigationTouchHighlight,
+ soupNavigationTouchHighlight,
+} from '../../next-soup/soup-view/soup-navigation-touch-highlight';
+import {
+ markChannelNotificationsSeenOnOpen,
+ markReminderSeenOnOpen,
+ openEntityInSplitFromUnifiedList,
+} from '../../next-soup/utils';
+import { useInboxView } from '../inbox-view-context';
+import {
+ createInboxListEntryStorage,
+ DEFAULT_INBOX_LIST_STATE,
+ type InboxListStateSnapshot,
+} from '../persistence';
+import {
+ type InboxDataSourceItem,
+ useInboxDataSource,
+} from '../queries/use-inbox-query';
+import { useInboxPreview } from '../use-inbox-preview';
+import { InboxDateGroupHeader } from './InboxDateGroupHeader';
+import { InboxEmptyState } from './InboxEmptyState';
+
+type InboxActionRow = {
+ entity: WithNotification<EntityData>;
+ rowId: string;
+};
+
+type InboxListActivationMetadata = {
+ event?: MouseEvent;
+ newSplit?: boolean;
+};
+
+/** Compact Inbox-card list used by the Activity-layout Inbox workspace. */
+export function InboxList() {
+ const { state } = useInboxView();
+ const panel = useSplitPanelOrThrow();
+ const notificationSource = useGlobalNotificationSource();
+
+ const source = withSplitPanelOwner(listOwnedSlotName('data-source'), () =>
+ useInboxDataSource(state)
+ );
+
+ const list = withSplitPanelOwner(listOwnedSlotName('controller'), () =>
+ createListController<InboxDataSourceItem, InboxListActivationMetadata>({
+ items: source.items,
+ getKey: (row) => row.id,
+ selection: {
+ getKey: (row) => (row.kind === 'entity' ? row.entity.id : row.id),
+ },
+ isNavigable: (row) => row.kind === 'entity' || row.kind === 'load-more',
+ isSelectable: (row) => row.kind === 'entity',
+ onActivate,
+ })
+ );
+
+ withSplitPanelOwner(listOwnedSlotName('navigation-hotkeys'), () => {
+ useSoupListNavigationHotkeys({
+ splitHotkeyScope: panel.splitHotkeyScope,
+ viewId: 'inbox',
+ dataSource: source,
+ controller: list,
+ handle: panel.handle,
+ openEntityInSplit: (entity, options) => {
+ void openEntityInSplitFromUnifiedList(entity, {
+ splitHandle: panel.handle,
+ ...options,
+ });
+ },
+ });
+ });
+
+ const preview = useInboxPreview({
+ controller: list,
+ handle: panel.handle,
+ onPreview: (entity) => {
+ void openEntity(entity, {
+ newSplit: false,
+ replacePair: false,
+ mergeHistory: true,
+ });
+ },
+ });
+
+ const { buildActionGroups } = createSoupEntityActions();
+ const entityActionViewContext = () =>
+ resolveEntityActionViewContext({
+ activeListView: panel.handle.content().id,
+ activeTab: state.tab,
+ });
+
+ function onActivate({
+ item,
+ metadata,
+ }: ListActivation<InboxDataSourceItem, InboxListActivationMetadata>) {
+ if (item.kind === 'load-more') {
+ if (!item.isLoading) void source.loadMore();
+
+ return;
+ }
+
+ if (item.kind !== 'entity') return;
+
+ const sourceRow = source.items().find((row) => row.id === item.id);
+
+ if (sourceRow?.kind !== 'entity') return;
+
+ const newSplit =
+ metadata?.newSplit === true || metadata?.event?.shiftKey === true;
+
+ preview.cancel();
+
+ void openEntity(sourceRow.entity, {
+ event: metadata?.event,
+ newSplit,
+ replacePair: metadata?.event?.altKey === true && !newSplit,
+ });
+ }
+
+ async function openEntity(
+ entity: WithNotification<EntityData>,
+ options: {
+ event?: MouseEvent;
+ newSplit: boolean;
+ replacePair: boolean;
+ mergeHistory?: boolean;
+ }
+ ) {
+ markReminderSeenOnOpen(entity, notificationSource);
+ if (!isNonMemberChannelEntity(entity)) {
+ markChannelNotificationsSeenOnOpen(entity, notificationSource);
+ }
+
+ const finishTouchHighlight = options.event
+ ? persistSoupNavigationTouchHighlight(options.event)
+ : undefined;
+
+ try {
+ await openEntityInSplitFromUnifiedList(entity, {
+ openInNewSplit: options.newSplit,
+ replacePreview: options.replacePair,
+ splitHandle: panel.handle,
+ referredFrom: 'inbox',
+ mergeHistory: options.mergeHistory,
+ });
+ } finally {
+ finishTouchHighlight?.();
+ }
+ }
+
+ const [viewport, setViewport] = createSignal<HTMLDivElement>();
+ const [emptyViewport, setEmptyViewport] = createSignal<HTMLDivElement>();
+ const [virtualizer, setVirtualizer] = createSignal<VirtualizerHandle>();
+ const [isPullRefreshing, setIsPullRefreshing] = createSignal(false);
+ const forceEmptyState = useDebugSetting(
+ DEBUG_SETTING_KEYS.FORCE_EMPTY_STATES
+ );
+
+ let scrollOffset = DEFAULT_INBOX_LIST_STATE.scrollOffset;
+ const readListState = (): InboxListStateSnapshot => ({
+ focusKey: list.focus.requestedKey(),
+ scrollOffset: virtualizer()?.scrollOffset ?? scrollOffset,
+ });
+
+ const applyListState: Setter<InboxListStateSnapshot> = (next) => {
+ const current = readListState();
+ const value = typeof next === 'function' ? next(current) : next;
+
+ if (value.focusKey !== current.focusKey) {
+ list.focus.restore(value.focusKey, { reason: 'restore' });
+ }
+
+ scrollOffset = value.scrollOffset;
+ if (value.scrollOffset !== current.scrollOffset) {
+ virtualizer()?.scrollTo(value.scrollOffset);
+ }
+
+ return value;
+ };
+ const [, setPersistedListState] = makePersistedState(
+ [readListState, applyListState],
+ { storages: createInboxListEntryStorage(panel.handle) }
+ );
+
+ createEffect(() => {
+ const focusKey = list.focus.requestedKey();
+ setPersistedListState((current) => ({ ...current, focusKey }));
+ });
+
+ const rows = source.items;
+
+ const swipeRowsById = createMemo(() => {
+ const entities = new Map<string, InboxActionRow>();
+
+ for (const row of rows()) {
+ if (row.kind !== 'entity') continue;
+
+ entities.set(row.id, { entity: row.entity, rowId: row.id });
+ }
+
+ return entities;
+ });
+
+ const selectedEntities = createMemo(() =>
+ list.selection
+ .items()
+ .flatMap((row) => (row.kind === 'entity' ? [row.entity] : []))
+ );
+
+ const focusedEntity = () => {
+ const row = list.focus.result()?.item;
+ return row?.kind === 'entity' ? row.entity : undefined;
+ };
+
+ let listRoot: HTMLDivElement | undefined;
+ const actionState = toEntityActionListState({
+ controller: list,
+ getEntity: (row) => (row.kind === 'entity' ? row.entity : undefined),
+ onFocus: (target) => {
+ if (target) {
+ virtualizer()?.scrollToIndex(target.index, { align: 'nearest' });
+ }
+
+ listRoot?.focus();
+ },
+ });
+
+ const listInteractions = useListInteractions({
+ controller: list,
+ scopeId: panel.splitHotkeyScope,
+ scrollHandle: virtualizer,
+ enabled: panel.isPanelActive,
+ navigation: {
+ onNavigate: (event) => {
+ const row = event.result?.item;
+ if (row?.kind === 'entity') {
+ preview.request(row.entity);
+ }
+
+ if (event.kind !== 'move' || event.direction !== 1) return;
+ if (source.isLoadingMore() || !source.hasMore()) return;
+
+ const distanceFromEnd = event.result
+ ? list.items.count() - event.result.index - 1
+ : 0;
+
+ if (distanceFromEnd > 3) return;
+
+ void source.loadMore();
+ },
+ },
+ activation: {
+ createMetadata: (intent) => ({ newSplit: intent === 'alternate' }),
+ alternateDescription: 'Open in new split',
+ },
+ });
+
+ useEntityActionHotkeys({
+ scopeId: panel.splitHotkeyScope,
+ list: actionState,
+ selectedEntities,
+ focusedEntity,
+ restoreFocus: () => listRoot?.focus(),
+ viewContext: entityActionViewContext,
+ splitHandle: panel.handle,
+ condition: panel.isPanelActive,
+ });
+
+ function actionGroupsFor(row: InboxActionRow) {
+ const content = panel.handle.content();
+
+ return buildActionGroups(actionState, [row.entity], {
+ viewContext: entityActionViewContext(),
+ viewedProjectId: viewedProjectIdFromContent(content),
+ splitHandle: panel.handle,
+ });
+ }
+
+ const markDoneActionFor = (row: InboxActionRow) =>
+ actionGroupsFor(row)
+ .flatMap((group) => group.items)
+ .find((action) => action.id === 'mark-done');
+
+ function focusActionRow(row: InboxActionRow) {
+ list.focus.set(row.rowId, { reason: 'pointer', force: true });
+ list.selection.setAnchor(row.rowId);
+ }
+
+ let restoredScroll = false;
+ function registerVirtualizer(handle?: VirtualizerHandle) {
+ setVirtualizer(handle);
+ if (!handle || restoredScroll) return;
+
+ handle.scrollTo(scrollOffset);
+ restoredScroll = true;
+ }
+
+ function showsEmptyViewport() {
+ return (
+ forceEmptyState() ||
+ (!source.isLoading() && (Boolean(source.error()) || rows().length === 0))
+ );
+ }
+
+ function pullScrollContainer() {
+ return showsEmptyViewport() ? emptyViewport() : viewport();
+ }
+
+ async function pullRefresh() {
+ setIsPullRefreshing(true);
+
+ try {
+ await source.refresh();
+ } finally {
+ setIsPullRefreshing(false);
+ }
+ }
+
+ let activeTab = state.tab;
+ createEffect(() => {
+ const nextTab = state.tab;
+ if (nextTab === activeTab) return;
+
+ activeTab = nextTab;
+ preview.cancel();
+ listInteractions.selection.clear();
+ list.focus.clear({ reason: 'programmatic' });
+ panel.handle.resetPreview();
+ setPersistedListState((current) => ({ ...current, scrollOffset: 0 }));
+ });
+
+ createEffect(() => {
+ rows();
+ if (source.isLoading()) return;
+
+ if (list.focus.result()) return;
+
+ const restored = list.focus.restore(list.focus.requestedKey(), {
+ retainUnavailable: false,
+ });
+ if (restored) return;
+ if (isTouchDevice()) return;
+ if (panel.handle.isControllerSplit()) {
+ panel.handle.resetPreview();
+ return;
+ }
+
+ list.focus.first({
+ isNavigable: (row) => row.kind === 'entity',
+ reason: 'restore',
+ });
+ });
+
+ function checkNearEnd() {
+ const handle = virtualizer();
+ if (!handle) return;
+
+ setPersistedListState((current) => ({
+ ...current,
+ scrollOffset: handle.scrollOffset,
+ }));
+ if (!source.hasMore()) return;
+
+ const distance =
+ handle.scrollSize - handle.scrollOffset - handle.viewportSize;
+ if (distance < 300 && !source.isLoadingMore()) {
+ void source.loadMore();
+ }
+ }
+
+ return (
+ <MaybeSoupEntityActionDrawerManager>
+ <div
+ ref={listRoot}
+ role="grid"
+ aria-label="Inbox"
+ aria-multiselectable="true"
+ aria-activedescendant={list.focus.key()}
+ tabIndex={0}
+ class="soup-list relative mt-3 flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden outline-none"
+ style={{ '--mobile-content-inset-top': '0px' }}
+ >
+ <PullToRefresh
+ scrollContainer={pullScrollContainer}
+ onRefresh={pullRefresh}
+ />
+
+ <SwipableRowProvider
+ container={viewport}
+ canSwipeLeft={(rowId) => {
+ const row = swipeRowsById().get(rowId);
+ return row ? markDoneActionFor(row) !== undefined : false;
+ }}
+ onSwipeLeft={(rowId) => {
+ const row = swipeRowsById().get(rowId);
+ if (!row) return;
+
+ const action = markDoneActionFor(row);
+ if (!action) return;
+
+ focusActionRow(row);
+ void action.onClick();
+ }}
+ >
+ <Switch>
+ <Match
+ when={
+ !forceEmptyState() && source.isLoading() && !isPullRefreshing()
+ }
+ >
+ <div class="grid min-h-0 flex-1 place-items-center text-ink-muted">
+ <SpinnerIcon
+ aria-label="Loading inbox"
+ class="size-5 animate-spin"
+ />
+ </div>
+ </Match>
+
+ <Match when={!forceEmptyState() && source.error()}>
+ <div
+ ref={setEmptyViewport}
+ class="flex min-h-0 flex-1 flex-col items-center justify-center gap-3 overflow-y-auto pb-[max(1rem,var(--mobile-content-inset-bottom,0px))] text-sm text-ink-muted"
+ >
+ <span>Inbox couldn’t be loaded.</span>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => void source.refresh()}
+ >
+ Try again
+ </Button>
+ </div>
+ </Match>
+
+ <Match when={forceEmptyState() || rows().length === 0}>
+ <div
+ ref={setEmptyViewport}
+ class="min-h-0 flex-1 overflow-y-auto pb-[max(1rem,var(--mobile-content-inset-bottom,0px))]"
+ >
+ <InboxEmptyState />
+ </div>
+ </Match>
+
+ <Match when={true}>
+ <div
+ ref={(element) => {
+ setViewport(element);
+ soupNavigationTouchHighlight(element);
+ }}
+ class="scrollbar-hidden min-h-0 flex-1 overflow-y-auto overscroll-none pb-[max(0.5rem,var(--mobile-content-inset-bottom,0px))]"
+ >
+ <Virtualizer
+ ref={registerVirtualizer}
+ data={rows()}
+ scrollRef={viewport()}
+ bufferSize={500}
+ itemSize={88}
+ keepMounted={
+ list.focus.index() >= 0 ? [list.focus.index()] : undefined
+ }
+ onScroll={checkNearEnd}
+ >
+ {(row) => (
+ <Switch>
+ <Match
+ when={row.kind === 'group-header' ? row : undefined}
+ >
+ {(group) => (
+ <InboxDateGroupHeader
+ row={group()}
+ isFirst={rows()[0]?.id === group().id}
+ />
+ )}
+ </Match>
+ <Match when={row.kind === 'entity' ? row : undefined}>
+ {(entityRow) => (
+ <SoupEntityContextMenu
+ entity={entityRow().entity}
+ list={actionState}
+ selectedEntities={selectedEntities}
+ viewContext={entityActionViewContext()}
+ onOpenChange={(open) => {
+ if (!open) return;
+ focusActionRow({
+ entity: entityRow().entity,
+ rowId: entityRow().id,
+ });
+ }}
+ >
+ <div
+ id={entityRow().id}
+ role="row"
+ data-soup-entity
+ >
+ <div role="gridcell">
+ <InboxListEntity
+ class="mx-0 w-full border-b border-edge touch:border-b-0"
+ cardClass="rounded-none px-4 py-3"
+ entity={entityRow().entity}
+ occurrenceKey={entityRow().id}
+ checked={list.selection.isSelected(
+ entityRow().id
+ )}
+ hideCheckbox
+ highlighted={
+ !isTouchDevice() &&
+ list.focus.key() === entityRow().id
+ }
+ focusable={false}
+ entityRowConfig={{
+ swipeLeftColor: 'bg-success',
+ swipeLeftRevealedComponent: (
+ <CheckIcon class="size-8 text-surface" />
+ ),
+ }}
+ onClick={(event) => {
+ if (
+ event.metaKey ||
+ event.ctrlKey ||
+ (isTouchDevice() &&
+ list.selection.count() > 0)
+ ) {
+ listInteractions.selection.toggle(
+ entityRow().id
+ );
+ return;
+ }
+
+ list.activate.key(entityRow().id, {
+ reason: 'pointer',
+ metadata: { event },
+ });
+ }}
+ />
+ </div>
+ </div>
+ </SoupEntityContextMenu>
+ )}
+ </Match>
+ <Match when={row.kind === 'load-more' ? row : undefined}>
+ {(loadMore) => (
+ <div id={loadMore().id} role="row">
+ <div
+ role="gridcell"
+ aria-busy={loadMore().isLoading}
+ class={cn(
+ 'flex min-h-12 items-center justify-center',
+ !isTouchDevice() &&
+ list.focus.key() === loadMore().id &&
+ 'bg-active/60'
+ )}
+ onClick={() =>
+ list.activate.key(loadMore().id, {
+ reason: 'pointer',
+ })
+ }
+ >
+ <Button
+ variant="outline"
+ size="sm"
+ depth={2}
+ disabled={loadMore().isLoading}
+ class="bg-surface"
+ >
+ <Show
+ when={!loadMore().isLoading}
+ fallback={
+ <SpinnerIcon class="size-3 animate-spin" />
+ }
+ >
+ <CaretDownIcon class="size-2.5" />
+ </Show>
+ {loadMore().isLoading
+ ? 'Loading...'
+ : 'Load More'}
+ </Button>
+ </div>
+ </div>
+ )}
+ </Match>
+ </Switch>
+ )}
+ </Virtualizer>
+ </div>
+ </Match>
+ </Switch>
+ </SwipableRowProvider>
+
+ <Show when={selectedEntities().length > 0}>
+ <EntitySelectionToolbar
+ selected={selectedEntities()}
+ onClear={listInteractions.selection.clear}
+ analyticsSource="inbox_view_selection_toolbar"
+ />
+ </Show>
+ </div>
+ </MaybeSoupEntityActionDrawerManager>
+ );
+}
diff --git a/apps/web/src/features/inbox-view/components/InboxTabs.tsx b/apps/web/src/features/inbox-view/components/InboxTabs.tsx
new file mode 100644
index 0000000000..70972fd755
--- /dev/null
+++ b/apps/web/src/features/inbox-view/components/InboxTabs.tsx
@@ -0,0 +1,69 @@
+import { useViewTabHotkeys } from '@app/components/view-shell';
+import { PillTabs } from '@components/app/mobile/PillTabs';
+import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
+import { TabsInset } from '@core/component/TabsInset';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import { Show } from 'solid-js';
+import { useInboxView } from '../inbox-view-context';
+import type { InboxTab } from '../types';
+import { InboxFilterDrawer, InboxFilterDropdown } from './InboxFilters';
+
+const INBOX_TABS: { value: InboxTab; label: string }[] = [
+ { value: 'signal', label: 'Signal' },
+ { value: 'noise', label: 'Noise' },
+ { value: 'all', label: 'All' },
+];
+const INBOX_TAB_IDS = INBOX_TABS.map((tab) => tab.value);
+
+/** Compact category switcher from the Activity-layout Inbox experiment. */
+export function InboxTabs() {
+ const panel = useSplitPanelOrThrow();
+ const { state, setTab } = useInboxView();
+
+ useViewTabHotkeys({
+ scopeId: panel.splitHotkeyScope,
+ enabled: panel.isPanelActive,
+ ids: () => INBOX_TAB_IDS,
+ activeId: () => state.tab,
+ setActiveId: setTab,
+ });
+
+ const handleTabChange = (value: string) => {
+ const tab = INBOX_TABS.find((item) => item.value === value);
+ if (!tab) return;
+
+ setTab(tab.value);
+ };
+
+ return (
+ <Show
+ when={isTouchDevice()}
+ fallback={
+ <div class="flex h-8 min-w-0 flex-1 items-center gap-3">
+ <div class="h-8 min-w-0 basis-3/4 shrink max-w-72">
+ <TabsInset
+ aria-label="Inbox views"
+ list={INBOX_TABS}
+ value={state.tab}
+ onChange={handleTabChange}
+ class="h-8"
+ trackClass="h-full"
+ fullWidth
+ />
+ </div>
+ <InboxFilterDropdown />
+ </div>
+ }
+ >
+ <div class="h-10 min-w-0 flex-1">
+ <PillTabs
+ scrollable
+ leading={<InboxFilterDrawer />}
+ items={INBOX_TABS}
+ value={state.tab}
+ onChange={handleTabChange}
+ />
+ </div>
+ </Show>
+ );
+}
diff --git a/apps/web/src/features/inbox-view/inbox-facets.ts b/apps/web/src/features/inbox-view/inbox-facets.ts
new file mode 100644
index 0000000000..564c61bfef
--- /dev/null
+++ b/apps/web/src/features/inbox-view/inbox-facets.ts
@@ -0,0 +1,188 @@
+import {
+ clause,
+ type Facet,
+ type FacetClause,
+ type FacetOption,
+ NIL_UUID,
+} from '@app/features/soup';
+import {
+ type EntityData,
+ isGithubPrEntity,
+ isTaskEntity,
+} from '@entity/types/entity';
+import { isWithNotification } from '@entity/types/notification';
+import { toNotificationEntity } from '@entity/utils/notification';
+import type { NotificationSource } from '@notifications/notification-source';
+import { compositeEntity } from '@notifications/types';
+import type { InboxReadFilter, InboxTypeFilter } from './types';
+
+export type InboxFacetContext = {
+ notificationSource?: NotificationSource;
+};
+
+export type InboxFacetOption = FacetOption<EntityData, InboxFacetContext> & {
+ label: string;
+};
+
+function readClause(seen: boolean): FacetClause {
+ return {
+ df: clause.eq('documentSeen', seen),
+ calf: clause.eq('calendarEventSeen', seen),
+ ef: clause.eq('emailSeen', seen),
+ chanf: clause.eq('channelSeen', seen),
+ cthf: clause.eq('channelThreadSeen', seen),
+ cf: clause.eq('chatSeen', seen),
+ pf: clause.eq('folderSeen', seen),
+ fef: clause.eq('foreignEntitySeen', seen),
+ };
+}
+
+function readOption(
+ id: InboxReadFilter,
+ label: string,
+ seen: boolean
+): InboxFacetOption {
+ return {
+ id,
+ label,
+ clause: readClause(seen),
+ predicate: (entity, context) => {
+ const source = context.notificationSource;
+ if (!source) return true;
+
+ if (entity.type === 'email') {
+ const unread = !entity.isRead;
+ return unread !== seen;
+ }
+
+ const notifications =
+ (isWithNotification(entity)
+ ? entity.notifications?.()
+ : source.notificationsByEntity()[
+ compositeEntity(toNotificationEntity(entity))
+ ]) ?? [];
+ const unread = notifications.some(
+ (notification) => !notification.viewed_at
+ );
+
+ return unread !== seen;
+ },
+ };
+}
+
+const typeOptions: Record<InboxTypeFilter, InboxFacetOption> = {
+ documents: {
+ id: 'documents',
+ label: 'Documents',
+ clause: {
+ df: clause.not(clause.eq('subType', 'task')),
+ },
+ predicate: (entity) => entity.type === 'document' && !isTaskEntity(entity),
+ },
+ tasks: {
+ id: 'tasks',
+ label: 'Tasks',
+ clause: { df: clause.eq('subType', 'task') },
+ predicate: isTaskEntity,
+ },
+ email: {
+ id: 'email',
+ label: 'Email',
+ clause: { ef: clause.not(clause.eq('threadId', NIL_UUID)) },
+ predicate: (entity) => entity.type === 'email',
+ },
+ channels: {
+ id: 'channels',
+ label: 'Channels',
+ clause: {
+ chanf: clause.not(clause.eq('channelId', NIL_UUID)),
+ cthf: clause.not(clause.eq('channelThreadId', NIL_UUID)),
+ },
+ predicate: (entity) =>
+ entity.type === 'channel' ||
+ entity.type === 'channel_message' ||
+ entity.type === 'channel_thread',
+ },
+ agents: {
+ id: 'agents',
+ label: 'Agents',
+ clause: { cf: clause.not(clause.eq('chatId', NIL_UUID)) },
+ predicate: (entity) => entity.type === 'chat',
+ },
+ projects: {
+ id: 'projects',
+ label: 'Projects',
+ clause: { pf: clause.not(clause.eq('folderId', NIL_UUID)) },
+ predicate: (entity) => entity.type === 'project',
+ },
+ github: {
+ id: 'github',
+ label: 'GitHub',
+ clause: {
+ fef: clause.not(clause.eq('foreignEntityRecordId', NIL_UUID)),
+ },
+ predicate: isGithubPrEntity,
+ },
+ reminders: {
+ id: 'reminders',
+ label: 'Reminders',
+ clause: { remf: clause.not(clause.eq('reminderId', NIL_UUID)) },
+ predicate: (entity) => entity.type === 'reminder',
+ },
+ calendar: {
+ id: 'calendar',
+ label: 'Calendar',
+ clause: {
+ calf: clause.not(clause.eq('calendarEventId', NIL_UUID)),
+ },
+ predicate: (entity) => entity.type === 'calendar_event',
+ },
+};
+
+type InboxFilterGroup = {
+ id: string;
+ label: string;
+ selectionMode?: 'single' | 'multiple';
+ defaultOptionId?: string;
+ options: { id: string; label: string }[];
+};
+
+export const INBOX_FILTER_GROUPS: InboxFilterGroup[] = [
+ {
+ id: 'read',
+ label: 'Status',
+ selectionMode: 'single',
+ defaultOptionId: 'all',
+ options: [
+ { id: 'unread', label: 'Unread' },
+ { id: 'read', label: 'Read' },
+ { id: 'all', label: 'All' },
+ ],
+ },
+ {
+ id: 'type',
+ label: 'Type',
+ options: Object.values(typeOptions),
+ },
+];
+
+export const INBOX_FACETS: Facet<
+ EntityData,
+ InboxFacetContext,
+ InboxFacetOption
+>[] = [
+ {
+ id: 'read',
+ mode: 'or',
+ options: [
+ readOption('unread', 'Unread', false),
+ readOption('read', 'Read', true),
+ ],
+ },
+ {
+ id: 'type',
+ mode: 'or',
+ restrict: true,
+ options: Object.values(typeOptions),
+ },
+];
diff --git a/apps/web/src/features/inbox-view/inbox-view-context.tsx b/apps/web/src/features/inbox-view/inbox-view-context.tsx
new file mode 100644
index 0000000000..d7a6a057fa
--- /dev/null
+++ b/apps/web/src/features/inbox-view/inbox-view-context.tsx
@@ -0,0 +1,78 @@
+import { normalizeFacetSelection } from '@app/features/soup/filters/facets/selection';
+import type { FacetSelection } from '@app/features/soup/filters/facets/types';
+import { makePersistedState } from '@app/lib/persistence';
+import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
+import { createAssertedContextProvider } from '@core/context/createContext';
+import type { ContextProviderProps } from '@solid-primitives/context';
+import {
+ createStore,
+ produce,
+ reconcile,
+ type SetStoreFunction,
+ type Store,
+} from 'solid-js/store';
+import { createInboxViewPersistence } from './persistence';
+import type {
+ InboxGroupBy,
+ InboxTab,
+ InboxViewState,
+ InboxViewStateOptions,
+} from './types';
+
+type InboxViewProviderProps = ContextProviderProps & {
+ initialState?: InboxViewStateOptions;
+};
+
+export type InboxViewContext = {
+ state: Store<InboxViewState>;
+ setState: SetStoreFunction<InboxViewState>;
+ setTab: (tab: InboxTab) => void;
+ setFacets: (facets: FacetSelection) => void;
+};
+
+function defaultGroupBy(tab: InboxTab): InboxGroupBy {
+ return tab === 'reminders' ? 'none' : 'date';
+}
+
+export const [InboxViewProvider, useInboxView] = createAssertedContextProvider<
+ InboxViewContext,
+ InboxViewProviderProps
+>('InboxView', (props) => {
+ const panel = useSplitPanelOrThrow();
+ const initial = props.initialState ?? {};
+ const initialTab = initial.tab ?? 'signal';
+ const [state, setState] = makePersistedState(
+ createStore<InboxViewState>({
+ tab: initialTab,
+ search: initial.search ?? '',
+ groupBy: initial.groupBy ?? defaultGroupBy(initialTab),
+ facets: normalizeFacetSelection(initial.facets),
+ }),
+ createInboxViewPersistence({
+ handle: panel.handle,
+ restoreEntryState: props.initialState === undefined,
+ })
+ );
+
+ const setTab = (tab: InboxTab) => {
+ if (state.tab === tab) return;
+
+ setState(
+ produce((draft) => {
+ draft.tab = tab;
+ draft.groupBy = defaultGroupBy(tab);
+ })
+ );
+ };
+
+ const setFacets = (facets: FacetSelection) => {
+ setState('facets', reconcile(normalizeFacetSelection(facets)));
+ };
+
+ return {
+ state,
+ setState,
+ setTab,
+ setFacets,
+ };
+});
diff --git a/apps/web/src/features/inbox-view/inbox-view.tsx b/apps/web/src/features/inbox-view/inbox-view.tsx
new file mode 100644
index 0000000000..dcc31da6b0
--- /dev/null
+++ b/apps/web/src/features/inbox-view/inbox-view.tsx
@@ -0,0 +1,68 @@
+import { ViewShell } from '@app/components/view-shell';
+import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
+import { SplitPanel } from '@components/app/split-panel';
+import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
+import { ListEntityMetadataQueryProvider } from '@entity';
+import SpinnerIcon from '@phosphor/spinner.svg';
+import { createEffect, onMount, Suspense } from 'solid-js';
+import { InboxHeader } from './components/InboxHeader';
+import { InboxList } from './components/InboxList';
+import { InboxTabs } from './components/InboxTabs';
+import { InboxViewProvider, useInboxView } from './inbox-view-context';
+import type { InboxViewStateOptions } from './types';
+
+export type InboxViewProps = {
+ /** Explicit navigation state. When present, it wins over entry restoration. */
+ initialState?: InboxViewStateOptions;
+};
+
+function InboxFallback() {
+ return (
+ <div class="grid min-h-0 min-w-0 flex-1 place-items-center text-ink-muted">
+ <SpinnerIcon aria-label="Loading inbox" class="size-5 animate-spin" />
+ </div>
+ );
+}
+
+function InboxViewRoot() {
+ const panel = useSplitPanelOrThrow();
+ const { state, setTab } = useInboxView();
+
+ createEffect(() => {
+ if (state.tab !== 'reminders') return;
+
+ setTab('signal');
+ });
+
+ onMount(() => panel.handle.setDisplayName('Inbox'));
+
+ return (
+ <ListEntityMetadataQueryProvider>
+ <StaticMarkdownContext>
+ <SplitPanel.Root>
+ <SplitPanel.Body>
+ <ViewShell.Root aside={false} main={{ min: 224 }}>
+ <ViewShell.Main>
+ <InboxHeader>
+ <InboxTabs />
+ </InboxHeader>
+ <Suspense fallback={<InboxFallback />}>
+ <InboxList />
+ </Suspense>
+ </ViewShell.Main>
+ </ViewShell.Root>
+ </SplitPanel.Body>
+ </SplitPanel.Root>
+ </StaticMarkdownContext>
+ </ListEntityMetadataQueryProvider>
+ );
+}
+
+/** Composable heterogeneous Inbox built on the shared view and Soup primitives. */
+export function InboxView(props: InboxViewProps) {
+ return (
+ <InboxViewProvider initialState={props.initialState}>
+ <InboxViewRoot />
+ </InboxViewProvider>
+ );
+}
diff --git a/apps/web/src/features/inbox-view/persistence.ts b/apps/web/src/features/inbox-view/persistence.ts
new file mode 100644
index 0000000000..8441b55f1f
--- /dev/null
+++ b/apps/web/src/features/inbox-view/persistence.ts
@@ -0,0 +1,121 @@
+import type {
+ MakePersistedStateOptions,
+ PersistenceStorage,
+} from '@app/lib/persistence';
+import {
+ createEntryPersistenceStorage,
+ type EntryPersistenceHandle,
+} from '@components/app/split-layout/entry-persistence';
+import { z } from 'zod';
+import type { InboxViewState } from './types';
+
+export const INBOX_ENTRY_STATE_KEY = 'inbox.view';
+export const INBOX_LIST_ENTRY_STATE_KEY = 'inbox.listState';
+
+const inboxEntryStateSchemaWithDefaults = z.object({
+ version: z.literal(1).default(1),
+ tab: z.enum(['signal', 'noise', 'all']).default('signal'),
+});
+
+type InboxEntryState = z.infer<typeof inboxEntryStateSchemaWithDefaults>;
+
+const DEFAULT_INBOX_ENTRY_STATE: InboxEntryState =
+ inboxEntryStateSchemaWithDefaults.parse({});
+const inboxEntryStateSchema = inboxEntryStateSchemaWithDefaults.catch(
+ DEFAULT_INBOX_ENTRY_STATE
+);
+
+const inboxListEntryStateSchemaWithDefaults = z.object({
+ version: z.literal(1).default(1),
+ focusKey: z.string().optional(),
+ scrollOffset: z.number().finite().default(0),
+});
+
+type InboxListEntryState = z.infer<
+ typeof inboxListEntryStateSchemaWithDefaults
+>;
+
+const DEFAULT_INBOX_LIST_ENTRY_STATE: InboxListEntryState =
+ inboxListEntryStateSchemaWithDefaults.parse({});
+const inboxListEntryStateSchema = inboxListEntryStateSchemaWithDefaults.catch(
+ DEFAULT_INBOX_LIST_ENTRY_STATE
+);
+
+export type InboxListStateSnapshot = {
+ focusKey: InboxListEntryState['focusKey'];
+ scrollOffset: InboxListEntryState['scrollOffset'];
+};
+
+export const DEFAULT_INBOX_LIST_STATE: InboxListStateSnapshot = {
+ focusKey: DEFAULT_INBOX_LIST_ENTRY_STATE.focusKey,
+ scrollOffset: DEFAULT_INBOX_LIST_ENTRY_STATE.scrollOffset,
+};
+
+function selectEntryState(state: InboxViewState): InboxEntryState {
+ return {
+ version: 1,
+ tab: state.tab === 'reminders' ? 'signal' : state.tab,
+ };
+}
+
+function createInboxEntryStorage(options: {
+ handle: EntryPersistenceHandle;
+ restore: boolean;
+}): PersistenceStorage<InboxViewState> {
+ return createEntryPersistenceStorage({
+ handle: options.handle,
+ key: INBOX_ENTRY_STATE_KEY,
+ restore: (current, stored) => {
+ if (!options.restore) return undefined;
+
+ const restored = inboxEntryStateSchema.parse(stored);
+ return {
+ ...current,
+ tab: restored.tab,
+ };
+ },
+ select: selectEntryState,
+ });
+}
+
+export type CreateInboxViewPersistenceOptions = {
+ handle: EntryPersistenceHandle;
+ restoreEntryState?: boolean;
+};
+
+export function createInboxListEntryStorage(
+ handle: EntryPersistenceHandle
+): PersistenceStorage<InboxListStateSnapshot> {
+ return createEntryPersistenceStorage({
+ handle,
+ key: INBOX_LIST_ENTRY_STATE_KEY,
+ restore: (current, stored) => {
+ const restored = inboxListEntryStateSchema.parse(stored);
+
+ return {
+ ...current,
+ focusKey: restored.focusKey,
+ scrollOffset: restored.scrollOffset,
+ };
+ },
+ select: (state): InboxListEntryState => ({
+ version: 1,
+ ...(state.focusKey === undefined ? {} : { focusKey: state.focusKey }),
+ scrollOffset: state.scrollOffset,
+ }),
+ });
+}
+
+/** Persists Inbox navigation state with the owning split entry. */
+export function createInboxViewPersistence(
+ options: CreateInboxViewPersistenceOptions
+): MakePersistedStateOptions<InboxViewState> {
+ return {
+ storages: [
+ createInboxEntryStorage({
+ handle: options.handle,
+ restore: options.restoreEntryState ?? true,
+ }),
+ ],
+ };
+}
diff --git a/apps/web/src/features/inbox-view/queries/inbox-query.ts b/apps/web/src/features/inbox-view/queries/inbox-query.ts
new file mode 100644
index 0000000000..93d5ca8582
--- /dev/null
+++ b/apps/web/src/features/inbox-view/queries/inbox-query.ts
@@ -0,0 +1,199 @@
+import {
+ clause,
+ compileClause,
+ compileFacets,
+ confine,
+ type FacetClause,
+ type FacetSelection,
+ mergeAst,
+ NIL_UUID,
+ type TargetExpr,
+} from '@app/features/soup';
+import type { SoupAstBody, SoupAstItemsQueryArgs } from '@queries/soup/items';
+import { startOfDay, subWeeks } from 'date-fns';
+import { match } from 'ts-pattern';
+import { INBOX_FACETS, type InboxFacetContext } from '../inbox-facets';
+import type { InboxTab } from '../types';
+
+export type InboxQueryCapabilities = {
+ calendar: boolean;
+ foreignEntities: boolean;
+ reminders: boolean;
+ snippets: boolean;
+};
+
+function visibleEntity(field: string): TargetExpr {
+ return clause.not(clause.eq(field, NIL_UUID));
+}
+
+function documentClause(
+ expressions: TargetExpr[],
+ capabilities: InboxQueryCapabilities
+): TargetExpr {
+ if (capabilities.snippets) return clause.and(...expressions);
+
+ return clause.and(
+ ...expressions,
+ clause.not(clause.eq('subType', 'snippet'))
+ );
+}
+
+function signalClause(
+ capabilities: InboxQueryCapabilities,
+ now: Date,
+ userId: string | undefined
+): FacetClause {
+ const recent = subWeeks(startOfDay(now), 2).toISOString();
+
+ const filters: FacetClause = {
+ df: documentClause(
+ [
+ clause.eq('documentDone', false),
+ clause.eq('documentUpdatedAt', { gte: recent }),
+ ],
+ capabilities
+ ),
+ ef: clause.and(
+ clause.eq('emailDone', false),
+ clause.eq('emailImportance', true),
+ clause.eq('emailUpdatedAt', { gte: recent }),
+ clause.eq('emailShared', 'exclude')
+ ),
+ chanf: clause.and(
+ clause.eq('channelDone', false),
+ clause.eq('channelIsParticipant', true)
+ ),
+ cthf: clause.and(
+ clause.eq('channelThreadDone', false),
+ clause.eq('channelThreadParticipantId', userId ?? NIL_UUID)
+ ),
+ cf: clause.and(
+ clause.eq('chatDone', false),
+ clause.eq('chatUpdatedAt', { gte: recent })
+ ),
+ pf: clause.and(
+ clause.eq('folderDone', false),
+ clause.eq('folderUpdatedAt', { gte: recent })
+ ),
+ };
+
+ if (capabilities.foreignEntities) {
+ filters.fef = clause.and(
+ clause.eq('foreignEntitySource', 'github_pull_request'),
+ clause.eq('foreignEntityDone', false),
+ clause.eq('foreignEntityIncludesMe', true)
+ );
+ }
+
+ if (capabilities.reminders) {
+ filters.remf = clause.eq('includeReminders', true);
+ }
+
+ if (capabilities.calendar) {
+ filters.calf = clause.eq('calendarEventDone', false);
+ }
+
+ return confine(filters);
+}
+
+function noiseClause(): FacetClause {
+ return confine({
+ ef: clause.and(
+ clause.eq('emailDone', false),
+ clause.eq('emailImportance', false),
+ clause.eq('emailShared', 'exclude')
+ ),
+ });
+}
+
+function allClause(
+ capabilities: InboxQueryCapabilities,
+ userId: string | undefined
+): FacetClause {
+ const filters: FacetClause = {
+ df: documentClause([visibleEntity('documentId')], capabilities),
+ ef: visibleEntity('threadId'),
+ chanf: visibleEntity('channelId'),
+ cthf: clause.eq('channelThreadParticipantId', userId ?? NIL_UUID),
+ cf: visibleEntity('chatId'),
+ pf: visibleEntity('folderId'),
+ };
+
+ if (capabilities.foreignEntities) {
+ filters.fef = clause.and(
+ clause.eq('foreignEntitySource', 'github_pull_request'),
+ clause.eq('foreignEntityIncludesMe', true)
+ );
+ }
+
+ return confine(filters);
+}
+
+function remindersClause(): FacetClause {
+ return confine({
+ remf: clause.and(
+ clause.eq('includeReminders', true),
+ clause.eq('reminderCompleted', false),
+ clause.eq('reminderFired', false)
+ ),
+ });
+}
+
+function tabClause(
+ tab: InboxTab,
+ capabilities: InboxQueryCapabilities,
+ now: Date,
+ userId: string | undefined
+): FacetClause {
+ return match(tab)
+ .with('signal', () => signalClause(capabilities, now, userId))
+ .with('noise', noiseClause)
+ .with('all', () => allClause(capabilities, userId))
+ .with('reminders', remindersClause)
+ .exhaustive();
+}
+
+export type InboxViewContext = {
+ tab: InboxTab;
+ facets: FacetSelection;
+ facetContext: InboxFacetContext;
+ capabilities: InboxQueryCapabilities;
+ userId: string | undefined;
+};
+
+/** Builds the heterogeneous Soup AST for the composable Inbox view. */
+export function buildInboxQuery(
+ context: InboxViewContext,
+ options: { now?: Date } = {}
+): SoupAstItemsQueryArgs {
+ const base = compileClause(
+ tabClause(
+ context.tab,
+ context.capabilities,
+ options.now ?? new Date(),
+ context.userId
+ )
+ );
+ const refinements = compileFacets(
+ context.facets,
+ INBOX_FACETS,
+ context.facetContext
+ );
+ const body: SoupAstBody = mergeAst(base, refinements);
+
+ if (context.tab === 'signal' || context.tab === 'noise') {
+ body.emailView = 'inbox';
+ } else if (context.tab === 'all') {
+ body.emailView = 'all';
+ }
+
+ return {
+ params: {
+ expand: true,
+ limit: 100,
+ sort_method: 'updated_at',
+ sort_direction: context.tab === 'reminders' ? 'asc' : 'desc',
+ },
+ body,
+ };
+}
diff --git a/apps/web/src/features/inbox-view/queries/inbox-results.ts b/apps/web/src/features/inbox-view/queries/inbox-results.ts
new file mode 100644
index 0000000000..a4c83470a9
--- /dev/null
+++ b/apps/web/src/features/inbox-view/queries/inbox-results.ts
@@ -0,0 +1,20 @@
+import {
+ dateBucket,
+ groupSoupEntities,
+ type SoupGroup,
+} from '@app/features/soup/collection';
+import type { EntityData, WithNotification } from '@entity';
+
+export const inboxSortTimestamp = (entity: EntityData) =>
+ entity.sortTs ?? entity.updatedAt ?? entity.createdAt;
+
+export function groupInboxEntitiesByDate(
+ entities: WithNotification<EntityData>[],
+ now = new Date()
+): SoupGroup<WithNotification<EntityData>>[] {
+ return groupSoupEntities(entities, {
+ getGroupId: (entity) => dateBucket(inboxSortTimestamp(entity), now).key,
+ getGroupLabel: (_groupId, firstEntity) =>
+ dateBucket(inboxSortTimestamp(firstEntity), now).label,
+ });
+}
diff --git a/apps/web/src/features/inbox-view/queries/inbox-search.ts b/apps/web/src/features/inbox-view/queries/inbox-search.ts
new file mode 100644
index 0000000000..6bfb564c89
--- /dev/null
+++ b/apps/web/src/features/inbox-view/queries/inbox-search.ts
@@ -0,0 +1,228 @@
+import {
+ type FacetSelection,
+ NIL_UUID,
+ type SoupSearchRequest,
+} from '@app/features/soup';
+import type { SearchSoupQueryArgs } from '@queries/soup/search';
+import type {
+ EntityFilters,
+ NotificationFilters,
+} from '@service-search/generated/models';
+import type { InboxTab, InboxTypeFilter } from '../types';
+import type { InboxQueryCapabilities, InboxViewContext } from './inbox-query';
+
+const tabTypes: Record<InboxTab, ReadonlySet<InboxTypeFilter>> = {
+ signal: new Set([
+ 'documents',
+ 'tasks',
+ 'email',
+ 'channels',
+ 'agents',
+ 'projects',
+ 'github',
+ 'reminders',
+ 'calendar',
+ ]),
+ noise: new Set(['email']),
+ all: new Set([
+ 'documents',
+ 'tasks',
+ 'email',
+ 'channels',
+ 'agents',
+ 'projects',
+ 'github',
+ ]),
+ reminders: new Set(['reminders']),
+};
+
+function readFilter(
+ selection: FacetSelection
+): NotificationFilters | undefined {
+ const active = selection.read ?? [];
+ if (active.length !== 1) return undefined;
+ if (active[0] === 'read') return { seen: true };
+ if (active[0] === 'unread') return { seen: false };
+
+ return undefined;
+}
+
+function resolveTypes(
+ tab: InboxTab,
+ selection: FacetSelection,
+ capabilities: InboxQueryCapabilities
+): ReadonlySet<InboxTypeFilter> {
+ const selected = new Set(selection.type ?? []);
+ const requested =
+ selected.size === 0
+ ? tabTypes[tab]
+ : new Set([...tabTypes[tab]].filter((type) => selected.has(type)));
+
+ return new Set(
+ [...requested].filter((type) => {
+ if (type === 'calendar') return capabilities.calendar;
+ if (type === 'github') return capabilities.foreignEntities;
+ if (type === 'reminders') return capabilities.reminders;
+ return true;
+ })
+ );
+}
+
+/** Mirrors Inbox tab/type/read semantics for service-backed search. */
+export function buildInboxSearchRequest(
+ context: InboxViewContext,
+ search: SoupSearchRequest
+): SearchSoupQueryArgs {
+ const types = resolveTypes(context.tab, context.facets, context.capabilities);
+ const notification = readFilter(context.facets);
+
+ const filtersIncompleteEntities =
+ context.tab === 'signal' || context.tab === 'noise';
+
+ const notificationFilters: NotificationFilters = {};
+
+ if (filtersIncompleteEntities) {
+ notificationFilters.done = false;
+ }
+
+ if (notification?.seen !== undefined) {
+ notificationFilters.seen = notification.seen;
+ }
+
+ const documentTypes = [...types].filter(
+ (type) => type === 'documents' || type === 'tasks'
+ );
+
+ const hasNotificationFilter =
+ filtersIncompleteEntities || notification !== undefined;
+
+ const filters: EntityFilters = {
+ calendar_event_filters: { calendar_event_ids: [NIL_UUID] },
+ call_filters: { call_ids: [NIL_UUID] },
+ channel_filters: { channel_ids: [NIL_UUID] },
+ channel_thread_filters: { thread_ids: [NIL_UUID] },
+ chat_filters: { chat_ids: [NIL_UUID] },
+ crm_company_filters: { company_ids: [NIL_UUID] },
+ document_filters: { document_ids: [NIL_UUID] },
+ email_filters: { email_thread_ids: [NIL_UUID] },
+ foreign_entity_filters: { ids: [NIL_UUID] },
+ project_filters: { project_ids: [NIL_UUID] },
+ reminder_filters: { ids: [NIL_UUID] },
+ };
+
+ if (types.has('calendar')) {
+ filters.calendar_event_filters = {};
+ }
+
+ if (types.has('channels')) {
+ const channelFilters: NonNullable<EntityFilters['channel_filters']> = {};
+
+ if (context.tab === 'signal') {
+ channelFilters.is_participant = true;
+ }
+
+ if (hasNotificationFilter) {
+ channelFilters.notification_filters = notificationFilters;
+ }
+
+ filters.channel_filters = channelFilters;
+ }
+
+ if (types.has('channels')) {
+ filters.channel_thread_filters = {
+ participant_ids: [context.userId ?? NIL_UUID],
+ };
+ }
+
+ if (types.has('agents')) {
+ const chatFilters: NonNullable<EntityFilters['chat_filters']> = {};
+
+ if (hasNotificationFilter) {
+ chatFilters.notification_filters = notificationFilters;
+ }
+
+ filters.chat_filters = chatFilters;
+ }
+
+ if (documentTypes.length > 0) {
+ const documentFilters: NonNullable<EntityFilters['document_filters']> = {};
+
+ if (documentTypes.length === 1 && documentTypes[0] === 'tasks') {
+ documentFilters.sub_types = ['task'];
+ }
+
+ if (hasNotificationFilter) {
+ documentFilters.notification_filters = notificationFilters;
+ }
+
+ filters.document_filters = documentFilters;
+ }
+
+ if (types.has('email')) {
+ const emailFilters: NonNullable<EntityFilters['email_filters']> = {
+ shared: 'exclude',
+ };
+
+ if (context.tab === 'signal') {
+ emailFilters.importance = true;
+ }
+
+ if (context.tab === 'noise') {
+ emailFilters.importance = false;
+ }
+
+ if (hasNotificationFilter) {
+ emailFilters.notification_filters = notificationFilters;
+ }
+
+ filters.email_filters = emailFilters;
+ }
+
+ if (types.has('github')) {
+ const foreignEntityFilters: NonNullable<
+ EntityFilters['foreign_entity_filters']
+ > = {
+ foreign_entity_sources: ['github_pull_request'],
+ includes_me: true,
+ };
+
+ if (hasNotificationFilter) {
+ foreignEntityFilters.notification_filters = notificationFilters;
+ }
+
+ filters.foreign_entity_filters = foreignEntityFilters;
+ }
+
+ if (types.has('projects')) {
+ const projectFilters: NonNullable<EntityFilters['project_filters']> = {};
+
+ if (hasNotificationFilter) {
+ projectFilters.notification_filters = notificationFilters;
+ }
+
+ filters.project_filters = projectFilters;
+ }
+
+ if (types.has('reminders')) {
+ const reminderFilters: NonNullable<EntityFilters['reminder_filters']> = {
+ include: true,
+ };
+
+ if (context.tab === 'reminders') {
+ reminderFilters.completed = false;
+ reminderFilters.fired = false;
+ }
+
+ filters.reminder_filters = reminderFilters;
+ }
+
+ return {
+ params: { cursor: null, page_size: 100 },
+ body: {
+ query: search.query,
+ match_type: search.matchType,
+ search_on: 'name_content',
+ filters,
+ },
+ };
+}
diff --git a/apps/web/src/features/inbox-view/queries/use-inbox-query.ts b/apps/web/src/features/inbox-view/queries/use-inbox-query.ts
new file mode 100644
index 0000000000..53639dbbad
--- /dev/null
+++ b/apps/web/src/features/inbox-view/queries/use-inbox-query.ts
@@ -0,0 +1,304 @@
+import type { ListDataSource } from '@app/components/list';
+import {
+ buildFlatSoupRows,
+ buildGroupedSoupRows,
+ createSearchState,
+ createSoupLoadMoreRow,
+ type SoupRow,
+ testFacets,
+ useSearchContext,
+} from '@app/features/soup';
+import { withEntityNotifications } from '@app/features/soup/entity-notifications';
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
+import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
+import {
+ ENABLE_CALENDAR_UI,
+ ENABLE_REMINDERS,
+ ENABLE_SNIPPETS,
+ ENABLE_SUPPORTED_SOUP_FOREIGN_ENTITIES_FLAG,
+ ENABLE_SUPPORTED_SOUP_FOREIGN_ENTITIES_OVERRIDE,
+} from '@core/constant/featureFlags';
+import { useUserId } from '@core/context/user';
+import {
+ type EntityData,
+ isSnippetEntity,
+ type WithNotification,
+} from '@entity';
+import type { NotificationSource } from '@notifications';
+import { useSoupAstItemsQuery } from '@queries/soup/items';
+import { startOfDay, subWeeks } from 'date-fns';
+import { createMemo } from 'solid-js';
+import { match } from 'ts-pattern';
+import {
+ explicitNoiseFilter,
+ noiseFilter,
+ signalFilter,
+} from '../../next-soup/filters/inbox-filters';
+import {
+ notDoneFilter,
+ scheduledRemindersFilter,
+} from '../../next-soup/filters/predicates';
+import { INBOX_FACETS, type InboxFacetContext } from '../inbox-facets';
+import type { InboxTab, InboxViewState } from '../types';
+import {
+ buildInboxQuery,
+ type InboxQueryCapabilities,
+ type InboxViewContext,
+} from './inbox-query';
+import { groupInboxEntitiesByDate, inboxSortTimestamp } from './inbox-results';
+import { buildInboxSearchRequest } from './inbox-search';
+
+export type InboxDataSourceItem = SoupRow<WithNotification<EntityData>>;
+
+export type InboxDataSource = ListDataSource<InboxDataSourceItem>;
+
+export type InboxDataSourceInput = Pick<
+ InboxViewState,
+ 'tab' | 'search' | 'groupBy' | 'facets'
+>;
+
+function matchesCapabilities(
+ entity: EntityData,
+ capabilities: InboxQueryCapabilities
+): boolean {
+ if (entity.type === 'calendar_event') return capabilities.calendar;
+ if (entity.type === 'foreign') return capabilities.foreignEntities;
+ if (entity.type === 'reminder') return capabilities.reminders;
+ if (isSnippetEntity(entity)) return capabilities.snippets;
+
+ return true;
+}
+
+function matchesTab(
+ entity: WithNotification<EntityData>,
+ tab: InboxTab,
+ source: NotificationSource
+): boolean {
+ return match(tab)
+ .with('signal', () => {
+ if (!signalFilter(entity) || !notDoneFilter(source)(entity)) return false;
+
+ if (
+ entity.type !== 'document' &&
+ entity.type !== 'email' &&
+ entity.type !== 'chat' &&
+ entity.type !== 'project'
+ ) {
+ return true;
+ }
+
+ return (
+ new Date(inboxSortTimestamp(entity) ?? 0).getTime() >=
+ subWeeks(startOfDay(new Date()), 2).getTime()
+ );
+ })
+ .with('noise', () => noiseFilter(entity) && notDoneFilter(source)(entity))
+ .with('all', () => !explicitNoiseFilter(entity))
+ .with('reminders', () => scheduledRemindersFilter(entity))
+ .exhaustive();
+}
+
+export function useInboxDataSource(
+ state: InboxDataSourceInput
+): InboxDataSource {
+ const notificationSource = useGlobalNotificationSource();
+ const userId = useUserId();
+
+ const foreignEntities = useFeatureFlag(
+ ENABLE_SUPPORTED_SOUP_FOREIGN_ENTITIES_FLAG,
+ { enabledOverride: ENABLE_SUPPORTED_SOUP_FOREIGN_ENTITIES_OVERRIDE }
+ );
+
+ const facetContext = (): InboxFacetContext => ({ notificationSource });
+
+ const capabilities = (): InboxQueryCapabilities => ({
+ calendar: ENABLE_CALENDAR_UI(),
+ foreignEntities: foreignEntities().enabled,
+ reminders: ENABLE_REMINDERS(),
+ snippets: ENABLE_SNIPPETS(),
+ });
+
+ const viewContext = createMemo(
+ (): InboxViewContext => ({
+ tab: state.tab,
+ facets: state.facets,
+ facetContext: facetContext(),
+ capabilities: capabilities(),
+ userId: userId(),
+ })
+ );
+
+ const queryArgs = createMemo(() => buildInboxQuery(viewContext()));
+
+ const query = useSoupAstItemsQuery(queryArgs, () => ({
+ enabled: true,
+ showSupportedForeignEntities: foreignEntities().enabled,
+ }));
+
+ const transformEntities = (entities: EntityData[]) => {
+ const context = viewContext();
+ return entities
+ .filter((entity) => matchesCapabilities(entity, context.capabilities))
+ .map((entity) =>
+ withEntityNotifications(entity, notificationSource, {
+ scopeChannelThreads: true,
+ })
+ )
+ .filter((entity) => matchesTab(entity, context.tab, notificationSource));
+ };
+
+ const { entityPool } = useSearchContext();
+ const localPool = createMemo(() => {
+ if (!state.search.trim()) return [];
+ const pool = entityPool();
+ const matchingIds = new Set(
+ transformEntities(pool.map((item) => item.data)).map(
+ (entity) => entity.id
+ )
+ );
+ return pool.filter((item) => matchingIds.has(item.data.id));
+ });
+
+ const search = createSearchState({
+ text: () => state.search,
+ localPool,
+ buildRequest: (request) => buildInboxSearchRequest(viewContext(), request),
+ });
+
+ const rawEntities = createMemo<EntityData[]>((previous) => {
+ if (!search.isSearching()) {
+ if (query.isLoading) return previous;
+
+ return query.data?.entities ?? [];
+ }
+
+ const results = search.data();
+ if (
+ results.length === 0 &&
+ previous.length > 0 &&
+ search.isLocalSearchSettling()
+ ) {
+ return previous;
+ }
+ return results;
+ }, []);
+
+ // Keep rows admitted after they transition from unread to read. Changing the
+ // tab or read filter starts a new admission scope.
+ const entities = createMemo<{
+ readScope: string;
+ admittedIds: Set<string>;
+ items: WithNotification<EntityData>[];
+ }>(
+ (previous) => {
+ const context = viewContext();
+ const transformed = transformEntities(rawEntities());
+ const activeReadFacets = context.facets.read ?? [];
+ const readScope = `${context.tab}:${activeReadFacets.join(',')}`;
+ const admittedIds =
+ previous.readScope === readScope
+ ? new Set(previous.admittedIds)
+ : new Set<string>();
+
+ if (activeReadFacets.length === 0) {
+ for (const entity of transformed) admittedIds.add(entity.id);
+ } else {
+ const readSelection = { read: activeReadFacets };
+ for (const entity of transformed) {
+ if (
+ testFacets(
+ readSelection,
+ INBOX_FACETS,
+ entity,
+ context.facetContext
+ )
+ ) {
+ admittedIds.add(entity.id);
+ }
+ }
+ }
+
+ const selection = { ...context.facets, read: [] };
+ return {
+ readScope,
+ admittedIds,
+ items: transformed.filter(
+ (entity) =>
+ admittedIds.has(entity.id) &&
+ testFacets(selection, INBOX_FACETS, entity, context.facetContext)
+ ),
+ };
+ },
+ { readScope: '', admittedIds: new Set<string>(), items: [] }
+ );
+
+ const usesServiceSearch = search.usesServiceSearch;
+
+ const hasMore = () => {
+ if (usesServiceSearch()) return search.hasNextPage();
+ return query.hasNextPage;
+ };
+
+ const isLoadingMore = () => {
+ if (usesServiceSearch()) return search.isFetchingNextPage();
+ return query.isFetchingNextPage;
+ };
+
+ const items = createMemo<InboxDataSourceItem[]>(() => {
+ let result: InboxDataSourceItem[];
+ if (state.groupBy === 'date' && !search.isSearching()) {
+ result = buildGroupedSoupRows(groupInboxEntitiesByDate(entities().items));
+ } else {
+ result = buildFlatSoupRows(entities().items);
+ }
+
+ if (hasMore()) {
+ result.push(
+ createSoupLoadMoreRow({
+ scopeId: `inbox:${state.tab}`,
+ isLoading: isLoadingMore(),
+ })
+ );
+ }
+
+ return result;
+ });
+
+ const isLoading = () => {
+ if (!search.isSearching()) {
+ return query.isLoading && rawEntities().length === 0;
+ }
+ if (entities().items.length > 0) return false;
+ if (usesServiceSearch()) return search.isLoading();
+ return query.isLoading;
+ };
+
+ return {
+ items,
+ isLoading,
+ isFetching: () => {
+ if (search.isSettling()) return true;
+ return usesServiceSearch() ? search.isFetching() : query.isFetching;
+ },
+ error: () => {
+ if (!usesServiceSearch()) return query.error ?? undefined;
+ return search.error();
+ },
+ hasMore,
+ isLoadingMore,
+ loadMore: async () => {
+ if (usesServiceSearch()) {
+ await search.fetchNextPage();
+ return;
+ }
+ await query.fetchNextPage();
+ },
+ refresh: async () => {
+ if (usesServiceSearch()) {
+ await search.refetch();
+ return;
+ }
+ await query.refresh();
+ },
+ } satisfies InboxDataSource;
+}
diff --git a/apps/web/src/features/inbox-view/types.ts b/apps/web/src/features/inbox-view/types.ts
new file mode 100644
index 0000000000..d118e270d0
--- /dev/null
+++ b/apps/web/src/features/inbox-view/types.ts
@@ -0,0 +1,27 @@
+import type { FacetSelection } from '@app/features/soup/filters/facets/types';
+
+export type InboxTab = 'signal' | 'noise' | 'all' | 'reminders';
+
+export type InboxGroupBy = 'date' | 'type' | 'none';
+
+export type InboxViewState = {
+ tab: InboxTab;
+ search: string;
+ groupBy: InboxGroupBy;
+ facets: FacetSelection;
+};
+
+export type InboxViewStateOptions = Partial<InboxViewState>;
+
+export type InboxTypeFilter =
+ | 'documents'
+ | 'tasks'
+ | 'email'
+ | 'channels'
+ | 'agents'
+ | 'projects'
+ | 'github'
+ | 'reminders'
+ | 'calendar';
+
+export type InboxReadFilter = 'unread' | 'read';
diff --git a/apps/web/src/features/inbox-view/use-inbox-preview.ts b/apps/web/src/features/inbox-view/use-inbox-preview.ts
new file mode 100644
index 0000000000..f6fb88fdfb
--- /dev/null
+++ b/apps/web/src/features/inbox-view/use-inbox-preview.ts
@@ -0,0 +1,63 @@
+import type { ListController } from '@app/components/list';
+import type { SplitHandle } from '@components/app/split-layout/layoutManager';
+import type { EntityData } from '@entity/types/entity';
+import type { WithNotification } from '@entity/types/notification';
+import { debounce } from '@solid-primitives/scheduled';
+import { createEffect, onCleanup } from 'solid-js';
+import type { InboxDataSourceItem } from './queries/use-inbox-query';
+
+export type InboxPreviewController = {
+ request: (entity: WithNotification<EntityData>) => void;
+ cancel: () => void;
+};
+
+export type UseInboxPreviewOptions = {
+ controller: Pick<ListController<InboxDataSourceItem>, 'focus'>;
+ handle: Pick<
+ SplitHandle,
+ 'canEngagePreview' | 'engagePreview' | 'isControllerSplit' | 'isViewerSplit'
+ >;
+ onPreview: (entity: WithNotification<EntityData>) => void;
+};
+
+export function useInboxPreview(
+ options: UseInboxPreviewOptions
+): InboxPreviewController {
+ const openPreviewDebounced = debounce(
+ (entity: WithNotification<EntityData>) => {
+ if (!options.handle.isControllerSplit()) return;
+
+ const row = options.controller.focus.result()?.item;
+ if (row?.kind !== 'entity' || row.entity.id !== entity.id) return;
+
+ options.onPreview(entity);
+ },
+ 150
+ );
+ onCleanup(() => openPreviewDebounced.clear());
+
+ let initialPreviewResolved = false;
+ createEffect(() => {
+ if (initialPreviewResolved) return;
+ if (options.handle.isViewerSplit()) {
+ initialPreviewResolved = true;
+ return;
+ }
+ if (!options.handle.canEngagePreview()) return;
+
+ options.controller.focus.clear({ reason: 'programmatic' });
+ options.handle.engagePreview();
+ if (options.handle.isControllerSplit()) {
+ initialPreviewResolved = true;
+ }
+ });
+
+ return {
+ request: (entity) => {
+ if (!options.handle.isControllerSplit()) return;
+
+ openPreviewDebounced(entity);
+ },
+ cancel: openPreviewDebounced.clear,
+ };
+}
diff --git a/apps/web/src/features/next-soup/soup-view/views/inbox/InboxCard.tsx b/apps/web/src/features/next-soup/soup-view/views/inbox/InboxCard.tsx
index 167c16c961..686ccdf864 100644
--- a/apps/web/src/features/next-soup/soup-view/views/inbox/InboxCard.tsx
+++ b/apps/web/src/features/next-soup/soup-view/views/inbox/InboxCard.tsx
@@ -24,6 +24,8 @@ interface RootProps extends SlotProps {
selected?: boolean;
highlighted?: boolean;
onClick?: (event: MouseEvent) => void;
+ /** Set false when a parent list owns keyboard focus and activation. */
+ focusable?: boolean;
}
function Root(props: RootProps): JSX.Element {
@@ -61,8 +63,8 @@ function Root(props: RootProps): JSX.Element {
props.class
)}
data-unread={props.dimmed ? undefined : true}
- role={interactive() ? 'button' : undefined}
- tabIndex={interactive() ? 0 : undefined}
+ role={interactive() && props.focusable !== false ? 'button' : undefined}
+ tabIndex={interactive() && props.focusable !== false ? 0 : undefined}
onClick={props.onClick}
onKeyDown={onKeyDown}
>
diff --git a/apps/web/src/features/next-soup/soup-view/views/inbox/InboxListEntity.tsx b/apps/web/src/features/next-soup/soup-view/views/inbox/InboxListEntity.tsx
index 9ae491e122..50c683135f 100644
--- a/apps/web/src/features/next-soup/soup-view/views/inbox/InboxListEntity.tsx
+++ b/apps/web/src/features/next-soup/soup-view/views/inbox/InboxListEntity.tsx
@@ -1,3 +1,4 @@
+import '@entity/composed/ListEntity.css';
import { useChannelsContext } from '@core/context/channels';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { MaybeEntityRow, MultiSelectCheckbox, UnreadIndicator } from '@entity';
@@ -18,7 +19,16 @@ import { scopeThreadNotifications } from './utils';
* from the focused row (which is what the preview shows).
*
*/
-export function InboxListEntity(props: BaseListEntityProps) {
+type InboxListEntityProps = BaseListEntityProps & {
+ /** Classes applied to the outer list-row wrapper. */
+ class?: string;
+ /** Classes applied to the rendered Inbox card. */
+ cardClass?: string;
+ focusable?: boolean;
+ occurrenceKey?: string;
+};
+
+export function InboxListEntity(props: InboxListEntityProps) {
const channels = useChannelsContext();
// A channel_thread soup entity comes back with a generic name ("Channel
@@ -41,16 +51,22 @@ export function InboxListEntity(props: BaseListEntityProps) {
// NarrowInboxLayout.
class={cn(
'group/inbox-item soup-list-entity relative mx-(--soup-row-gutter)',
- SOUP_ROW_CLASS.card
+ SOUP_ROW_CLASS.card,
+ props.class
)}
ref={props.ref}
onMouseMove={props.onMouseMove}
>
- <MaybeEntityRow entityId={props.entity.id} config={props.entityRowConfig}>
+ <MaybeEntityRow
+ entityId={props.occurrenceKey ?? props.entity.id}
+ config={props.entityRowConfig}
+ >
<InboxCardLayout
+ class={props.cardClass}
item={item()}
selected={props.checked}
highlighted={props.highlighted}
+ focusable={props.focusable}
onClick={props.onClick}
/>
</MaybeEntityRow>
diff --git a/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx b/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx
index 39aef94096..401d8efe59 100644
--- a/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx
+++ b/apps/web/src/features/next-soup/soup-view/views/inbox/inbox-card-layouts.tsx
@@ -66,9 +66,13 @@ import {
export interface InboxCardLayoutProps {
/** The already-derived item to render. */
item: InboxCardDisplayItem;
+ /** Optional root-card styling for alternate list compositions. */
+ class?: string;
selected?: boolean;
highlighted?: boolean;
onClick?: (event: MouseEvent) => void;
+ /** Set false when a parent list owns keyboard focus and activation. */
+ focusable?: boolean;
}
/** Glyph size inside the card's avatar bubble — grows with the circle on
@@ -507,9 +511,11 @@ const githubAction = (notification?: Notification): string => {
*/
function BaseCard(props: {
item: InboxCardDisplayItem;
+ class?: string;
selected?: boolean;
highlighted?: boolean;
onClick?: (event: MouseEvent) => void;
+ focusable?: boolean;
/** Contents of the avatar bubble (glyph or avatar); the circle is ours. */
icon: JSX.Element;
/**
@@ -524,6 +530,8 @@ function BaseCard(props: {
}) {
return (
<InboxCard.Root
+ class={props.class}
+ focusable={props.focusable}
dimmed={!props.item.unread}
selected={props.selected}
highlighted={props.highlighted}
@@ -690,10 +698,7 @@ export function ChannelCardLayout(props: InboxCardLayoutProps) {
return (
<BaseCard
- item={props.item}
- selected={props.selected}
- highlighted={props.highlighted}
- onClick={props.onClick}
+ {...props}
icon={
<Show
when={!isDM()}
@@ -751,10 +756,7 @@ export function ChannelMessageCardLayout(props: InboxCardLayoutProps) {
// its three-line neighbors.
return (
<BaseCard
- item={props.item}
- selected={props.selected}
- highlighted={props.highlighted}
- onClick={props.onClick}
+ {...props}
icon={<ActionBubble tag={getNotificationTag(props.item.notification)} />}
title={text().title}
>
@@ -870,6 +872,8 @@ export function ChannelThreadCardLayout(props: InboxCardLayoutProps) {
// the quoted-original block stacked beneath.
return (
<InboxCard.Root
+ class={props.class}
+ focusable={props.focusable}
dimmed={!props.item.unread}
selected={props.selected}
highlighted={props.highlighted}
@@ -1005,10 +1009,7 @@ export function DocumentCardLayout(props: InboxCardLayoutProps) {
return (
<BaseCard
- item={props.item}
- selected={props.selected}
- highlighted={props.highlighted}
- onClick={props.onClick}
+ {...props}
icon={
<Show
when={props.item.notification}
@@ -1072,10 +1073,7 @@ export function TaskCardLayout(props: InboxCardLayoutProps) {
return (
<BaseCard
- item={props.item}
- selected={props.selected}
- highlighted={props.highlighted}
- onClick={props.onClick}
+ {...props}
icon={
<Show
when={props.item.notification}
@@ -1120,10 +1118,7 @@ export function AiCardLayout(props: InboxCardLayoutProps) {
// two-line clamp of the response summary with its height reserved.
return (
<BaseCard
- item={props.item}
- selected={props.selected}
- highlighted={props.highlighted}
- onClick={props.onClick}
+ {...props}
icon={
<Show
when={props.item.notification}
@@ -1178,10 +1173,7 @@ export function EmailCardLayout(props: InboxCardLayoutProps) {
return (
<BaseCard
- item={props.item}
- selected={props.selected}
- highlighted={props.highlighted}
- onClick={props.onClick}
+ {...props}
icon={<ActionBubble tag="new_email" />}
titleLeading={
<Show when={text().isDraft}>
@@ -1264,10 +1256,7 @@ export function GithubCardLayout(props: InboxCardLayoutProps) {
return (
<BaseCard
- item={props.item}
- selected={props.selected}
- highlighted={props.highlighted}
- onClick={props.onClick}
+ {...props}
icon={
<Show
when={
@@ -1363,10 +1352,7 @@ export function CallCardLayout(props: InboxCardLayoutProps) {
return (
<BaseCard
- item={props.item}
- selected={props.selected}
- highlighted={props.highlighted}
- onClick={props.onClick}
+ {...props}
icon={
<EntityIcon
class={AVATAR_GLYPH_CLASS}
@@ -1435,10 +1421,7 @@ export function CalendarEventCardLayout(props: InboxCardLayoutProps) {
return (
<BaseCard
- item={props.item}
- selected={props.selected}
- highlighted={props.highlighted}
- onClick={props.onClick}
+ {...props}
icon={<CalendarBlankIcon class={AVATAR_GLYPH_CLASS} />}
title={props.item.entity.name || '(No title)'}
>
@@ -1481,10 +1464,7 @@ export function ReminderCardLayout(props: InboxCardLayoutProps) {
return (
<BaseCard
- item={props.item}
- selected={props.selected}
- highlighted={props.highlighted}
- onClick={props.onClick}
+ {...props}
// Always the bell, never the referenced entity's icon: the row is a
// reminder first, and the thing it points at is named right below.
icon={<BellSimpleIcon class={AVATAR_GLYPH_CLASS} />}
@@ -1548,10 +1528,7 @@ export function GenericCardLayout(props: InboxCardLayoutProps) {
return (
<BaseCard
- item={props.item}
- selected={props.selected}
- highlighted={props.highlighted}
- onClick={props.onClick}
+ {...props}
icon={
<EntityIcon
class={AVATAR_GLYPH_CLASS}
diff --git a/apps/web/src/features/next-soup/utils.test.ts b/apps/web/src/features/next-soup/utils.test.ts
index 1e727a6e90..79fb8707d9 100644
--- a/apps/web/src/features/next-soup/utils.test.ts
+++ b/apps/web/src/features/next-soup/utils.test.ts
@@ -290,6 +290,47 @@ describe('calendar block navigation', () => {
expect.objectContaining({ eventId: 'event-1' })
);
});
+
+ it('retargets a calendar preview without activating its viewer', async () => {
+ const activate = vi.fn();
+ const openWithSplit = vi.fn();
+ const goToLocationFromParams = vi.fn();
+ const getBlockHandle = vi.fn(async () => ({ goToLocationFromParams }));
+ const controller = {
+ isControllerSplit: () => true,
+ viewerId: () => 'viewer-1',
+ } as unknown as SplitHandle;
+
+ setGlobalSplitManager({
+ activeSplit: vi.fn(),
+ getOrchestrator: vi.fn(() => ({ getBlockHandle })),
+ getSplitByContent: vi.fn(() => ({
+ id: 'viewer-1',
+ activate,
+ })),
+ openWithSplit,
+ } as unknown as SplitManager);
+
+ await openEntityInSplitFromUnifiedList(
+ {
+ type: 'calendar_event',
+ id: 'event-2',
+ } as unknown as EntityData,
+ { splitHandle: controller, mergeHistory: true }
+ );
+
+ expect(activate).not.toHaveBeenCalled();
+ expect(openWithSplit).toHaveBeenCalledWith(
+ expect.objectContaining({
+ type: 'calendar',
+ id: 'view',
+ }),
+ expect.objectContaining({
+ handle: controller,
+ mergeHistory: true,
+ })
+ );
+ });
});
describe('preview history source', () => {
diff --git a/apps/web/src/features/next-soup/utils.ts b/apps/web/src/features/next-soup/utils.ts
index 1e7bfe2a8d..45b7e33266 100644
--- a/apps/web/src/features/next-soup/utils.ts
+++ b/apps/web/src/features/next-soup/utils.ts
@@ -650,7 +650,12 @@ export const openEntityInSplitFromUnifiedList = async (
'calendar',
CALENDAR_BLOCK_ID
);
- if (existing) {
+ const existingIsViewer =
+ existing &&
+ splitHandle?.isControllerSplit() &&
+ splitHandle.viewerId() === existing.id;
+
+ if (existing && !existingIsViewer) {
existing.activate();
} else {
splitManager.openWithSplit(
@@ -659,7 +664,9 @@ export const openEntityInSplitFromUnifiedList = async (
activate: true,
referredFrom: null,
preferNewSplit: openInNewSplit,
+ replacePreview,
handle: splitHandle,
+ mergeHistory,
}
);
}
diff --git a/apps/web/src/features/soup/collection/index.ts b/apps/web/src/features/soup/collection/index.ts
index 10b279398c..5caab1d30d 100644
--- a/apps/web/src/features/soup/collection/index.ts
+++ b/apps/web/src/features/soup/collection/index.ts
@@ -34,3 +34,8 @@ export type {
SoupRow,
SoupSectionHeaderRow,
} from './types';
+export {
+ type SoupListNavigationOpenOptions,
+ type UseSoupListNavigationHotkeysOptions,
+ useSoupListNavigationHotkeys,
+} from './useSoupListNavigationHotkeys';
diff --git a/apps/web/src/components/app/split-layout/useSplitListNavigationHotkeys.ts b/apps/web/src/features/soup/collection/useSoupListNavigationHotkeys.ts
similarity index 53%
rename from apps/web/src/components/app/split-layout/useSplitListNavigationHotkeys.ts
rename to apps/web/src/features/soup/collection/useSoupListNavigationHotkeys.ts
index 442bd8f46e..51d32bf0cc 100644
--- a/apps/web/src/components/app/split-layout/useSplitListNavigationHotkeys.ts
+++ b/apps/web/src/features/soup/collection/useSoupListNavigationHotkeys.ts
@@ -1,68 +1,63 @@
+import type { ListController, ListDataSource } from '@app/components/list';
import { isListViewID, type ListView } from '@app/constants/list-views';
+import type { SplitHandle } from '@components/app/split-layout/layoutManager';
import { registerHotkey } from '@core/hotkey/hotkeys';
import type { EntityData } from '@entity';
-import type { SplitListBinding } from './context';
-import type { SplitHandle } from './layoutManager';
+import type { SoupRow } from './types';
const LOAD_MORE_DISTANCE_FROM_END = 3;
-export type SplitListOpenEntityOptions = {
+export type SoupListNavigationOpenOptions = {
mergeHistory: true;
referredFrom: ListView;
};
-export type UseSplitListNavigationHotkeysOptions = {
+export type UseSoupListNavigationHotkeysOptions<TEntity extends EntityData> = {
splitHotkeyScope: string;
- list: () => SplitListBinding | undefined;
+ viewId: ListView;
+ dataSource: ListDataSource<SoupRow<TEntity>>;
+ controller: Pick<ListController<SoupRow<TEntity>>, 'navigate' | 'selection'>;
handle: SplitHandle;
openEntityInSplit: (
- entity: EntityData,
- options: SplitListOpenEntityOptions
+ entity: TEntity,
+ options: SoupListNavigationOpenOptions
) => void;
};
-type ConfiguredSplitListBinding = SplitListBinding & {
- viewId: ListView;
-};
-
-export function useSplitListNavigationHotkeys(
- options: UseSplitListNavigationHotkeysOptions
+export function useSoupListNavigationHotkeys<TEntity extends EntityData>(
+ options: UseSoupListNavigationHotkeysOptions<TEntity>
) {
- const canNavigate = (
- list: SplitListBinding | undefined
- ): list is ConfiguredSplitListBinding => {
+ const canNavigate = () => {
const content = options.handle.content();
return (
- list?.viewId !== undefined &&
(content.type !== 'component' || !isListViewID(content.id)) &&
- options.handle.referredFrom() === list.viewId
+ options.handle.referredFrom() === options.viewId
);
};
const step = (direction: -1 | 1) => {
- const list = options.list();
- if (!canNavigate(list)) return false;
+ if (!canNavigate()) return false;
- const rows = list.dataSource.items();
- const next = list.controller.navigate.by(direction, {
+ const rows = options.dataSource.items();
+ const next = options.controller.navigate.by(direction, {
isNavigable: (row) => row.kind === 'entity',
});
if (next?.item.kind === 'entity') {
- list.controller.selection.setAnchor(next.key);
+ options.controller.selection.setAnchor(next.key);
options.openEntityInSplit(next.item.entity, {
mergeHistory: true,
- referredFrom: list.viewId,
+ referredFrom: options.viewId,
});
}
if (
direction === 1 &&
(!next || rows.length - next.index - 1 <= LOAD_MORE_DISTANCE_FROM_END) &&
- list.dataSource.hasMore() &&
- !list.dataSource.isLoadingMore()
+ options.dataSource.hasMore() &&
+ !options.dataSource.isLoadingMore()
) {
- void list.dataSource.loadMore();
+ void options.dataSource.loadMore();
}
return true;
@@ -72,7 +67,7 @@ export function useSplitListNavigationHotkeys(
scopeId: options.splitHotkeyScope,
hotkey: 'j',
description: 'Move down',
- condition: () => canNavigate(options.list()),
+ condition: canNavigate,
keyDownHandler: () => step(1),
registrationType: 'add',
hide: true,
@@ -82,7 +77,7 @@ export function useSplitListNavigationHotkeys(
scopeId: options.splitHotkeyScope,
hotkey: 'k',
description: 'Move up',
- condition: () => canNavigate(options.list()),
+ condition: canNavigate,
keyDownHandler: () => step(-1),
registrationType: 'add',
hide: true,
diff --git a/apps/web/src/lib/core/component/TabsInset.tsx b/apps/web/src/lib/core/component/TabsInset.tsx
index 3578f3c305..9ceaddaec3 100644
--- a/apps/web/src/lib/core/component/TabsInset.tsx
+++ b/apps/web/src/lib/core/component/TabsInset.tsx
@@ -16,6 +16,7 @@ type TabsInsetProps = {
value?: string;
defaultValue?: string;
class?: string;
+ trackClass?: string;
depth?: 0 | 1 | 2 | 3 | 4;
fullWidth?: boolean;
} & Omit<SegmentedControlRootProps, 'defaultValue'>;
@@ -27,6 +28,7 @@ export const TabsInset = (props: TabsInsetProps) => {
'defaultValue',
'disabled',
'class',
+ 'trackClass',
'depth',
'fullWidth',
]);
@@ -53,7 +55,8 @@ export const TabsInset = (props: TabsInsetProps) => {
<div
class={cn(
'relative flex items-center border border-edge-muted bg-surface rounded-lg p-0.5 has-focus-visible:ring-2 has-focus-visible:ring-accent/20',
- local.fullWidth && 'w-full'
+ local.fullWidth && 'w-full',
+ local.trackClass
)}
>
<For each={local.list}>
diff --git a/apps/web/src/lib/core/constant/featureFlags.ts b/apps/web/src/lib/core/constant/featureFlags.ts
index 85f7cfcf4c..1b23d2c122 100644
--- a/apps/web/src/lib/core/constant/featureFlags.ts
+++ b/apps/web/src/lib/core/constant/featureFlags.ts
@@ -46,6 +46,16 @@ export function resolveFeatureFlag(
*/
export const DEV_MODE_ENV = import.meta.env.MODE === 'development';
+/**
+ * Switches Inbox and Tasks from the current SoupView implementations to the
+ * new composable view implementations. Override locally with
+ * VITE_ENABLE_NEW_APP_VIEWS.
+ */
+export const ENABLE_NEW_APP_VIEWS_FLAG = 'enable-new-app-views';
+export const ENABLE_NEW_APP_VIEWS_OVERRIDE = getFeatureFlagOverride(
+ 'ENABLE_NEW_APP_VIEWS'
+);
+
/**
* This constant reflects whether the app is running in production mode with prod backend environment
*