Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat[soup]: mobile action drawer (#2388)
Peter Chinman713eaef2185e
diff --git a/js/app/packages/app/component/EntityModal/EntityModal.tsx b/js/app/packages/app/component/EntityModal/EntityModal.tsxindex fa4ae363ef..cb4c3372d8 100644--- a/js/app/packages/app/component/EntityModal/EntityModal.tsx+++ b/js/app/packages/app/component/EntityModal/EntityModal.tsx@@ -74,7 +74,7 @@ const EntityModalContent = (props: {><divref={entityModalContentRef}- class="pointer-events-auto w-full max-w-xl mx-auto mt-16 bg-menu border border-edge h-fit p-2"+ class="pointer-events-auto w-full max-w-[min(36rem,calc(100%-1rem))] mx-auto mt-16 bg-menu border border-edge h-fit p-2"><div class="w-full my-1"><Show when={props.view() === 'rename'}>diff --git a/js/app/packages/app/component/bulk-edit-entity/BulkEditEntityModal.tsx b/js/app/packages/app/component/bulk-edit-entity/BulkEditEntityModal.tsxindex ffefe38177..18fcd71e17 100644--- a/js/app/packages/app/component/bulk-edit-entity/BulkEditEntityModal.tsx+++ b/js/app/packages/app/component/bulk-edit-entity/BulkEditEntityModal.tsx@@ -77,7 +77,7 @@ const BulkEditEntityModalContent = (props: {<Dialog.Overlay class="fixed inset-0 z-modal bg-modal-overlay" /><div class="fixed inset-0 z-modal"><Dialog.Content>- <div class="pointer-events-auto max-w-xl bg-menu border border-edge-muted w-lg h-fit p-2 mt-[25vh] mx-auto">+ <div class="pointer-events-auto max-w-[min(36rem,calc(100%-1rem))] bg-menu border border-edge-muted w-lg h-fit p-2 mt-[25vh] mx-auto"><div class="w-full my-1"><Show when={props.view === 'rename'}><BulkRenameEntitiesViewdiff --git a/js/app/packages/app/component/next-soup/soup-view/SoupEntityActionDrawer.tsx b/js/app/packages/app/component/next-soup/soup-view/SoupEntityActionDrawer.tsxnew file mode 100644index 0000000000..f693af0910--- /dev/null+++ b/js/app/packages/app/component/next-soup/soup-view/SoupEntityActionDrawer.tsx@@ -0,0 +1,89 @@+import { MobileDrawer } from '@app/component/mobile/MobileDrawer';+import { InlineEntity } from '@entity';+import { cn } from '@ui/utils/classname';+import { For, Show } from 'solid-js';+import { createSoupEntityActions } from './create-soup-entity-actions';+import { useSoupEntityActionDrawer } from './soup-entity-action-drawer-context';+import { useSoupView } from './soup-view-context';++export function SoupEntityActionDrawer() {+ const drawerState = useSoupEntityActionDrawer();+ const { activeTab } = useSoupView();+ const { buildActionGroups } = createSoupEntityActions();++ if (!drawerState) {+ console.warn('SoupEntityActionDrawer: no drawer state');+ return null;+ }++ const groups = () => {+ const e = drawerState.entity();+ const s = drawerState.soup();+ if (!e || !s) return [];+ return buildActionGroups([e], s, activeTab());+ };++ return (+ <MobileDrawer+ side="bottom"+ open={drawerState.isOpen()}+ closeOnOutsidePointerStrategy="pointerdown"+ onOpenChange={(v) => {+ if (!v) drawerState.close();+ }}+ preventScroll={false}+ preventScrollbarShift={false}+ restoreFocus={false}+ noOutsidePointerEvents={false}+ >+ <MobileDrawer.Portal>+ <MobileDrawer.Overlay class="fixed inset-0 z-modal-overlay bg-modal-overlay pattern-diagonal-4 pattern-edge-muted" />+ <MobileDrawer.Content aria-label="Entity actions">+ {/* Drag handle */}+ <div class="flex justify-center pt-3 pb-2 shrink-0">+ <div class="w-10 h-1 rounded-full bg-edge-muted" />+ </div>++ {/* Entity preview */}+ <Show when={drawerState.entity()}>+ {(e) => (+ <div class="px-4 pb-4 shrink-0 text-sm font-medium text-ink-muted">+ <InlineEntity entity={e()} />+ </div>+ )}+ </Show>++ {/* Action groups */}+ <For each={groups()}>+ {(group, groupIndex) => (+ <>+ <Show when={groupIndex() > 0}>+ <div class="mt-3" />+ </Show>+ <MobileDrawer.Section class="flex flex-col shrink-0">+ <For each={group.items}>+ {(action) => (+ <button+ type="button"+ class={cn(+ 'flex items-center gap-3 px-4 py-3 text-sm hover:bg-hover hover-transition-bg text-left not-last:border-b border-page',+ action.destructive ? 'text-failure-ink' : 'text-ink'+ )}+ onClick={async () => {+ await action.onClick();+ drawerState.close();+ }}+ >+ {action.label}+ </button>+ )}+ </For>+ </MobileDrawer.Section>+ </>+ )}+ </For>+ </MobileDrawer.Content>+ </MobileDrawer.Portal>+ </MobileDrawer>+ );+}diff --git a/js/app/packages/app/component/next-soup/soup-view/SoupEntityActionDrawerManager.tsx b/js/app/packages/app/component/next-soup/soup-view/SoupEntityActionDrawerManager.tsxnew file mode 100644index 0000000000..1ee0c90f96--- /dev/null+++ b/js/app/packages/app/component/next-soup/soup-view/SoupEntityActionDrawerManager.tsx@@ -0,0 +1,63 @@+import { isMobile } from '@core/mobile/isMobile';+import type { EntityData } from '@entity';+import { createEffect, createSignal, onCleanup, type JSX } from 'solid-js';+import type { SoupState } from '../create-soup-state';+import { SoupEntityActionDrawer } from './SoupEntityActionDrawer';+import {+ SoupEntityActionDrawerContextProvider,+ type SoupEntityActionDrawerState,+} from './soup-entity-action-drawer-context';++/**+ * On mobile: provides drawer context and renders the SoupEntityActionDrawer+ * (opened via long-press on soup entity rows).+ * On desktop: renders children as-is with no context, signals, or drawer.+ */+export function MaybeSoupEntityActionDrawerManager(props: {+ children: JSX.Element;+}) {+ if (!isMobile()) return props.children;++ const [isOpen, setIsOpen] = createSignal(false);+ const [entity, setEntity] = createSignal<EntityData | undefined>();+ const [soup, setSoup] = createSignal<SoupState | undefined>();++ const ctx: SoupEntityActionDrawerState = {+ isOpen,+ entity,+ soup,+ open: (e: EntityData, s: SoupState) => {+ setEntity(() => e);+ setSoup(() => s);+ setIsOpen(true);+ },+ close: () => setIsOpen(false),+ };++ let wrapperEl!: HTMLDivElement;++ // Block in-progress touch sequences (scroll, swipe) the moment the drawer opens.+ createEffect(() => {+ if (!isOpen()) return;+ const block = (e: TouchEvent) => {+ e.preventDefault();+ e.stopPropagation();+ };+ wrapperEl.addEventListener('touchmove', block, {+ capture: true,+ passive: false,+ });+ onCleanup(() =>+ wrapperEl.removeEventListener('touchmove', block, { capture: true })+ );+ });++ return (+ <SoupEntityActionDrawerContextProvider value={ctx}>+ <div class="size-full" ref={wrapperEl}>+ {props.children}+ </div>+ <SoupEntityActionDrawer />+ </SoupEntityActionDrawerContextProvider>+ );+}diff --git a/js/app/packages/app/component/next-soup/soup-view/create-soup-entity-actions.ts b/js/app/packages/app/component/next-soup/soup-view/create-soup-entity-actions.tsnew file mode 100644index 0000000000..4409cbb446--- /dev/null+++ b/js/app/packages/app/component/next-soup/soup-view/create-soup-entity-actions.ts@@ -0,0 +1,271 @@+import { useGlobalNotificationSource } from '@app/component/GlobalAppState';+import { globalSplitManager } from '@app/signal/splitLayout';+import { fileTypeToBlockName, itemToBlockName } from '@core/constant/allBlocks';+import type { EntityData } from '@entity';+import {+ makeBlockSenderAction,+ makeCopyAction,+ makeCopyBranchNameAction,+ makeCopyLinkAction,+ makeDeleteAction,+ makeMarkDoneAction,+ makeMarkSenderNoiseAction,+ makeMarkSenderSignalAction,+ makeMoveToProjectAction,+ makeRenameAction,+ makeShareAction,+} from '../actions';+import type { SoupState } from '../create-soup-state';+import { useUserId } from '@core/context/user';+import { useAnalytics } from '@app/component/analytics-context';+import { getChannelParams } from '@block-channel/utils/link';+import { isMobile } from '@core/mobile/isMobile';++const SIGNAL_TABS = new Set<string | undefined>([+ undefined,+ 'signal',+ 'important',+]);+const NOISE_TABS = new Set(['noise']);++export type SoupEntityActionItem = {+ id: string;+ label: string;+ onClick: () => void | Promise<void>;+ destructive?: boolean;+};++export type SoupEntityActionGroup = {+ items: SoupEntityActionItem[];+};++export function createSoupEntityActions(): {+ buildActionGroups: (+ entities: EntityData[],+ soup: SoupState,+ activeTab: string | undefined+ ) => SoupEntityActionGroup[];+} {+ const analytics = useAnalytics();+ const userId = useUserId();+ const notificationSource = useGlobalNotificationSource();++ const markDone = makeMarkDoneAction({+ userId: () => userId(),+ notificationSource: () => notificationSource,+ });++ const deleteAction = makeDeleteAction({+ userId: () => userId(),+ });++ const renameAction = makeRenameAction({+ userId: () => userId(),+ });++ const copyAction = makeCopyAction();+ const moveToProjectAction = makeMoveToProjectAction();+ const copyLinkAction = makeCopyLinkAction();+ const copyBranchNameAction = makeCopyBranchNameAction();+ const shareAction = makeShareAction();+ const blockSenderAction = makeBlockSenderAction();+ const markSenderSignalAction = makeMarkSenderSignalAction();+ const markSenderNoiseAction = makeMarkSenderNoiseAction();++ const buildActionGroups = (+ entities: EntityData[],+ soup: SoupState,+ activeTab: string | undefined+ ): SoupEntityActionGroup[] => {+ const canExecuteAll = (canExecute: (e: EntityData) => boolean) =>+ entities.length > 0 && entities.every(canExecute);++ const handle =+ (execute: (entities: EntityData[], soup: SoupState) => Promise<void>) =>+ () =>+ execute(entities, soup);++ // Top group: Mark Done, Open in new split+ const topItems: SoupEntityActionItem[] = [];++ if (canExecuteAll(markDone.canExecute)) {+ topItems.push({+ id: 'mark-done',+ label: 'Mark Done',+ onClick: handle(markDone.executeWithSoup),+ });+ }++ const canOpenInSplit = () => {+ if (isMobile()) return false;+ if (entities.length !== 1) return false;+ const entity = entities[0];+ const splitManager = globalSplitManager();+ if (!splitManager) return false;+ const contentId =+ entity.type === 'channel_message' ? entity.channelId : entity.id;+ const contentType = itemToBlockName(entity);+ return !splitManager.getSplitByContent(contentType, contentId);+ };++ if (canOpenInSplit()) {+ const openInNewSplit = async () => {+ const entity = entities[0];+ if (!entity) return;++ const splitManager = globalSplitManager();+ if (!splitManager) return;++ analytics.track('split_created', {+ from: 'soup_view_entity_actions_menu',+ });++ if (entity.type === 'document') {+ const { fileType, id, subType } = entity;+ splitManager.createNewSplit({+ content: {+ type: fileTypeToBlockName(subType?.type ?? fileType),+ id,+ },+ referredFrom: 'entity-actions-menu',+ });+ } else if (entity.type === 'channel_message') {+ splitManager.createNewSplit({+ content: {+ type: 'channel',+ id: entity.channelId,+ params: getChannelParams(entity.messageId, entity.threadId),+ },+ referredFrom: 'entity-actions-menu',+ });++ const orchestrator = splitManager.getOrchestrator();+ const blockHandle = await orchestrator.getBlockHandle(+ entity.channelId,+ 'channel'+ );++ await blockHandle?.goToLocationFromParams(+ getChannelParams(entity.messageId, entity.threadId)+ );+ } else {+ splitManager.createNewSplit({+ content: {+ type: entity.type,+ id: entity.id,+ },+ referredFrom: 'entity-actions-menu',+ });+ }+ };++ topItems.push({+ id: 'open-in-split',+ label: 'Open in new split',+ onClick: openInNewSplit,+ });+ }++ // Middle group: Rename, Move to folder, Duplicate, Copy Link, Copy Branch Name, Share+ const middleItems: SoupEntityActionItem[] = [];++ if (canExecuteAll(renameAction.canExecute)) {+ middleItems.push({+ id: 'rename',+ label: 'Rename',+ onClick: handle(renameAction.executeWithSoup),+ });+ }++ if (canExecuteAll(moveToProjectAction.canExecute)) {+ middleItems.push({+ id: 'move-to-folder',+ label: 'Move to folder',+ onClick: handle(moveToProjectAction.executeWithSoup),+ });+ }++ if (canExecuteAll(copyAction.canExecute)) {+ middleItems.push({+ id: 'duplicate',+ label: 'Duplicate',+ onClick: handle(copyAction.executeWithSoup),+ });+ }++ if (entities.length === 1) {+ middleItems.push({+ id: 'copy-link',+ label: 'Copy Link',+ onClick: handle(copyLinkAction.executeWithSoup),+ });++ if (copyBranchNameAction.canExecute(entities[0])) {+ middleItems.push({+ id: 'copy-branch-name',+ label: 'Copy Branch Name',+ onClick: handle(copyBranchNameAction.executeWithSoup),+ });+ }++ if (shareAction.canExecute(entities[0])) {+ middleItems.push({+ id: 'share',+ label: 'Share',+ onClick: handle(shareAction.executeWithSoup),+ });+ }+ }++ // Sender group: Sender → Signal, Sender → Noise, Block Sender+ const senderItems: SoupEntityActionItem[] = [];++ if (+ NOISE_TABS.has(activeTab ?? '') &&+ canExecuteAll(markSenderSignalAction.canExecute)+ ) {+ senderItems.push({+ id: 'sender-signal',+ label: 'Sender → Signal',+ onClick: handle(markSenderSignalAction.executeWithSoup),+ });+ }++ if (+ SIGNAL_TABS.has(activeTab) &&+ canExecuteAll(markSenderNoiseAction.canExecute)+ ) {+ senderItems.push({+ id: 'sender-noise',+ label: 'Sender → Noise',+ onClick: handle(markSenderNoiseAction.executeWithSoup),+ });+ }++ if (canExecuteAll(blockSenderAction.canExecute)) {+ senderItems.push({+ id: 'block-sender',+ label: 'Block Sender',+ onClick: handle(blockSenderAction.executeWithSoup),+ });+ }++ // Delete group+ const deleteItems: SoupEntityActionItem[] = [];++ if (canExecuteAll(deleteAction.canExecute)) {+ deleteItems.push({+ id: 'delete',+ label: 'Delete',+ onClick: handle(deleteAction.executeWithSoup),+ destructive: true,+ });+ }++ return [topItems, middleItems, senderItems, deleteItems]+ .filter((items) => items.length > 0)+ .map((items) => ({ items }));+ };++ return { buildActionGroups };+}diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-entity-action-drawer-context.ts b/js/app/packages/app/component/next-soup/soup-view/soup-entity-action-drawer-context.tsnew file mode 100644index 0000000000..63831ae19e--- /dev/null+++ b/js/app/packages/app/component/next-soup/soup-view/soup-entity-action-drawer-context.ts@@ -0,0 +1,23 @@+import { createContext, useContext, type Accessor } from 'solid-js';+import type { EntityData } from '@entity';+import type { SoupState } from '../create-soup-state';++export type SoupEntityActionDrawerState = {+ isOpen: Accessor<boolean>;+ entity: Accessor<EntityData | undefined>;+ soup: Accessor<SoupState | undefined>;+ open: (entity: EntityData, soup: SoupState) => void;+ close: () => void;+};++const SoupEntityActionDrawerContext =+ createContext<SoupEntityActionDrawerState>();++export const SoupEntityActionDrawerContextProvider =+ SoupEntityActionDrawerContext.Provider;++export function useSoupEntityActionDrawer():+ | SoupEntityActionDrawerState+ | undefined {+ return useContext(SoupEntityActionDrawerContext);+}diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsxindex b1721da4dc..8e1d4a024d 100644--- a/js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/soup-entity-actions-menu.tsx@@ -1,34 +1,9 @@-import { useGlobalNotificationSource } from '@app/component/GlobalAppState';-import { globalSplitManager } from '@app/signal/splitLayout';import { MenuItem } from '@core/component/Menu';-import { fileTypeToBlockName, itemToBlockName } from '@core/constant/allBlocks';import type { EntityData } from '@entity';-import {- makeBlockSenderAction,- makeCopyAction,- makeCopyBranchNameAction,- makeCopyLinkAction,- makeDeleteAction,- makeMarkDoneAction,- makeMarkSenderNoiseAction,- makeMarkSenderSignalAction,- makeMoveToProjectAction,- makeRenameAction,- makeShareAction,-} from '../actions';+import { For, Show } from 'solid-js';import type { SoupState } from '../create-soup-state';-import { useUserId } from '@core/context/user';-import { useAnalytics } from '@app/component/analytics-context';-import { Show } from 'solid-js';+import { createSoupEntityActions } from './create-soup-entity-actions';import { useSoupView } from './soup-view-context';-import { getChannelParams } from '@block-channel/utils/link';--const SIGNAL_TABS = new Set<string | undefined>([- undefined,- 'signal',- 'important',-]);-const NOISE_TABS = new Set(['noise']);interface SoupEntityActionsMenuProps {entities: EntityData[];@@ -37,241 +12,36 @@ interface SoupEntityActionsMenuProps {}export const SoupEntityActionsMenu = (props: SoupEntityActionsMenuProps) => {- const analytics = useAnalytics();const { activeTab } = useSoupView();+ const { buildActionGroups } = createSoupEntityActions();- const userId = useUserId();- const notificationSource = useGlobalNotificationSource();-- const markDone = makeMarkDoneAction({- userId: () => userId(),- notificationSource: () => notificationSource,- });-- const deleteAction = makeDeleteAction({- userId: () => userId(),- });-- const renameAction = makeRenameAction({- userId: () => userId(),- });-- const copyAction = makeCopyAction();-- const moveToProjectAction = makeMoveToProjectAction();-- const copyLinkAction = makeCopyLinkAction();-- const copyBranchNameAction = makeCopyBranchNameAction();-- const shareAction = makeShareAction();-- const blockSenderAction = makeBlockSenderAction();+ const groups = () =>+ buildActionGroups(props.entities, props.soup, activeTab());- const markSenderSignalAction = makeMarkSenderSignalAction();- const markSenderNoiseAction = makeMarkSenderNoiseAction();-- const canExecuteAll = (canExecute: (e: EntityData) => boolean) =>- props.entities.length > 0 && props.entities.every(canExecute);-- const handleAction = async (- execute: (entities: EntityData[], soup: SoupState) => Promise<void>- ) => {- await execute(props.entities, props.soup);+ const handleAction = async (onClick: () => void | Promise<void>) => {+ await onClick();props.onActionComplete?.();};- const canOpenInSplit = () => {- if (props.entities.length !== 1) return false;- const entity = props.entities[0];- const splitManager = globalSplitManager();- if (!splitManager) return false;- const contentId =- entity.type === 'channel_message' ? entity.channelId : entity.id;- const contentType = itemToBlockName(entity);- return !splitManager.getSplitByContent(contentType, contentId);- };-- const openInNewSplit = async () => {- const entity = props.entities[0];- if (!entity) return;-- const splitManager = globalSplitManager();- if (!splitManager) return;-- analytics.track('split_created', { from: 'soup_view_entity_actions_menu' });-- if (entity.type === 'document') {- const { fileType, id, subType } = entity;- splitManager.createNewSplit({- content: {- type: fileTypeToBlockName(subType?.type ?? fileType),- id,- },- referredFrom: 'entity-actions-menu',- });- } else if (entity.type === 'channel_message') {- splitManager.createNewSplit({- content: {- type: 'channel',- id: entity.channelId,- params: getChannelParams(entity.messageId, entity.threadId),- },- referredFrom: 'entity-actions-menu',- });-- const orchestrator = splitManager.getOrchestrator();- const handle = await orchestrator.getBlockHandle(- entity.channelId,- 'channel'- );-- await handle?.goToLocationFromParams(- getChannelParams(entity.messageId, entity.threadId)- );- } else {- splitManager.createNewSplit({- content: {- type: entity.type,- id: entity.id,- },- referredFrom: 'entity-actions-menu',- });- }- };-- const showTopGroup = () =>- canExecuteAll(markDone.canExecute) || canOpenInSplit();-- const showMiddleGroup = () =>- canExecuteAll(renameAction.canExecute) ||- canExecuteAll(moveToProjectAction.canExecute) ||- canExecuteAll(copyAction.canExecute) ||- props.entities.length === 1;-- const showSenderGroup = () => canExecuteAll(blockSenderAction.canExecute);-- const showDeleteGroup = () => canExecuteAll(deleteAction.canExecute);-return (- <>- <Show when={canExecuteAll(markDone.canExecute)}>- <MenuItem- text="Mark Done"- onClick={() => handleAction(markDone.executeWithSoup)}- />- </Show>-- <Show when={canOpenInSplit()}>- <MenuItem text="Open in new split" onClick={openInNewSplit} />- </Show>-- <Show when={showTopGroup() && (showMiddleGroup() || showDeleteGroup())}>- <Divider />- </Show>-- <Show when={canExecuteAll(renameAction.canExecute)}>- <MenuItem- text="Rename"- onClick={() => handleAction(renameAction.executeWithSoup)}- />- </Show>-- <Show when={canExecuteAll(moveToProjectAction.canExecute)}>- <MenuItem- text="Move to folder"- onClick={() => handleAction(moveToProjectAction.executeWithSoup)}- />- </Show>-- <Show when={canExecuteAll(copyAction.canExecute)}>- <MenuItem- text="Duplicate"- onClick={() => handleAction(copyAction.executeWithSoup)}- />- </Show>-- <Show when={props.entities.length === 1}>- <MenuItem- text="Copy Link"- onClick={() => handleAction(copyLinkAction.executeWithSoup)}- />- </Show>-- <Show- when={- props.entities.length === 1 &&- copyBranchNameAction.canExecute(props.entities[0])- }- >- <MenuItem- text="Copy Branch Name"- onClick={() => handleAction(copyBranchNameAction.executeWithSoup)}- />- </Show>-- <Show- when={- props.entities.length === 1 &&- shareAction.canExecute(props.entities[0])- }- >- <MenuItem- text="Share"- onClick={() => handleAction(shareAction.executeWithSoup)}- />- </Show>-- <Show when={showSenderGroup() && (showTopGroup() || showMiddleGroup())}>- <Divider />- </Show>-- <Show- when={- NOISE_TABS.has(activeTab() ?? '') &&- canExecuteAll(markSenderSignalAction.canExecute)- }- >- <MenuItem- text="Sender → Signal"- onClick={() => handleAction(markSenderSignalAction.executeWithSoup)}- />- </Show>-- <Show- when={- SIGNAL_TABS.has(activeTab()) &&- canExecuteAll(markSenderNoiseAction.canExecute)- }- >- <MenuItem- text="Sender → Noise"- onClick={() => handleAction(markSenderNoiseAction.executeWithSoup)}- />- </Show>-- <Show when={showSenderGroup()}>- <MenuItem- text="Block Sender"- onClick={() => handleAction(blockSenderAction.executeWithSoup)}- />- </Show>-- <Show- when={showDeleteGroup() && (showSenderGroup() || showMiddleGroup())}- >- <Divider />- </Show>-- <Show when={showDeleteGroup()}>- <div class="text-failure-ink w-full">- <MenuItem- text="Delete"- onClick={() => handleAction(deleteAction.executeWithSoup)}- />- </div>- </Show>- </>+ <For each={groups()}>+ {(group, groupIndex) => (+ <>+ <Show when={groupIndex() > 0}>+ <Divider />+ </Show>+ <For each={group.items}>+ {(action) => (+ <MenuItem+ text={action.label}+ onClick={() => handleAction(action.onClick)}+ class={action.destructive ? 'text-failure-ink' : undefined}+ />+ )}+ </For>+ </>+ )}+ </For>);};diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-entity-context-menu.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-entity-context-menu.tsxindex 68b3801189..2d77c7d5a6 100644--- a/js/app/packages/app/component/next-soup/soup-view/soup-entity-context-menu.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/soup-entity-context-menu.tsx@@ -1,15 +1,15 @@-import { ContextMenuContent, MenuSeparator } from '@core/component/Menu';-import type { DateValue } from '@core/util/date';+import { ContextMenuContent } from '@core/component/Menu';import { isMobile } from '@core/mobile/isMobile';+import { longPressHighlight } from '@core/directive/longPressHighlight';import { ContextMenu } from '@kobalte/core/context-menu';-import { InlineEntity, type EntityData } from '@entity';-import { type FlowComponent, Show } from 'solid-js';+import type { EntityData } from '@entity';+import { type FlowComponent, Match, Show, Switch } from 'solid-js';import { useSoupView } from './soup-view-context';import { SoupEntityActionsMenu } from './soup-entity-actions-menu';+import { useSoupEntityActionDrawer } from './soup-entity-action-drawer-context';interface SoupEntityContextMenuProps {entity: EntityData;- entityTimestamp?: DateValue | null;onOpenChange?: (open: boolean) => void;}@@ -17,28 +17,42 @@ export const SoupEntityContextMenu: FlowComponent<SoupEntityContextMenuProps> = (props) => {const { soup } = useSoupView();+ const drawerManager = useSoupEntityActionDrawer();return (- <ContextMenu onOpenChange={props.onOpenChange}>- <ContextMenu.Trigger class="size-full">- {props.children}- </ContextMenu.Trigger>- <ContextMenu.Portal>- <Show when={props.entity}>- {(selectedEntity) => (- <ContextMenuContent mobileFullScreen class="text-xs text-ink-muted">- <Show when={isMobile()}>- <InlineEntity entity={selectedEntity()} />- <MenuSeparator />- </Show>- <SoupEntityActionsMenu- entities={[selectedEntity()]}- soup={soup}- />- </ContextMenuContent>- )}- </Show>- </ContextMenu.Portal>- </ContextMenu>+ <Switch>+ <Match when={isMobile()}>+ <div+ class="size-full"+ data-soup-entity+ ref={(el) =>+ longPressHighlight(el, () => ({+ onLongPress: () => drawerManager?.open(props.entity, soup),+ }))+ }+ >+ {props.children}+ </div>+ </Match>+ <Match when={true}>+ <ContextMenu onOpenChange={props.onOpenChange}>+ <ContextMenu.Trigger class="size-full">+ {props.children}+ </ContextMenu.Trigger>+ <ContextMenu.Portal>+ <Show when={props.entity}>+ {(selectedEntity) => (+ <ContextMenuContent class="text-xs text-ink-muted">+ <SoupEntityActionsMenu+ entities={[selectedEntity()]}+ soup={soup}+ />+ </ContextMenuContent>+ )}+ </Show>+ </ContextMenu.Portal>+ </ContextMenu>+ </Match>+ </Switch>);};diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsxindex 8e165ce06e..d9676534ac 100644--- a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx@@ -11,6 +11,7 @@ import {} from '@app/component/next-soup/actions';import { useSoup } from '@app/component/next-soup/soup-context';import { SoupEntityContextMenu } from '@app/component/next-soup/soup-view/soup-entity-context-menu';+import { MaybeSoupEntityActionDrawerManager } from '@app/component/next-soup/soup-view/SoupEntityActionDrawerManager';import {type SoupRow,SoupViewContextProvider,@@ -751,228 +752,227 @@ export const SoupViewList = (props: SoupViewListProps) => {const featuredCount = createMemo(() => featuredIds().length);return (- <div- class="size-full flex bracket-never"- ref={(el) => {- setSoupViewRef(el);- attachHotkeys(el);- }}- tabIndex={-1}- onFocusIn={(e) => {- e.stopPropagation();- }}- data-hotkey-scope={soupViewScope}- data-soup-view- data-soup-view-id={panel.handle.id + (previewPanel ? '-preview' : '')}- >+ <MaybeSoupEntityActionDrawerManager><div- class="@container/uList size-full unified-list-root flex flex-col"- classList={{- 'border-r border-edge-muted': soup.previewEntity() !== undefined,+ class="size-full flex bracket-never"+ ref={(el) => {+ setSoupViewRef(el);+ attachHotkeys(el);+ }}+ tabIndex={-1}+ onFocusIn={(e) => {+ e.stopPropagation();}}+ data-hotkey-scope={soupViewScope}+ data-soup-view+ data-soup-view-id={panel.handle.id + (previewPanel ? '-preview' : '')}>- <StaticMarkdownContext>- <Switch>- <Match when={source.isLoading() && !rows().length}>- <LoadingBlock />- </Match>- <Match- when={- (isSearchServiceLoading() || isLocalSearchSettling()) &&- !rows().length- }- >- <div class="flex items-center gap-2 px-3 py-3 text-xs text-text-muted">- <Spinner class="size-3 animate-spin" />- Searching...- </div>- </Match>- <Match when={!rows().length}>- <EmptyState- search={!!searchText()}- hasRefinementsFromBase={hasActiveRefinements()}- onClearFilters={resetToTabDefaults}- />- </Match>- <Match when={rows().length}>- <ListLayoutProvider ref={localEntityListRef}>- <EntityRowProvider- container={localEntityListRef}- canSwipeLeft={(entityId) => {- const entity = entityById().get(entityId);- if (!entity) return false;- return markDoneAction.canExecute(entity.original);- }}- onSwipeLeft={(entityId) => {- const entity = entityById().get(entityId);- if (!entity) return;- markDoneAction.executeWithSoup([entity.original], soup);- }}- setCollapseEntity={soup.collapseEntity.set}- >- <SoupList- cache={listStateCache.get(cacheKey)?.virtualCache}- ref={setLocalEntityListRef}- virtualizerClass="scrollbar-hidden"- class="overflow-hidden flex min-w-0"- virtualizerRef={registerVirtualizerHandler}- onScrollBottom={debouncedFetchMore}- scrollBottomOffset={300}- rows={rows()}+ <div+ class="@container/uList size-full unified-list-root flex flex-col"+ classList={{+ 'border-r border-edge-muted': soup.previewEntity() !== undefined,+ }}+ >+ <StaticMarkdownContext>+ <Switch>+ <Match when={source.isLoading() && !rows().length}>+ <LoadingBlock />+ </Match>+ <Match+ when={+ (isSearchServiceLoading() || isLocalSearchSettling()) &&+ !rows().length+ }+ >+ <div class="flex items-center gap-2 px-3 py-3 text-xs text-text-muted">+ <Spinner class="size-3 animate-spin" />+ Searching...+ </div>+ </Match>+ <Match when={!rows().length}>+ <EmptyState+ search={!!searchText()}+ hasRefinementsFromBase={hasActiveRefinements()}+ onClearFilters={resetToTabDefaults}+ />+ </Match>+ <Match when={rows().length}>+ <ListLayoutProvider ref={localEntityListRef}>+ <EntityRowProvider+ container={localEntityListRef}+ canSwipeLeft={(entityId) => {+ const entity = entityById().get(entityId);+ if (!entity) return false;+ return markDoneAction.canExecute(entity.original);+ }}+ onSwipeLeft={(entityId) => {+ const entity = entityById().get(entityId);+ if (!entity) return;+ markDoneAction.executeWithSoup([entity.original], soup);+ }}+ setCollapseEntity={soup.collapseEntity.set}>- {(row, i) => {- const timestamp = () => {- if (row.original.sortTs) return row.original.sortTs;-- const sort_ = soup.sort.active();- if (!sort_.length) return;-- switch (sort_[0].id) {- case 'viewed_at':- return row.original.viewedAt;- case 'created_at':- return row.original.createdAt;- case 'updated_at':- return row.original.updatedAt;- default:- return row.original.createdAt;- }- };-- return (- <>- <Show when={i() === 0 && featuredCount() > 0}>- <div class="px-3 py-1.5 text-xs text-text-muted font-medium">- Featured Results- </div>- </Show>- <Show- when={- i() === featuredCount() && featuredCount() > 0- }- >- <div class="px-3 py-1.5 text-xs text-text-muted font-medium border-t border-edge-muted mt-1">- More Results- </div>- </Show>- <SoupEntityContextMenu- entity={row.original}- entityTimestamp={timestamp()}- >- <ListEntity- entity={row.original}- timestamp={timestamp()}- highlighted={- panel.isPanelActive() && row.isFocused()- }- onMouseMove={() => {- if (isKeypressActive()) return;- if (soup.previewEntity()) return;- soup.focus.set(row.original.id);- }}- showUnrollNotifications={- soup.filters.isActive('signal') &&- !soup.filters.isActive('noise')+ <SoupList+ cache={listStateCache.get(cacheKey)?.virtualCache}+ ref={setLocalEntityListRef}+ virtualizerClass="scrollbar-hidden"+ class="overflow-hidden flex min-w-0"+ virtualizerRef={registerVirtualizerHandler}+ onScrollBottom={debouncedFetchMore}+ scrollBottomOffset={300}+ rows={rows()}+ >+ {(row, i) => {+ const timestamp = () => {+ if (row.original.sortTs) return row.original.sortTs;++ const sort_ = soup.sort.active();+ if (!sort_.length) return;++ switch (sort_[0].id) {+ case 'viewed_at':+ return row.original.viewedAt;+ case 'created_at':+ return row.original.createdAt;+ case 'updated_at':+ return row.original.updatedAt;+ default:+ return row.original.createdAt;+ }+ };++ return (+ <>+ <Show when={i() === 0 && featuredCount() > 0}>+ <div class="px-3 py-1.5 text-xs text-text-muted font-medium">+ Featured Results+ </div>+ </Show>+ <Show+ when={+ i() === featuredCount() && featuredCount() > 0}- checked={row.isSelected()}- onChecked={(next: boolean, shiftKey: boolean) =>- handleMultiSelectChecked({- entity: row.original,- entityIndex: i(),- next,- shiftKey: shiftKey ?? false,- })+ >+ <div class="px-3 py-1.5 text-xs text-text-muted font-medium border-t border-edge-muted mt-1">+ More Results+ </div>+ </Show>+ <SoupEntityContextMenu entity={row.original}>+ <ListEntity+ entity={row.original}+ timestamp={timestamp()}+ highlighted={+ panel.isPanelActive() && row.isFocused()+ }+ onMouseMove={() => {+ if (isKeypressActive()) return;+ if (soup.previewEntity()) return;+ soup.focus.set(row.original.id);+ }}+ showUnrollNotifications={+ soup.filters.isActive('signal') &&+ !soup.filters.isActive('noise')+ }+ checked={row.isSelected()}+ onChecked={(next: boolean, shiftKey: boolean) =>+ handleMultiSelectChecked({+ entity: row.original,+ entityIndex: i(),+ next,+ shiftKey: shiftKey ?? false,+ })+ }+ onClick={(event: MouseEvent) => {+ onEntityClick({+ type: 'entity',+ entity: row.original,+ event,+ location: undefined,+ });+ }}+ onProjectClick={(projectEntity, event) => {+ onEntityClick({+ type: 'project',+ projectEntity,+ entity: row.original,+ event,+ location: undefined,+ });+ }}+ onContentHitClick={(+ e: PointerEvent | MouseEvent,+ location?: SearchLocation+ ) => {+ onEntityClick({+ type: 'entity',+ entity: row.original,+ event: e,+ location,+ });+ }}+ entityRowConfig={{+ swipeLeftColor: 'bg-success',+ swipeLeftRevealedComponent: (+ <CheckIcon class="size-8 text-panel" />+ ),+ }}+ />+ </SoupEntityContextMenu>+ <Show+ when={+ i() === rows().length - 1 &&+ isSearchServiceLoading()}- onClick={(event: MouseEvent) => {- onEntityClick({- type: 'entity',- entity: row.original,- event,- location: undefined,- });- }}- onProjectClick={(projectEntity, event) => {- onEntityClick({- type: 'project',- projectEntity,- entity: row.original,- event,- location: undefined,- });- }}- onContentHitClick={(- e: PointerEvent | MouseEvent,- location?: SearchLocation- ) => {- onEntityClick({- type: 'entity',- entity: row.original,- event: e,- location,- });- }}- entityRowConfig={{- swipeLeftColor: 'bg-success',- swipeLeftRevealedComponent: (- <CheckIcon class="size-8 text-panel" />- ),- }}- />- </SoupEntityContextMenu>- <Show- when={- i() === rows().length - 1 &&- isSearchServiceLoading()- }- >- <div class="flex items-center gap-2 px-3 py-3 text-xs text-text-muted">- <Spinner class="size-3 animate-spin" />- Searching...- </div>- </Show>- </>- );+ >+ <div class="flex items-center gap-2 px-3 py-3 text-xs text-text-muted">+ <Spinner class="size-3 animate-spin" />+ Searching...+ </div>+ </Show>+ </>+ );+ }}+ </SoupList>+ </EntityRowProvider>+ </ListLayoutProvider>++ <Show when={!props.customScrollbarHidden}>+ <CustomScrollbar+ scrollContainer={() => {+ // Find the actual scroll container (VList creates its own scroll container)+ const listEl = localEntityListRef();+ if (!listEl) return undefined;+ const scrollContainer = listEl.querySelector(+ '[data-soup-list-container]'+ ) as HTMLElement;+ return scrollContainer || undefined;}}- </SoupList>- </EntityRowProvider>- </ListLayoutProvider>-- <Show when={!props.customScrollbarHidden}>- <CustomScrollbar- scrollContainer={() => {- // Find the actual scroll container (VList creates its own scroll container)- const listEl = localEntityListRef();- if (!listEl) return undefined;- const scrollContainer = listEl.querySelector(- '[data-soup-list-container]'- ) as HTMLElement;- return scrollContainer || undefined;- }}- />- </Show>- </Match>- </Switch>- </StaticMarkdownContext>+ />+ </Show>+ </Match>+ </Switch>+ </StaticMarkdownContext>+ </div>+ <Show when={soup.selection.count() > 0}>+ <SoupEntitySelectionToolbar+ selected={soup.selection.selected()}+ onClose={soup.selection.clear}+ onClear={soup.selection.clear}+ />+ </Show>+ <Show when={soup.previewEntity() || panel.previewState[0]()}>+ <PreviewPanel+ ref={setPreviewPanelRef}+ selectedEntity={soup.focus.item()}+ orchestrator={orchestrator}+ splitPanelContext={panel}+ onFocusOut={() => {+ soupViewRef()?.focus();+ }}+ />+ </Show></div>- <Show when={soup.selection.count() > 0}>- <SoupEntitySelectionToolbar- selected={soup.selection.selected()}- onClose={soup.selection.clear}- onClear={soup.selection.clear}- />- </Show>- <Show when={soup.previewEntity() || panel.previewState[0]()}>- <PreviewPanel- ref={setPreviewPanelRef}- selectedEntity={soup.focus.item()}- orchestrator={orchestrator}- splitPanelContext={panel}- onFocusOut={() => {- soupViewRef()?.focus();- }}- />- </Show>- </div>+ </MaybeSoupEntityActionDrawerManager>);};diff --git a/js/app/packages/app/index.css b/js/app/packages/app/index.cssindex 1af58005f7..497a7760df 100644--- a/js/app/packages/app/index.css+++ b/js/app/packages/app/index.css@@ -737,11 +737,11 @@ html:not([data-touch-device="true"]) [data-channel-nav="keyboard"] [data-message}/* Long-press animation */-[data-message].long-press-animation {+[data-message].long-press-animation, .long-press-animation [data-swipe-content] {animation: long-press-message-highlight 400ms ease-in both;}-[data-message].long-press-animation > .message-accent-bar {+[data-message].long-press-animation > .message-accent-bar, .long-press-animation [data-accent-bar] {animation: long-press-accent-bar 400ms ease-in both;}diff --git a/js/app/packages/entity/src/composed/ListEntity.tsx b/js/app/packages/entity/src/composed/ListEntity.tsxindex a50abb9fb3..e0de3df594 100644--- a/js/app/packages/entity/src/composed/ListEntity.tsx+++ b/js/app/packages/entity/src/composed/ListEntity.tsx@@ -984,6 +984,7 @@ export function ListEntity(props: ListEntityProps) {onMouseMove={props.onMouseMove}><div+ data-accent-barclass={cn('absolute h-full w-[3px] left-0 top-0 bg-accent opacity-0', {'opacity-100': props.highlighted && !isMobile(),})}diff --git a/js/app/packages/notifications/components/BrowserNotificationModal.tsx b/js/app/packages/notifications/components/BrowserNotificationModal.tsxindex f261ecae7d..df06e6ba3e 100644--- a/js/app/packages/notifications/components/BrowserNotificationModal.tsx+++ b/js/app/packages/notifications/components/BrowserNotificationModal.tsx@@ -28,7 +28,7 @@ export const BrowserNotificationModal = () => {<Dialog.Overlay class="fixed inset-0 z-modal bg-modal-overlay" /><div class="fixed inset-0 z-modal w-screen h-screen flex items-center justify-center"><Dialog.Content class="flex items-center justify-center">- <div class="pointer-events-auto max-w-xl bg-menu border border-edge w-lg h-fit p-2">+ <div class="pointer-events-auto max-w-[min(36rem,calc(100%-1rem))] bg-menu border border-edge w-lg h-fit p-2"><div class="w-full my-1"><h2 class="text-xl mb-3">Enable Browser Notifications</h2>