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(inbox): render the new Inbox on mobile as the Notifications view (#6813)

dev-rb70d29f921c06
diff --git a/apps/web/src/components/app/split-layout/componentRegistry.tsx b/apps/web/src/components/app/split-layout/componentRegistry.tsx
index faba6421da..ceeec0a0a4 100644
--- a/apps/web/src/components/app/split-layout/componentRegistry.tsx
+++ b/apps/web/src/components/app/split-layout/componentRegistry.tsx
@@ -264,15 +264,11 @@ function LegacyInboxView() {
function RegisteredInboxView() {
usePageViewTracking('inbox');
- const newAppViews = useNewAppViews({
- enabledLayout: () => (isTouchDevice() ? 'legacy' : 'composable'),
- });
+ const newAppViews = useNewAppViews();
return (
- <Show when={!isTouchDevice()} fallback={<LegacyInboxView />}>
- <Show when={newAppViews.ready()} fallback={<LoadingBlock />}>
- <Show when={newAppViews.enabled()} fallback={<LegacyInboxView />}>
- <InboxView />
- </Show>
+ <Show when={newAppViews.ready()} fallback={<LoadingBlock />}>
+ <Show when={newAppViews.enabled()} fallback={<LegacyInboxView />}>
+ <InboxView />
</Show>
</Show>
);
diff --git a/apps/web/src/features/inbox-view/components/InboxDateGroupHeader.tsx b/apps/web/src/features/inbox-view/components/InboxDateGroupHeader.tsx
index 1742ac9047..ad1e2010bb 100644
--- a/apps/web/src/features/inbox-view/components/InboxDateGroupHeader.tsx
+++ b/apps/web/src/features/inbox-view/components/InboxDateGroupHeader.tsx
@@ -1,4 +1,5 @@
import type { SoupGroupHeaderRow } from '@app/features/soup';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { SOUP_ROW_CLASS } from '@entity/composed/list-entity/row-geometry';
import { cn } from '@ui';
@@ -14,8 +15,11 @@ export function InboxDateGroupHeader(props: {
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',
- 'px-4',
+ // Touch takes the legacy card-row gutters so the label starts
+ // where InboxListEntity content does; desktop keeps the Home form.
+ isTouchDevice()
+ ? 'mx-(--soup-row-gutter) w-[calc(100%-2*var(--soup-row-gutter))] pl-[calc(var(--soup-row-content-inset)-var(--soup-row-gutter))]'
+ : 'mx-0 w-full px-4',
!props.isFirst && 'pt-5'
)}
>
diff --git a/apps/web/src/features/inbox-view/components/InboxList.tsx b/apps/web/src/features/inbox-view/components/InboxList.tsx
index 9a90606627..752bbb2878 100644
--- a/apps/web/src/features/inbox-view/components/InboxList.tsx
+++ b/apps/web/src/features/inbox-view/components/InboxList.tsx
@@ -33,6 +33,7 @@ import {
type EntityData,
EntitySelectionToolbar,
isNonMemberChannelEntity,
+ ListLayoutProvider,
type WithNotification,
} from '@entity';
import { getChannelThreadName } from '@entity/utils/channel-thread-name';
@@ -56,6 +57,7 @@ import {
persistSoupNavigationTouchHighlight,
soupNavigationTouchHighlight,
} from '../../next-soup/soup-view/soup-navigation-touch-highlight';
+import { InboxListEntity } from '../../next-soup/soup-view/views/inbox/InboxListEntity';
import {
markChannelNotificationsSeenOnOpen,
markReminderSeenOnOpen,
@@ -282,7 +284,7 @@ export function InboxList(props: InboxListProps) {
};
};
- let listRoot: HTMLDivElement | undefined;
+ const [listRoot, setListRoot] = createSignal<HTMLDivElement>();
const [collapseRow, setCollapseRow] =
createSignal<(rowId: string) => Promise<void>>();
@@ -310,7 +312,7 @@ export function InboxList(props: InboxListProps) {
virtualizer()?.scrollToIndex(target.index, { align: 'nearest' });
}
- listRoot?.focus();
+ listRoot()?.focus();
},
});
@@ -346,13 +348,29 @@ export function InboxList(props: InboxListProps) {
},
});
+ const onRowClick = (rowId: string, event: MouseEvent) => {
+ if (
+ event.metaKey ||
+ event.ctrlKey ||
+ (isTouchDevice() && list.selection.count() > 0)
+ ) {
+ listInteractions.selection.toggle(rowId);
+ return;
+ }
+
+ list.activate.key(rowId, {
+ reason: 'pointer',
+ metadata: { event },
+ });
+ };
+
useEntityActionHotkeys({
enableDeleteHotkey: false,
scopeId: panel.splitHotkeyScope,
list: actionState,
selectedEntities,
focusedEntity,
- restoreFocus: () => listRoot?.focus(),
+ restoreFocus: () => listRoot()?.focus(),
viewContext: entityActionViewContext,
splitHandle: panel.handle,
createActionNavigationHandler,
@@ -467,7 +485,7 @@ export function InboxList(props: InboxListProps) {
return (
<MaybeSoupEntityActionDrawerManager>
<div
- ref={listRoot}
+ ref={setListRoot}
role="grid"
aria-label="Home"
aria-multiselectable="true"
@@ -497,179 +515,207 @@ export function InboxList(props: InboxListProps) {
onRefresh={pullRefresh}
/>
- <SwipableRowProvider
- container={viewport}
- setCollapseEntity={setCollapseRow}
- 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 touch:pt-(--mobile-content-inset-top)">
- <SpinnerIcon
- aria-label="Loading Home"
- 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))] touch:pt-(--mobile-content-inset-top) text-sm text-ink-muted"
+ <ListLayoutProvider ref={listRoot}>
+ <SwipableRowProvider
+ container={viewport}
+ setCollapseEntity={setCollapseRow}
+ 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()
+ }
>
- <span>Home couldn’t be loaded.</span>
- <Button
- variant="outline"
- size="sm"
- onClick={() => void source.refresh()}
+ <div class="grid min-h-0 flex-1 place-items-center text-ink-muted touch:pt-(--mobile-content-inset-top)">
+ <SpinnerIcon
+ aria-label="Loading Home"
+ 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))] touch:pt-(--mobile-content-inset-top) text-sm text-ink-muted"
>
- 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))]"
- onScroll={checkNearEnd}
- >
- {/* The spacer scrolls away; the viewport stays behind the filters. */}
+ <span>Home 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={setTopSpacer}
- aria-hidden="true"
- class="h-0 touch:h-(--mobile-content-inset-top)"
- />
- <Virtualizer
- ref={registerVirtualizer}
- data={rows()}
- scrollRef={viewport()}
- startMargin={
- isTouchDevice() ? (topSpacerSize.height ?? 0) : 0
- }
- bufferSize={500}
- itemSize={36}
- keepMounted={
- list.focus.index() >= 0 ? [list.focus.index()] : undefined
- }
+ 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))]"
+ 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
+ {/* The spacer scrolls away; the viewport stays behind the filters. */}
+ <div
+ ref={setTopSpacer}
+ aria-hidden="true"
+ class="h-0 touch:h-(--mobile-content-inset-top)"
+ />
+ <Virtualizer
+ ref={registerVirtualizer}
+ data={rows()}
+ scrollRef={viewport()}
+ startMargin={
+ isTouchDevice() ? (topSpacerSize.height ?? 0) : 0
+ }
+ bufferSize={500}
+ itemSize={isTouchDevice() ? 44 : 36}
+ keepMounted={
+ list.focus.index() >= 0 ? [list.focus.index()] : undefined
+ }
+ >
+ {(row, index) => (
+ <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 role="gridcell">
- <HomeListEntity
- channelName={channelName(entityRow().entity)}
- timestamp={
- state.tab === 'signal'
- ? entityRow().entity.sortTs
- : (entityRow().entity.notifiedAt ??
- entityRow().entity.sortTs)
- }
- entity={entityRow().entity}
- occurrenceKey={entityRow().id}
- checked={list.selection.isSelected(
- entityRow().id
- )}
- hideCheckbox
- highlighted={
- !isTouchDevice() &&
- list.focus.key() === entityRow().id
- }
- 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;
+ <div
+ id={entityRow().id}
+ role="row"
+ data-soup-entity
+ >
+ <div role="gridcell">
+ {/* Touch keeps the legacy Notifications row;
+ the compact Home row is desktop-rail only. */}
+ <Show
+ when={isTouchDevice()}
+ fallback={
+ <HomeListEntity
+ channelName={channelName(
+ entityRow().entity
+ )}
+ timestamp={
+ state.tab === 'signal'
+ ? entityRow().entity.sortTs
+ : (entityRow().entity.notifiedAt ??
+ entityRow().entity.sortTs)
+ }
+ entity={entityRow().entity}
+ occurrenceKey={entityRow().id}
+ checked={list.selection.isSelected(
+ entityRow().id
+ )}
+ hideCheckbox
+ highlighted={
+ list.focus.key() === entityRow().id
+ }
+ entityRowConfig={{
+ swipeLeftColor: 'bg-success',
+ swipeLeftRevealedComponent: (
+ <CheckIcon class="size-8 text-surface" />
+ ),
+ }}
+ onClick={(event) =>
+ onRowClick(entityRow().id, event)
+ }
+ />
}
-
- list.activate.key(entityRow().id, {
- reason: 'pointer',
- metadata: { event },
- });
- }}
- />
+ >
+ <InboxListEntity
+ entity={entityRow().entity}
+ occurrenceKey={entityRow().id}
+ checked={list.selection.isSelected(
+ entityRow().id
+ )}
+ onChecked={(checked, shiftKey) =>
+ listInteractions.selection.set(
+ entityRow().id,
+ checked,
+ { range: shiftKey }
+ )
+ }
+ highlighted={
+ list.focus.key() === entityRow().id
+ }
+ isLastInGroup={(() => {
+ const next = rows()[index() + 1];
+ return !next || next.kind !== 'entity';
+ })()}
+ entityRowConfig={{
+ swipeLeftColor: 'bg-success',
+ swipeLeftRevealedComponent: (
+ <CheckIcon class="size-8 text-surface" />
+ ),
+ }}
+ onClick={(event) =>
+ onRowClick(entityRow().id, event)
+ }
+ />
+ </Show>
+ </div>
</div>
- </div>
- </SoupEntityContextMenu>
- )}
- </Match>
- </Switch>
- )}
- </Virtualizer>
- </div>
- </Match>
- </Switch>
- </SwipableRowProvider>
+ </SoupEntityContextMenu>
+ )}
+ </Match>
+ </Switch>
+ )}
+ </Virtualizer>
+ </div>
+ </Match>
+ </Switch>
+ </SwipableRowProvider>
+ </ListLayoutProvider>
<Show when={selectedEntities().length > 0}>
<EntitySelectionToolbar
diff --git a/apps/web/src/features/inbox-view/inbox-view.tsx b/apps/web/src/features/inbox-view/inbox-view.tsx
index 1f227d767f..6ce80ed84b 100644
--- a/apps/web/src/features/inbox-view/inbox-view.tsx
+++ b/apps/web/src/features/inbox-view/inbox-view.tsx
@@ -100,7 +100,10 @@ function InboxViewRoot() {
});
const newChat = () => setPreviewEntity(undefined);
- onMount(() => panel.handle.setDisplayName('Home'));
+ // The touch nav item and legacy touch view both call this "Notifications".
+ onMount(() =>
+ panel.handle.setDisplayName(isTouchDevice() ? 'Notifications' : 'Home')
+ );
return (
<ListEntityMetadataQueryProvider>
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
index 80511c9f43..9eb56c0d09 100644
--- a/apps/web/src/features/inbox-view/queries/use-inbox-query.ts
+++ b/apps/web/src/features/inbox-view/queries/use-inbox-query.ts
@@ -22,6 +22,7 @@ import {
isFeatureEnabled,
} from '@core/constant/featureFlags';
import { useUserId } from '@core/context/user';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import {
type EntityData,
isSnippetEntity,
@@ -199,6 +200,11 @@ export function useInboxDataSource(
onCleanup(() => clearInterval(timer));
});
+ // Only desktop Home merges the viewer's own recents into Signal; touch
+ // devices keep Signal a pure notification feed, like the legacy
+ // Notifications view.
+ const mergeRecents = () => state.tab === 'signal' && !isTouchDevice();
+
// Activity's hydrated own-touch projection includes sent mail and chats even
// when they have no outstanding notifications. Its endpoint rejects email
// and channel filter trees, so Home applies its facets after merging.
@@ -212,14 +218,14 @@ export function useInboxDataSource(
},
body: {},
}),
- () => ({ enabled: state.tab === 'signal' })
+ () => ({ enabled: mergeRecents() })
);
const recentEntities = () =>
- state.tab === 'signal' && !recentQuery.isLoading
+ mergeRecents() && !recentQuery.isLoading
? (recentQuery.data?.entities ?? [])
: [];
const transformHomeEntities = (entities: EntityData[], recents = entities) =>
- state.tab === 'signal'
+ mergeRecents()
? mergeHomeEntities(
filterEntities(entities),
recents.filter((entity) =>
@@ -265,7 +271,7 @@ export function useInboxDataSource(
}, []);
const homePagination = createMemo(() => {
- if (state.tab !== 'signal' || search.isSearching()) return undefined;
+ if (!mergeRecents() || search.isSearching()) return undefined;
return getHomePagination(
{
oldestFetchedTimestamp: query.isLoading
@@ -351,7 +357,7 @@ export function useInboxDataSource(
if (usesServiceSearch()) return search.hasNextPage();
return (
(query.hasNextPage && !query.error) ||
- (state.tab === 'signal' && recentQuery.hasNextPage && !recentQuery.error)
+ (mergeRecents() && recentQuery.hasNextPage && !recentQuery.error)
);
};
@@ -359,7 +365,7 @@ export function useInboxDataSource(
if (usesServiceSearch()) return search.isFetchingNextPage();
return (
query.isFetchingNextPage ||
- (state.tab === 'signal' && recentQuery.isFetchingNextPage)
+ (mergeRecents() && recentQuery.isFetchingNextPage)
);
};
@@ -367,7 +373,7 @@ export function useInboxDataSource(
let result: InboxDataSourceItem[];
if (state.groupBy === 'date' && !search.isSearching()) {
result = buildGroupedSoupRows(
- state.tab === 'signal'
+ mergeRecents()
? groupHomeEntitiesByDate(entities().items, new Date(now()))
: groupInboxEntitiesByDate(entities().items, viewContext())
);
@@ -382,8 +388,7 @@ export function useInboxDataSource(
if (hasNoTypes()) return false;
if (!search.isSearching()) {
return (
- (query.isLoading ||
- (state.tab === 'signal' && recentQuery.isLoading)) &&
+ (query.isLoading || (mergeRecents() && recentQuery.isLoading)) &&
entities().items.length === 0
);
}
@@ -399,15 +404,14 @@ export function useInboxDataSource(
if (search.isSettling()) return true;
return usesServiceSearch()
? search.isFetching()
- : query.isFetching ||
- (state.tab === 'signal' && recentQuery.isFetching);
+ : query.isFetching || (mergeRecents() && recentQuery.isFetching);
},
error: () => {
if (hasNoTypes()) return undefined;
if (!usesServiceSearch())
return entities().items.length === 0 && !hasMore()
? (query.error ??
- (state.tab === 'signal' ? recentQuery.error : undefined) ??
+ (mergeRecents() ? recentQuery.error : undefined) ??
undefined)
: undefined;
return search.error();
@@ -416,7 +420,7 @@ export function useInboxDataSource(
if (usesServiceSearch() || (entities().items.length === 0 && !hasMore()))
return undefined;
if (query.error) return 'Notifications could not be refreshed.';
- if (state.tab === 'signal' && recentQuery.error)
+ if (mergeRecents() && recentQuery.error)
return 'Recent activity could not be refreshed.';
return undefined;
},
@@ -435,7 +439,7 @@ export function useInboxDataSource(
(pagination?.loadNotifications ?? true)
? query.fetchNextPage()
: undefined,
- state.tab === 'signal' &&
+ mergeRecents() &&
recentQuery.hasNextPage &&
!recentQuery.error &&
(pagination?.loadActivity ?? true)
@@ -450,7 +454,7 @@ export function useInboxDataSource(
}
await Promise.all([
query.refresh(),
- state.tab === 'signal' ? recentQuery.refresh() : undefined,
+ mergeRecents() ? recentQuery.refresh() : undefined,
]);
},
} satisfies InboxDataSource;
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index c64ce976d9..088e7dd3bb 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -69,9 +69,13 @@ it does not imply deletion. Only explicit `GraphqlCacheDeletion` events remove r
## Home (desktop) / Notifications (mobile) — `/app/component/inbox`
-Touch devices render the legacy Notifications view without waiting for the new app
-views feature flag. Desktop waits for flag readiness before choosing the new Home
-view or its legacy fallback.
+Every form factor waits for new-app-views flag readiness before choosing the
+new view or its legacy fallback. With the flag enabled, touch devices render
+the new Inbox as **Notifications**: a floating Signal/Noise pill strip with a
+leading filter drawer (Status and Type), pull-to-refresh, and swipe-left to
+mark done. On touch, Signal is a pure notification feed — the viewer's own
+touched-by-me recents are not merged in; that merge is desktop Home's Signal
+only, so sent mail and AI chats without notifications appear only on desktop.
On a cold launch, notification transport follows the GraphQL Soup flag reactively:
if the flag arrives after REST starts, the GraphQL notification query must actually