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: unified split file menu (#5751)
Peter Chinmand0249d78fda4
diff --git a/apps/web/src/components/app/ResponsiveBlockToolbar.tsx b/apps/web/src/components/app/ResponsiveBlockToolbar.tsxindex d710e530d5..8eeb62c5dc 100644--- a/apps/web/src/components/app/ResponsiveBlockToolbar.tsx+++ b/apps/web/src/components/app/ResponsiveBlockToolbar.tsx@@ -1,5 +1,6 @@import type { HotkeyToken } from '@core/hotkey/tokens';import { isTouchDevice } from '@core/mobile/isTouchDevice';+import type { EntityData } from '@entity';import type { ItemType } from '@service-storage/client';import { Button, cn } from '@ui';import { type Component, For, type JSX, Show } from 'solid-js';@@ -18,7 +19,10 @@ import {SplitTitleFileMenu,} from './split-layout/components/SplitLabel';import { SplitToolbarRight } from './split-layout/components/SplitToolbar';-import type { SplitFileMenuAction } from './split-layout/context';+import type {+ SplitFileMenuAction,+ SplitFileMenuActionGroup,+} from './split-layout/context';export type BlockTool = {label: string | (() => string);@@ -30,6 +34,8 @@ export type BlockTool = {buttonComponent?: () => JSX.Element;focusTarget?: () => HTMLElement | null;hotkeyToken?: HotkeyToken;+ /** Menu section this tool renders in when shown in the title file menu. */+ group?: SplitFileMenuActionGroup;};export function ToolButton(props: { tool: BlockTool }) {@@ -89,6 +95,12 @@ interface BlockToolbarProps {itemType: ItemType;name: string;formattedName?: string;+ /**+ * Full entity for the title menu's entity-gated items. Supply it when the+ * block can build one that generic chrome can't reconstruct from+ * id/name/blockName alone (e.g. calls need their channelId).+ */+ entity?: EntityData;}/**@@ -141,19 +153,18 @@ export function ResponsiveBlockToolbar(props: BlockToolbarProps) {</For></div></SplitHeaderRight>- <Show when={props.ops.length > 0}>- <SplitTitleFileMenu>- <SplitFileMenu- id={props.id}- itemType={props.itemType}- name={props.name}- formattedName={props.formattedName}- ops={props.ops}- tools={fileMenuTools()}- buttonClass="order-first"- />- </SplitTitleFileMenu>- </Show>+ <SplitTitleFileMenu>+ <SplitFileMenu+ id={props.id}+ itemType={props.itemType}+ name={props.name}+ formattedName={props.formattedName}+ ops={props.ops}+ tools={fileMenuTools()}+ entity={props.entity}+ buttonClass="order-first"+ />+ </SplitTitleFileMenu><Show when={activeToolbarTools().length > 0}><SplitToolbarRight><For each={activeToolbarTools()}>@@ -173,17 +184,16 @@ export function ResponsiveBlockToolbar(props: BlockToolbarProps) {}><SplitTitleFileMenu>- <Show when={props.ops.length > 0}>- <SplitFileMenu- id={props.id}- itemType={props.itemType}- name={props.name}- formattedName={props.formattedName}- ops={props.ops}- tools={fileMenuTools()}- buttonClass="order-last"- />- </Show>+ <SplitFileMenu+ id={props.id}+ itemType={props.itemType}+ name={props.name}+ formattedName={props.formattedName}+ ops={props.ops}+ tools={fileMenuTools()}+ entity={props.entity}+ buttonClass="order-last"+ /></SplitTitleFileMenu></Show>);diff --git a/apps/web/src/components/app/split-layout/components/HeaderTitleMenu.tsx b/apps/web/src/components/app/split-layout/components/HeaderTitleMenu.tsxdeleted file mode 100644index 7fc93b7157..0000000000--- a/apps/web/src/components/app/split-layout/components/HeaderTitleMenu.tsx+++ /dev/null@@ -1,69 +0,0 @@-import { hapticImpact } from '@core/mobile/haptics';-import CaretDownIcon from '@phosphor/caret-down.svg';-import CheckIcon from '@phosphor/check.svg';-import { Dropdown } from '@ui';-import {- type Component,- For,- type JSX,- type ParentProps,- Show,-} from 'solid-js';-import { Dynamic } from 'solid-js/web';--export type HeaderTitleMenuItem = {- value: string;- label: JSX.Element | string;- icon?: Component<JSX.SvgSVGAttributes<SVGSVGElement>>;-};--/**- * Mobile header pattern: the title island doubles as a view switcher.- * Children render as the dropdown trigger (icon + title) followed by a- * caret; the menu lists the block's views with a check on the active one.- * Used in place of header/toolbar tabs, which are hidden on mobile.- */-export function HeaderTitleMenu(- props: ParentProps<{- items: readonly HeaderTitleMenuItem[];- active?: string;- onSelect: (value: string) => void;- }>-) {- return (- <Dropdown placement="bottom-start">- <Dropdown.Trigger class="ph-no-capture h-8 max-w-full min-w-0 gap-1.5 border-none bg-transparent px-1 text-ink touch:active:bg-transparent">- {props.children}- <CaretDownIcon class="size-3 shrink-0 text-ink-muted" />- </Dropdown.Trigger>- <Dropdown.Content depth={3}>- <Dropdown.Group>- <For each={[...props.items]}>- {(item) => (- <Dropdown.Item- class="h-10 min-w-44 text-sm"- onSelect={() => {- hapticImpact('light');- props.onSelect(item.value);- }}- >- <Show when={item.icon}>- {(icon) => (- <Dynamic- component={icon()}- class="size-4 shrink-0 text-ink-muted"- />- )}- </Show>- <span>{item.label}</span>- <Show when={props.active === item.value}>- <CheckIcon class="ml-auto size-3.5 shrink-0 text-accent" />- </Show>- </Dropdown.Item>- )}- </For>- </Dropdown.Group>- </Dropdown.Content>- </Dropdown>- );-}diff --git a/apps/web/src/components/app/split-layout/components/SplitFileMenu.tsx b/apps/web/src/components/app/split-layout/components/SplitFileMenu.tsxindex f3d54b5566..7a3c0cb7ae 100644--- a/apps/web/src/components/app/split-layout/components/SplitFileMenu.tsx+++ b/apps/web/src/components/app/split-layout/components/SplitFileMenu.tsx@@ -1,5 +1,8 @@import { openBulkEditModal } from '@app/features/entity/bulk-edit/BulkEditEntityModal';import {+ makeAddTagAction,+ makeCopyEntityIdAction,+ makeCopyLinkAction,makeCreateReminderAction,makeFavoriteAction,makeMarkDoneAction,@@ -9,7 +12,7 @@ import { useFeatureFlag } from '@app/lib/analytics/posthog';import { useGlobalNotificationSource } from '@components/app/GlobalAppState';import { MobileDrawer } from '@components/app/mobile/MobileDrawer';import type { BlockTool } from '@components/app/ResponsiveBlockToolbar';-import { useBlockAliasedName, useBlockName } from '@core/block';+import { type BlockName, useBlockAliasedName, useBlockName } from '@core/block';import { useItemOperations } from '@core/component/FileList/useItemOperations';import { toast } from '@core/component/Toast/Toast';import {@@ -19,6 +22,7 @@ import {import { useQuickAccess } from '@core/context/quickAccess';import { useUserId } from '@core/context/user';import { triggerFocusInput } from '@core/directive/focusInput';+import { type HotkeyToken, TOKENS } from '@core/hotkey/tokens';import { isTouchDevice } from '@core/mobile/isTouchDevice';import { useIsDocumentOwner } from '@core/signal/permissions';import { buildEntityData, type EntityData } from '@entity';@@ -27,12 +31,15 @@ import ArrowRight from '@phosphor/arrow-right.svg';import BellSimple from '@phosphor/bell-simple.svg';import CaretDown from '@phosphor/caret-down.svg';import CaretRight from '@phosphor/caret-right.svg';+import Check from '@phosphor/check.svg';import Copy from '@phosphor/copy.svg';+import Link from '@phosphor/link.svg';import Rename from '@phosphor/pencil-line.svg';import Star from '@phosphor/star.svg';+import Tag from '@phosphor/tag.svg';import Trash from '@phosphor/trash-simple.svg';import { blockNameToItemType, type ItemType } from '@service-storage/client';-import { cn, Dropdown } from '@ui';+import { cn, Dropdown, Hotkey } from '@ui';import {type Component,createEffect,@@ -48,9 +55,12 @@ import { Dynamic } from 'solid-js/web';import {getSplitFileMenuActionSections,type SplitFileMenuAction,+ type SplitFileMenuActionGroup,+ type SplitFileMenuActionGroups,SplitPanelContext,} from '../context';import { useSplitLayout } from '../layout';+import { returnSplitToRecentListView } from '../layoutUtils';export type FileOperationName = 'delete' | 'rename' | 'copy' | 'moveToProject';@@ -63,6 +73,7 @@ export type CustomFileOperation = {icon: Component;action?: () => void;children?: SplitFileMenuAction[];+ group?: SplitFileMenuActionGroup;};const isDefaultFileOperation = (@@ -73,8 +84,45 @@ const isDefaultFileOperation = (export type FileOperation = DefaultFileOperation | CustomFileOperation;+/**+ * A titled radio group leading the mobile drawer, mirroring which view (page)+ * of the block is open — for blocks whose inline view tabs have no room on+ * mobile (e.g. the channel's Messages/Attachments/Participants tabs).+ */+export type SplitFileMenuViews = {+ /** Section title shown above the radio group, e.g. 'View'. */+ title: string;+ options: Array<{+ value: string;+ label: string | JSX.Element;+ icon: Component;+ }>;+ value: string;+ onSelect: (value: string) => void;+};++/**+ * Blocks whose Block.tsx calls useBlockEntityCommands(), registering the+ * block-scoped shortcuts the generic ops advertise. Keep in sync with that+ * hook's callers.+ */+const BLOCKS_WITH_ENTITY_HOTKEYS: ReadonlySet<BlockName> = new Set<BlockName>([+ 'canvas',+ 'channel',+ 'chat',+ 'code',+ 'email',+ 'image',+ 'md',+ 'pdf',+ 'project',+ 'video',+]);+function SplitMenuItemContent(- props: Pick<SplitFileMenuAction, 'icon' | 'label'>+ props: Pick<SplitFileMenuAction, 'hotkeyToken' | 'icon' | 'label'> & {+ showHotkey?: boolean;+ }) {return (<>@@ -83,6 +131,14 @@ function SplitMenuItemContent(class="size-4 shrink-0"/><div class="flex-1 truncate">{props.label}</div>+ <Show when={props.showHotkey !== false && props.hotkeyToken}>+ <Hotkey+ token={props.hotkeyToken}+ class="ml-4 shrink-0"+ theme="subtle"+ showPlus+ />+ </Show></>);}@@ -91,17 +147,11 @@ type SplitFileMenuRenderProps = {open: boolean;onOpenChange: (open: boolean) => void;triggerClass?: string;- ops: SplitFileMenuAction[];- tools: SplitFileMenuAction[];+ groups: SplitFileMenuActionGroups;};function DesktopRender(props: SplitFileMenuRenderProps) {- const sections = () =>- getSplitFileMenuActionSections({- tools: props.tools,- primaryOps: props.ops.filter((op) => op.group !== 'delete'),- deleteOps: props.ops.filter((op) => op.group === 'delete'),- });+ const sections = () => getSplitFileMenuActionSections(props.groups);const item = (action: SplitFileMenuAction) => {const children = () => action.children?.filter(Boolean) ?? [];@@ -116,13 +166,13 @@ function DesktopRender(props: SplitFileMenuRenderProps) {props.onOpenChange(false);}}>- <SplitMenuItemContent icon={action.icon} label={action.label} />+ <SplitMenuItemContent {...action} /></Dropdown.Item>}><Dropdown.Sub><Dropdown.SubTrigger>- <SplitMenuItemContent icon={action.icon} label={action.label} />+ <SplitMenuItemContent {...action} /><CaretRight class="size-3.5 shrink-0" /></Dropdown.SubTrigger><Dropdown.SubContent>@@ -144,7 +194,7 @@ function DesktopRender(props: SplitFileMenuRenderProps) {><DotsThree /></Dropdown.Trigger>- <Dropdown.Content class="w-fit shadow-menu">+ <Dropdown.Content class="w-64 shadow-menu"><For each={sections()}>{(section) => (<Dropdown.Group>@@ -157,9 +207,12 @@ function DesktopRender(props: SplitFileMenuRenderProps) {);}-function MobileRender(props: SplitFileMenuRenderProps) {+function MobileRender(+ props: SplitFileMenuRenderProps & { views?: SplitFileMenuViews }+) {const [expandedSubmenu, setExpandedSubmenu] =createSignal<SplitFileMenuAction>();+ const sections = () => getSplitFileMenuActionSections(props.groups);const item = (action: SplitFileMenuAction, nested = false) => {const children = () => action.children?.filter(Boolean) ?? [];@@ -180,7 +233,7 @@ function MobileRender(props: SplitFileMenuRenderProps) {props.onOpenChange(false);}}>- <SplitMenuItemContent icon={action.icon} label={action.label} />+ <SplitMenuItemContent {...action} showHotkey={false} /></button>}>@@ -195,7 +248,7 @@ function MobileRender(props: SplitFileMenuRenderProps) {setExpandedSubmenu(expanded() ? undefined : action);}}>- <SplitMenuItemContent icon={action.icon} label={action.label} />+ <SplitMenuItemContent {...action} showHotkey={false} /><Dynamiccomponent={expanded() ? CaretDown : CaretRight}class="size-3.5 shrink-0"@@ -223,19 +276,65 @@ function MobileRender(props: SplitFileMenuRenderProps) {<MobileDrawer.Overlay class="fixed inset-0 z-modal-overlay bg-modal-overlay pattern-diagonal-4 pattern-edge-muted" /><MobileDrawer.Content aria-label="File actions"><MobileDrawer.Handle />- <Show when={props.tools.length > 0}>- <MobileDrawer.Section class="flex flex-col shrink-0">- <For each={props.tools}>{(action) => item(action)}</For>- </MobileDrawer.Section>- </Show>- <Show when={props.ops.length > 0}>- <Show when={props.tools.length > 0}>- <div class="mt-3" />+ {/* Scrolls when the sections outgrow the drawer's max height; the+ handle stays pinned so drag-to-dismiss remains reachable. */}+ <div class="flex flex-col min-h-0 flex-1 overflow-y-auto">+ <Show when={props.views}>+ {(views) => (+ <>+ <MobileDrawer.Label id="split-file-menu-views-label">+ {views().title}+ </MobileDrawer.Label>+ <MobileDrawer.Section+ role="radiogroup"+ aria-labelledby="split-file-menu-views-label"+ class="flex flex-col shrink-0 mb-3"+ >+ <For each={views().options}>+ {(option) => (+ <button+ type="button"+ role="radio"+ aria-checked={views().value === option.value}+ class="w-full bg-surface flex items-center gap-3 py-3 px-4 text-sm hover:bg-hover hover-transition-bg text-left not-last:mb-px text-ink"+ onClick={() => {+ views().onSelect(option.value);+ props.onOpenChange(false);+ }}+ >+ <SplitMenuItemContent+ icon={option.icon}+ label={option.label}+ showHotkey={false}+ />+ <Show when={views().value === option.value}>+ <Check class="size-3.5 text-accent shrink-0" />+ </Show>+ </button>+ )}+ </For>+ </MobileDrawer.Section>+ {/* With a views group leading the drawer, title the action+ sections to set the two apart. */}+ <Show when={sections().length > 0}>+ <MobileDrawer.Label>Actions</MobileDrawer.Label>+ </Show>+ </>+ )}</Show>- <MobileDrawer.Section class="flex flex-col shrink-0">- <For each={props.ops}>{(action) => item(action)}</For>- </MobileDrawer.Section>- </Show>+ <For each={sections()}>+ {(section, index) => (+ <>+ <Show when={index() > 0}>+ <div class="mt-3" />+ </Show>+ <MobileDrawer.Section class="flex flex-col shrink-0">+ <For each={section.actions}>{(action) => item(action)}</For>+ </MobileDrawer.Section>+ </>+ )}+ </For>+ </div></MobileDrawer.Content></MobileDrawer.Portal></MobileDrawer>@@ -249,6 +348,14 @@ export function SplitFileMenu(props: {formattedName?: string;ops: Array<FileOperation>;tools?: BlockTool[];+ /** See {@link SplitFileMenuViews}. Only the mobile drawer renders it. */+ mobileViews?: SplitFileMenuViews;+ /**+ * Full entity for the menu's entity-gated items. Supply it when the block+ * can build one that generic chrome can't reconstruct from id/name/blockName+ * alone (e.g. calls need their channelId).+ */+ entity?: EntityData;buttonClass?: string;}) {const ctx = useContext(SplitPanelContext);@@ -277,13 +384,22 @@ export function SplitFileMenu(props: {const createReminderAction = makeCreateReminderAction({onCreated: markReminderTargetDone(markDone),});+ const addTagAction = makeAddTagAction();+ const copyLinkAction = makeCopyLinkAction();+ const copyEntityIdAction = makeCopyEntityIdAction();- const { replaceOrInsertSplit, resetSplit } = useSplitLayout();+ // Blocks outside BLOCKS_WITH_ENTITY_HOTKEYS never register these+ // shortcuts, so badging them there would advertise dead shortcuts.+ const blockHotkeyToken = (token: HotkeyToken): HotkeyToken | undefined =>+ BLOCKS_WITH_ENTITY_HOTKEYS.has(blockName) ? token : undefined;- // The entity this menu operates on: prefer the quick-access cache (richer- // data, covers channels/calls), fall back to building it from the block's- // id/name/blockName like the rename/move ops do.+ const { replaceOrInsertSplit } = useSplitLayout();++ // The entity this menu operates on: the block's own entity when supplied,+ // else the quick-access cache (richer data, covers channels/calls), else+ // built from the block's id/name/blockName like the rename/move ops do.const menuEntity = createMemo<EntityData | undefined>(() => {+ if (props.entity) return props.entity;const item = quickAccess.getById(props.id);if (item?.kind === 'entity') return item.data;return buildEntityData({@@ -302,6 +418,8 @@ export function SplitFileMenu(props: {action: () => {void favoriteAction.execute([entity]);},+ hotkeyToken: blockHotkeyToken(TOKENS.entity.action.favorite),+ group: 'macro' as const,};};@@ -328,9 +446,58 @@ export function SplitFileMenu(props: {setOpen(false);createReminderAction.execute([entity]);},+ hotkeyToken: blockHotkeyToken(TOKENS.entity.action.createReminder),+ group: 'macro' as const,+ };+ };++ // Only offered when the block's entity type can be tagged.+ const addTagOp = (): SplitFileMenuAction | undefined => {+ const entity = menuEntity();+ if (!entity || !addTagAction.canExecute(entity)) return undefined;+ return {+ label: 'Add tag',+ icon: Tag,+ action: () => {+ setOpen(false);+ addTagAction.execute([entity]);+ },+ hotkeyToken: blockHotkeyToken(TOKENS.entity.action.tags),+ group: 'macro' as const,+ };+ };++ const copyLinkOp = (): SplitFileMenuAction | undefined => {+ const entity = menuEntity();+ // Foreign PRs link out via their entity URL (GitHub); the block-derived+ // fallback would mint an internal /pr URL that doesn't resolve, so omit+ // the item when the entity is unavailable.+ if (!entity && blockName === 'pr') return undefined;+ return {+ label: 'Copy Link',+ icon: Link,+ action: () => {+ if (entity) {+ void copyLinkAction.execute([entity]);+ } else {+ void copyLinkAction.executeByBlock(props.id, aliasedBlockName);+ }+ },+ hotkeyToken: blockHotkeyToken(TOKENS.entity.action.copyLink),+ group: 'sharing' as const,};};+ const copyEntityIdOp = (): SplitFileMenuAction => ({+ label: 'Copy ID',+ icon: Copy,+ action: () => {+ void copyEntityIdAction.executeById(props.id);+ },+ hotkeyToken: blockHotkeyToken(TOKENS.entity.action.copyEntityId),+ group: 'sharing' as const,+ });+createEffect(() => {const openMenu = () => setOpen(true);ctx.setTitleFileMenuTrigger(() => openMenu);@@ -338,8 +505,6 @@ export function SplitFileMenu(props: {});const ops = createMemo<SplitFileMenuAction[]>(() => {- const favorite = favoriteOp();- const reminder = reminderOp();const mapped = props.ops.map((op) => {if (isDefaultFileOperation(op)) {@@ -348,15 +513,23 @@ export function SplitFileMenu(props: {if (!isOwner()) return null;return {label: 'Delete',- action: async () => {- const res = await itemOperations.deleteItem({- itemType: props.itemType,+ action: () => {+ const entity = buildEntityData({id: props.id,- itemName: props.name,+ name: props.name,+ blockName: aliasedBlockName,+ });+ if (!entity) return;+ setOpen(false);+ openBulkEditModal({+ view: 'delete',+ entities: [entity],+ onFinish: () => {+ toast.success('Deleted');+ returnSplitToRecentListView(ctx.handle);+ },+ onError: () => toast.failure('Failed to delete'),});- if (res) {- resetSplit();- }},icon: Trash,group: 'delete' as const,@@ -382,6 +555,8 @@ export function SplitFileMenu(props: {});},icon: Rename,+ hotkeyToken: blockHotkeyToken(TOKENS.entity.action.rename),+ group: 'file' as const,};case 'copy':@@ -410,6 +585,7 @@ export function SplitFileMenu(props: {}},icon: Copy,+ group: 'file' as const,};case 'moveToProject':@@ -432,6 +608,10 @@ export function SplitFileMenu(props: {});},icon: ArrowRight,+ hotkeyToken: blockHotkeyToken(+ TOKENS.entity.action.moveToFolder+ ),+ group: 'file' as const,};}} else {@@ -439,7 +619,14 @@ export function SplitFileMenu(props: {}}).filter((op) => !!op);- return [favorite, reminder, ...mapped].filter((op) => !!op);+ return [+ favoriteOp(),+ reminderOp(),+ addTagOp(),+ copyLinkOp(),+ copyEntityIdOp(),+ ...mapped,+ ].filter((op) => !!op);});const filteredTools = createMemo(() =>@@ -451,6 +638,8 @@ export function SplitFileMenu(props: {label: typeof tool.label === 'function' ? tool.label() : tool.label,icon: tool.icon,children: tool.children,+ hotkeyToken: tool.hotkeyToken,+ group: tool.group,action: (e?: MouseEvent) => {tool.action();if (tool.focusTarget) {@@ -464,11 +653,23 @@ export function SplitFileMenu(props: {})));- const actionGroups = createMemo(() => ({- tools: tools(),- primaryOps: ops().filter((op) => op.group !== 'delete'),- deleteOps: ops().filter((op) => op.group === 'delete'),- }));+ const actionGroups = createMemo<SplitFileMenuActionGroups>(() => {+ const groups: SplitFileMenuActionGroups = {+ entity: [],+ sender: [],+ sharing: [],+ macro: [],+ file: [],+ delete: [],+ };+ for (const tool of tools()) {+ groups[tool.group ?? 'entity'].push(tool);+ }+ for (const op of ops()) {+ groups[op.group ?? 'entity'].push(op);+ }+ return groups;+ });createEffect(() => {ctx.setTitleFileMenuActions(actionGroups());@@ -484,8 +685,7 @@ export function SplitFileMenu(props: {open={open()}onOpenChange={setOpen}triggerClass={props.buttonClass}- ops={ops()}- tools={tools()}+ groups={actionGroups()}/>}>@@ -493,8 +693,8 @@ export function SplitFileMenu(props: {open={open()}onOpenChange={setOpen}triggerClass={props.buttonClass}- ops={ops()}- tools={tools()}+ groups={actionGroups()}+ views={props.mobileViews}/></Show>);diff --git a/apps/web/src/components/app/split-layout/components/SplitLabel.tsx b/apps/web/src/components/app/split-layout/components/SplitLabel.tsxindex 1ca5217f35..f694643b0e 100644--- a/apps/web/src/components/app/split-layout/components/SplitLabel.tsx+++ b/apps/web/src/components/app/split-layout/components/SplitLabel.tsx@@ -264,6 +264,7 @@ function SplitLabelContextMenu(props: ParentProps) {<MenuItemicon={action.icon as Component<JSX.SvgSVGAttributes<SVGSVGElement>>}text={action.label}+ hotkeyToken={action.hotkeyToken}onClick={() => action.action?.()}/>}@@ -273,7 +274,7 @@ function SplitLabelContextMenu(props: ParentProps) {icon={action.icon as Component<JSX.SvgSVGAttributes<SVGSVGElement>>}text={action.label}/>- <ContextMenuContent submenu width="w-fit">+ <ContextMenuContent submenu class="w-64"><For each={children()}>{item}</For></ContextMenuContent></ContextMenu.Sub>@@ -305,7 +306,7 @@ function SplitLabelContextMenu(props: ParentProps) {{props.children}</ContextMenu.Trigger><ContextMenu.Portal>- <ContextMenuContent width="w-fit">+ <ContextMenuContent class="w-64"><For each={sections()}>{(section, index) => (<>diff --git a/apps/web/src/components/app/split-layout/context.ts b/apps/web/src/components/app/split-layout/context.tsindex c8f496807a..b4c52e09f8 100644--- a/apps/web/src/components/app/split-layout/context.ts+++ b/apps/web/src/components/app/split-layout/context.ts@@ -1,3 +1,4 @@+import type { HotkeyToken } from '@core/hotkey/tokens';import type { NullableSize } from '@solid-primitives/resize-observer';import {type Accessor,@@ -25,15 +26,36 @@ export type SplitFileMenuAction = {icon: Component;action?: (e?: MouseEvent) => void;children?: SplitFileMenuAction[];- group?: 'delete';+ /** Only set when the token's shortcut is executable from the split. */+ hotkeyToken?: HotkeyToken;+ group?: SplitFileMenuActionGroup;};+/** Menu sections, in render order. */export type SplitFileMenuActionGroups = {- primaryOps: SplitFileMenuAction[];- tools: SplitFileMenuAction[];- deleteOps: SplitFileMenuAction[];+ /** Actions specific to the block's entity type, e.g. email's Mark done. */+ entity: SplitFileMenuAction[];+ /** Email sender actions. */+ sender: SplitFileMenuAction[];+ /** Share, Copy Link, Copy ID, and friends. */+ sharing: SplitFileMenuAction[];+ /** Macro platform features: Favorite, Remind me, Add tag. */+ macro: SplitFileMenuAction[];+ /** Non-destructive operations on the file itself: Duplicate, Rename, Move, Download. */+ file: SplitFileMenuAction[];+ /** Destructive actions, always last. */+ delete: SplitFileMenuAction[];};+/**+ * Menu section an action renders in. Untagged tools and ops default to the+ * entity section — a block's own actions are entity-specific unless said+ * otherwise; a `group` tag moves an action to another section (Share and+ * Download live with their injected siblings, email keeps sender actions+ * right below its entity actions).+ */+export type SplitFileMenuActionGroup = keyof SplitFileMenuActionGroups;+export type SplitFileMenuActionSection = {key: keyof SplitFileMenuActionGroups;actions: SplitFileMenuAction[];@@ -43,9 +65,12 @@ export function getSplitFileMenuActionSections(groups: SplitFileMenuActionGroups): SplitFileMenuActionSection[] {const sections: SplitFileMenuActionSection[] = [- { key: 'tools', actions: groups.tools },- { key: 'primaryOps', actions: groups.primaryOps },- { key: 'deleteOps', actions: groups.deleteOps },+ { key: 'entity', actions: groups.entity },+ { key: 'sender', actions: groups.sender },+ { key: 'sharing', actions: groups.sharing },+ { key: 'macro', actions: groups.macro },+ { key: 'file', actions: groups.file },+ { key: 'delete', actions: groups.delete },];return sections.filter((section) => section.actions.length > 0);diff --git a/apps/web/src/components/app/split-layout/layoutUtils.ts b/apps/web/src/components/app/split-layout/layoutUtils.tsindex 413f2bbf50..d898437a52 100644--- a/apps/web/src/components/app/split-layout/layoutUtils.ts+++ b/apps/web/src/components/app/split-layout/layoutUtils.ts@@ -1,4 +1,4 @@-import { LIST_VIEW_ID } from '@app/constants/list-views';+import { isListViewID, LIST_VIEW_ID } from '@app/constants/list-views';import { globalSplitManager } from '@app/signal/splitLayout';import type { BlockAlias, BlockName } from '@core/block';import { isBlockAlias, resolveBlockAlias } from '@core/constant/allBlocks';@@ -131,6 +131,27 @@ export function globalRemoveFromSplitHistory(}}+/**+ * Send a split back to the most recent soup list view in its history — e.g.+ * after deleting the entity it was showing — falling back to a reset (the+ * default inbox) when the history holds none. Reuses the stored entry, so+ * its captured state (scroll, focus) restores like a history-back, while+ * `mergeHistory` drops the split's current entry so the deleted entity does+ * not linger as a back target.+ */+export function returnSplitToRecentListView(handle: SplitHandle) {+ const target = handle+ .history()+ .slice(0, -1)+ .reverse()+ .find((item) => item.type === 'component' && isListViewID(item.id));+ if (target) {+ handle.replace({ next: target, mergeHistory: true });+ } else {+ handle.reset();+ }+}+export function focusAdjacentSplit(direction: 'left' | 'right') {const splitManager = globalSplitManager();if (!splitManager) return;diff --git a/apps/web/src/features/block-automation/component/Automation.tsx b/apps/web/src/features/block-automation/component/Automation.tsxindex b53113d3f0..f054a6181e 100644--- a/apps/web/src/features/block-automation/component/Automation.tsx+++ b/apps/web/src/features/block-automation/component/Automation.tsx@@ -1,15 +1,26 @@+import { openBulkEditModal } from '@app/features/entity/bulk-edit/BulkEditEntityModal';import { HeaderIsland } from '@components/app/split-layout/components/HeaderIsland';+import { SplitFileMenu } from '@components/app/split-layout/components/SplitFileMenu';import { SplitHeaderLeft } from '@components/app/split-layout/components/SplitHeader';+import { SplitTitleFileMenu } from '@components/app/split-layout/components/SplitLabel';import { useSplitLayout } from '@components/app/split-layout/layout';-import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';+import {+ returnSplitToRecentListView,+ useSplitPanelOrThrow,+} from '@components/app/split-layout/layoutUtils';import { useBlockId } from '@core/block';import { EntityIcon } from '@core/component/EntityIcon';import { toast } from '@core/component/Toast/Toast';import { blockNameToDefaultFile } from '@core/constant/allBlocks';import { whenSettled } from '@core/util/whenSettled';import { formatDateAndTime } from '@entity';+import CopyIcon from '@phosphor/copy.svg';+import RenameIcon from '@phosphor/pencil-line.svg';+import TrashIcon from '@phosphor/trash-simple.svg';+import { scheduleToEntity } from '@queries/agent-schedule/entities';import {invalidateSchedules,+ useCreateScheduleMutation,useRunScheduleNowMutation,useScheduleHistoryQuery,useSchedulesQuery,@@ -116,11 +127,16 @@ function HistoryList(props: { records: HistoryRecord[]; isPending: boolean }) {export function Automation() {const scheduleId = useBlockId();const panel = useSplitPanelOrThrow();+ const { replaceOrInsertSplit } = useSplitLayout();const schedulesQuery = useSchedulesQuery(() => true);const schedule = createMemo(() =>schedulesQuery.data?.find((item) => item.id === scheduleId));+ const scheduleEntity = () => {+ const current = schedule();+ return current ? scheduleToEntity(current) : undefined;+ };const [state, setRawState] = createSignal<ScheduleDraft | undefined>();@@ -198,6 +214,51 @@ export function Automation() {toast.alert('Failed to start run', { subtext: getErrorMessage(error) }),});+ const duplicateMutation = useCreateScheduleMutation({+ onSuccess: (created) => {+ toast.success('Duplicated');+ if (created.id) {+ replaceOrInsertSplit(+ { type: 'automation', id: created.id },+ 'entity-actions-menu'+ );+ }+ },+ onError: (error) =>+ toast.alert('Failed to duplicate automation', {+ subtext: getErrorMessage(error),+ }),+ });++ const duplicateAutomation = () => {+ const current = schedule();+ if (!current || duplicateMutation.isPending) return;+ duplicateMutation.mutate({+ enabled: current.enabled,+ kind: current.kind,+ name: `${current.name} copy`,+ schedule: current.schedule,+ task: current.task,+ timezone: current.timezone,+ });+ };++ // Confirms via the shared bulk-delete modal, which routes automations to+ // the scheduled-action API and evicts them from the schedules cache.+ const deleteAutomation = () => {+ const entity = scheduleEntity();+ if (!entity) return;+ openBulkEditModal({+ view: 'delete',+ entities: [entity],+ onFinish: () => {+ toast.success('Deleted');+ returnSplitToRecentListView(panel.handle);+ },+ onError: () => toast.failure('Failed to delete'),+ });+ };+// Treat an action as "running" when the server has a fresh claim on it.// The backend's MAX_ACTION_TIME is 20 minutes — after that a claim is// considered stale (e.g. executor crashed) and we stop showing the@@ -252,9 +313,44 @@ export function Automation() {>{d().name || blockNameToDefaultFile('automation')}</span>+ <div+ class="shrink-0 flex items-center h-full"+ ref={(ref) => panel.setTitleFileMenuRef(ref)}+ /></div></HeaderIsland></SplitHeaderLeft>+ <SplitTitleFileMenu>+ <SplitFileMenu+ id={scheduleId}+ itemType="automation"+ name={d().name || blockNameToDefaultFile('automation')}+ ops={[]}+ // Generic chrome can't reconstruct an AutomationEntity (it+ // lacks the cron), so supply it for entity-gated menu items.+ entity={scheduleEntity()}+ tools={[+ {+ group: 'file',+ label: 'Rename',+ icon: RenameIcon,+ action: () => setRenameOpen(true),+ },+ {+ group: 'file',+ label: 'Duplicate',+ icon: CopyIcon,+ action: duplicateAutomation,+ },+ {+ group: 'delete',+ label: 'Delete',+ icon: TrashIcon,+ action: deleteAutomation,+ },+ ]}+ />+ </SplitTitleFileMenu><AutomationRenameModalisOpen={renameOpen}setIsOpen={setRenameOpen}diff --git a/apps/web/src/features/block-call/component/CallRecording/CallRecordingSplitHeader.tsx b/apps/web/src/features/block-call/component/CallRecording/CallRecordingSplitHeader.tsxindex 9718b57164..267c4ed623 100644--- a/apps/web/src/features/block-call/component/CallRecording/CallRecordingSplitHeader.tsx+++ b/apps/web/src/features/block-call/component/CallRecording/CallRecordingSplitHeader.tsx@@ -23,6 +23,7 @@ import {useShareDialogContext,} from '@core/component/TopBar/ShareButton';import { isMobile } from '@core/mobile/isMobile';+import { buildEntityData } from '@entity';import PhoneCallIcon from '@icon/wide-call.svg';import IconShared from '@icon/wide-share.svg';import type { CallRecord } from '@service-storage/generated/schemas/callRecord';@@ -161,6 +162,16 @@ export function CallRecordingSplitHeader(props: {id={blockId}itemType="call"name={callName()}+ // Generic chrome can't reconstruct a CallEntity (it lacks the+ // channelId), so supply it for the menu's entity-gated items.+ entity={buildEntityData({+ id: record().callId,+ name: callName(),+ blockName: 'call',+ channelId: record().channelId,+ isActive: record().isActive,+ status: record().status ?? undefined,+ })}/></>);diff --git a/apps/web/src/features/block-canvas/component/TopBar.tsx b/apps/web/src/features/block-canvas/component/TopBar.tsxindex fd67f2c98b..2e7107fc33 100644--- a/apps/web/src/features/block-canvas/component/TopBar.tsx+++ b/apps/web/src/features/block-canvas/component/TopBar.tsx@@ -113,6 +113,7 @@ export function TopBar() {{ op: 'rename' },{ op: 'moveToProject' },{+ group: 'file',label: 'Download',icon: DownloadSimple,action: downloadDocument,@@ -146,6 +147,7 @@ export function TopBar() {),},{+ group: 'sharing',label: 'Share',icon: IconShared,action: () => shareCtx.open(),diff --git a/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx b/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsxindex 92297e4c00..711c72d993 100644--- a/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx+++ b/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx@@ -1,4 +1,7 @@-import { useBlockEntityCommands } from '@app/features/next-soup/actions';+import {+ makeRenameAction,+ useBlockEntityCommands,+} from '@app/features/next-soup/actions';import { globalSplitManager } from '@app/signal/splitLayout';import { URL_PARAMS } from '@block-channel/constants';import { convertTargetMessage } from '@block-channel/utils/target-message';@@ -34,7 +37,9 @@ import {} from '@channel/Channel/link';import { ChannelParticipantsTab } from '@channel/Participants/ChannelParticipantsTab';import { HeaderIsland } from '@components/app/split-layout/components/HeaderIsland';+import { SplitFileMenu } from '@components/app/split-layout/components/SplitFileMenu';import { SplitHeaderRight } from '@components/app/split-layout/components/SplitHeader';+import { SplitTitleFileMenu } from '@components/app/split-layout/components/SplitLabel';import {useCanAutofocusSplitContent,useSplitPanelOrThrow,@@ -43,11 +48,20 @@ import { useNavigatedFromJK } from '@components/app/useNavigatedFromJK';import { useBlockId } from '@core/block';import { EntityPermissionsGate } from '@core/component/EntityPermissionsGate';import { ENABLE_CALLS } from '@core/constant/featureFlags';-import { useChannelName, useChannelType } from '@core/context/channels';+import {+ useChannel,+ useChannelName,+ useChannelType,+} from '@core/context/channels';+import { useUserId } from '@core/context/user';import { useHotkeyDOMScope } from '@core/hotkey/hotkeys';+import { TOKENS } from '@core/hotkey/tokens';+import { isMobile } from '@core/mobile/isMobile';import { awaitCondition, createMethodRegistration } from '@core/orchestrator';import { blockHotkeyScopeSignal } from '@core/signal/blockElement';import { blockHandleSignal } from '@core/signal/load';+import { buildEntityData } from '@entity';+import RenameIcon from '@phosphor/pencil-line.svg';import { useActiveCallQuery } from '@queries/call/call';import {fetchResolvedChannelMessage,@@ -67,7 +81,7 @@ import {Suspense,Switch,} from 'solid-js';-import { ChannelTopLeft } from './Top';+import { CHANNEL_TAB_ICONS, ChannelTopLeft } from './Top';import { useChannelBotManagement } from './useChannelBotManagement';const CHANNEL_STATE_ENTRY_KEY = 'channel.state';@@ -126,6 +140,9 @@ function NewTop(props: { channelId: string }) {const { activeTab, setActiveTab } = useChannelTab();const channelName = useChannelName(props.channelId);const channelType = useChannelType(props.channelId);+ const channel = useChannel(props.channelId);+ const userId = useUserId();+ const renameAction = makeRenameAction({ userId });const participantsQuery = useChannelParticipantsQuery(() => props.channelId);const call = useCall(() => props.channelId);const activeCallQuery = useActiveCallQuery(() => props.channelId);@@ -141,17 +158,49 @@ function NewTop(props: { channelId: string }) {call.isJoining() ||activeTab() === 'call' ||!!activeCallQuery.data);- const tabs = () => {+ const availableTabs = () => {let filtered = [...CHANNEL_TABS];if (channelType() === ChannelTypeEnum.DirectMessage)filtered = filtered.filter((tab) => tab.value !== 'participants');if (!showCallTab())filtered = filtered.filter((tab) => tab.value !== 'call');- return filtered.map((tab) =>+ return filtered;+ };+ const tabs = () =>+ availableTabs().map((tab) =>tab.value === 'call' ? { ...tab, label: <CallTabLabel /> } : tab);++ // The generic rename op is gated on the document block-load signals, which+ // the channel block never sets — so the menu offers a channel-local rename+ // built from the channels context instead. The action's own gate keeps it+ // off DMs and channels the user does not own.+ const channelEntity = () => {+ const ch = channel();+ if (!ch) return undefined;+ return buildEntityData({+ id: props.channelId,+ name: ch.name ?? 'New Channel',+ blockName: 'channel',+ channelType: ch.channel_type,+ ownerId: ch.owner_id,+ });};+ // Mobile has no room for inline tabs; the title file-menu drawer leads with+ // them instead, as a titled radio group mirroring the active tab. Built+ // from tabs() so the call tab keeps its live-call label.+ const mobileViews = () => ({+ title: 'View',+ options: tabs().map((tab) => ({+ value: tab.value,+ label: tab.label,+ icon: CHANNEL_TAB_ICONS[tab.value],+ })),+ value: activeTab(),+ onSelect: (value: string) => setActiveTab(value as ChannelTabId),+ });+return (<Suspense><ChannelTopLeft@@ -163,6 +212,35 @@ function NewTop(props: { channelId: string }) {activeTab={activeTab()}onTabChange={setActiveTab}/>+ <SplitTitleFileMenu>+ <SplitFileMenu+ id={props.channelId}+ itemType="channel"+ name={channelName() ?? 'New Channel'}+ ops={[]}+ // Generic chrome can't reconstruct a ChannelEntity (it lacks the+ // channelType), so supply it for the menu's entity-gated items.+ entity={channelEntity()}+ mobileViews={isMobile() ? mobileViews() : undefined}+ tools={[+ {+ group: 'file',+ label: 'Rename',+ icon: RenameIcon,+ hotkeyToken: TOKENS.entity.action.rename,+ action: () => {+ const entity = channelEntity();+ if (!entity) return;+ void renameAction.execute([entity]);+ },+ condition: () => {+ const entity = channelEntity();+ return !!entity && renameAction.canExecute(entity);+ },+ },+ ]}+ />+ </SplitTitleFileMenu>{/* Hidden once the user has joined — the call surface owns the UI. */}<Show when={ENABLE_CALLS() && !call.isInThisChannel()}><SplitHeaderRight>diff --git a/apps/web/src/features/block-channel/component/Top.tsx b/apps/web/src/features/block-channel/component/Top.tsxindex c111b72594..8cd45e4368 100644--- a/apps/web/src/features/block-channel/component/Top.tsx+++ b/apps/web/src/features/block-channel/component/Top.tsx@@ -1,9 +1,9 @@import type { ChannelTabId } from '@channel/Channel/channel-tabs';import { CollapsibleHeaderItem } from '@components/app/split-layout/components/CollapsibleItem';import { HeaderIsland } from '@components/app/split-layout/components/HeaderIsland';-import { HeaderTitleMenu } from '@components/app/split-layout/components/HeaderTitleMenu';import { SplitHeaderLeft } from '@components/app/split-layout/components/SplitHeader';import { SplitLabel } from '@components/app/split-layout/components/SplitLabel';+import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';import { useBlockId } from '@core/block';import type { TabItem } from '@core/component/Tabs';import { TabsInset } from '@core/component/TabsInset';@@ -21,7 +21,7 @@ import { ChannelTypeEnum } from '@service-storage/client';import type { ChannelType } from '@service-storage/generated/schemas/channelType';import { type Component, type JSX, Show } from 'solid-js';-const CHANNEL_TAB_ICONS: Record<+export const CHANNEL_TAB_ICONS: Record<string,Component<JSX.SvgSVGAttributes<SVGSVGElement>>> = {@@ -71,6 +71,7 @@ type ChannelTopLeftProps = TopProps & {};export function ChannelTopLeft(props: ChannelTopLeftProps) {+ const panel = useSplitPanelOrThrow();const blockId = useBlockId();const channelName = useChannelName(blockId,@@ -90,67 +91,40 @@ export function ChannelTopLeft(props: ChannelTopLeftProps) {return (<SplitHeaderLeft>- <Show- when={isTouchDevice() && hasTabsMenu()}- fallback={- <>- <HeaderIsland class="shrink">- <div class="ph-no-capture z-split-header-content relative flex items-center gap-2 max-w-full h-full shrink min-w-15">- <TopIcon- channelType={props.channelType}- participants={props.participants}- />- <SplitLabel- label={channelName() ?? 'New Channel'}- lockRename={props.lockRename}- renameOverrides={{ channelType: props.channelType }}- maxDisplayLength={48}- />- </div>- </HeaderIsland>- <Show when={!isTouchDevice() && hasTabsMenu() && props.activeTab}>- <CollapsibleHeaderItem- id="channel-tabs"- priority={1}- containerClass="ph-no-capture min-w-0 shrink-0 h-full mx-2"- >- {(isCollapsed) => (- <TabsInset- list={- isCollapsed() ? iconTabList() : [...(props.tabs ?? [])]- }- value={props.activeTab}- onChange={(value) =>- props.onTabChange?.(value as ChannelTabId)- }- />- )}- </CollapsibleHeaderItem>- </Show>- </>- }- >- {/* Mobile: the tabs hide behind the channel name — tapping the title- opens a menu of the tab views. */}- <HeaderIsland class="shrink">- <HeaderTitleMenu- items={(props.tabs ?? []).map((tab) => ({- value: tab.value,- label: tab.label,- icon: CHANNEL_TAB_ICONS[tab.value],- }))}- active={props.activeTab}- onSelect={(value) => props.onTabChange?.(value as ChannelTabId)}- >- <TopIcon- channelType={props.channelType}- participants={props.participants}+ <HeaderIsland class="shrink">+ <div class="ph-no-capture z-split-header-content relative flex items-center gap-2 max-w-full h-full shrink min-w-15">+ <TopIcon+ channelType={props.channelType}+ participants={props.participants}+ />+ <SplitLabel+ label={channelName() ?? 'New Channel'}+ lockRename={props.lockRename}+ renameOverrides={{ channelType: props.channelType }}+ maxDisplayLength={48}+ />+ <div+ class="shrink-0 flex items-center h-full"+ ref={(ref) => panel.setTitleFileMenuRef(ref)}+ />+ </div>+ </HeaderIsland>+ {/* Mobile has no room for inline tabs; the title file menu carries the+ tab links there instead (see NewChannelBlockAdapter). */}+ <Show when={!isTouchDevice() && hasTabsMenu() && props.activeTab}>+ <CollapsibleHeaderItem+ id="channel-tabs"+ priority={1}+ containerClass="ph-no-capture min-w-0 shrink-0 h-full mx-2"+ >+ {(isCollapsed) => (+ <TabsInset+ list={isCollapsed() ? iconTabList() : [...(props.tabs ?? [])]}+ value={props.activeTab}+ onChange={(value) => props.onTabChange?.(value as ChannelTabId)}/>- <span class="min-w-0 truncate text-sm font-medium">- {channelName() ?? 'New Channel'}- </span>- </HeaderTitleMenu>- </HeaderIsland>+ )}+ </CollapsibleHeaderItem></Show></SplitHeaderLeft>);diff --git a/apps/web/src/features/block-chat/component/TopBar.tsx b/apps/web/src/features/block-chat/component/TopBar.tsxindex df9daa65b1..fe51b427b3 100644--- a/apps/web/src/features/block-chat/component/TopBar.tsx+++ b/apps/web/src/features/block-chat/component/TopBar.tsx@@ -68,6 +68,7 @@ export function TopBar(props: {const tools: BlockTool[] = [{+ group: 'sharing',label: 'Share',icon: IconShared,action: () => shareCtx.open(),diff --git a/apps/web/src/features/block-code/component/TopBar.tsx b/apps/web/src/features/block-code/component/TopBar.tsxindex 77c42cf537..6a1880c24f 100644--- a/apps/web/src/features/block-code/component/TopBar.tsx+++ b/apps/web/src/features/block-code/component/TopBar.tsx@@ -76,6 +76,7 @@ export const TopBar: Component<{{ op: 'copy' },{ op: 'moveToProject' },{+ group: 'file',label: 'Download',icon: Download,action: downloadDocument,@@ -98,6 +99,7 @@ export const TopBar: Component<{),},{+ group: 'sharing',label: 'Share',icon: IconShared,action: () => shareCtx.open(),diff --git a/apps/web/src/features/block-email/component/TopBar.tsx b/apps/web/src/features/block-email/component/TopBar.tsxindex 0a35e510cf..1dabab2e9c 100644--- a/apps/web/src/features/block-email/component/TopBar.tsx+++ b/apps/web/src/features/block-email/component/TopBar.tsx@@ -3,6 +3,7 @@ import {ChatWithAgentIcon,openChatWithAgent,} from '@app/features/chat/ChatWithAgentButton';+import { makeMoveToProjectAction } from '@app/features/next-soup/actions';import { useMaybeSoup } from '@app/features/next-soup/soup-context';import {openEntityInSplitFromUnifiedList,@@ -11,14 +12,12 @@ import {import type { BlockTool } from '@components/app/ResponsiveBlockToolbar';import { ResponsiveBlockToolbar } from '@components/app/ResponsiveBlockToolbar';import { useSidePanel } from '@components/app/side-panel';-import { SplitFileMenu } from '@components/app/split-layout/components/SplitFileMenu';import {SplitHeaderLeft,SplitHeaderRight,} from '@components/app/split-layout/components/SplitHeader';import {SplitHeaderBadge,- SplitTitleFileMenu,StaticSplitLabel,} from '@components/app/split-layout/components/SplitLabel';import { useSplitPanel } from '@components/app/split-layout/layoutUtils';@@ -33,8 +32,11 @@ import { registerHotkey } from '@core/hotkey/hotkeys';import { TOKENS } from '@core/hotkey/tokens';import { getActiveCommandByToken, runCommand } from '@core/hotkey/utils';import { isMobile } from '@core/mobile/isMobile';+import { buildEntityData } from '@entity';+import { AnimatedNoiseIcon } from '@icon/wide-noise';import IconShared from '@icon/wide-share.svg';import { AnimatedTaskIcon } from '@icon/wide-task';+import ArrowRightIcon from '@phosphor/arrow-right.svg';import CheckIcon from '@phosphor/check.svg';import EnvelopeSimpleIcon from '@phosphor/envelope-simple.svg';import EnvelopeSimpleOpenIcon from '@phosphor/envelope-simple-open.svg';@@ -59,6 +61,7 @@ export function TopBar(props: {const soup = useMaybeSoup();const linksQuery = useEmailLinksQuery();const sidePanel = useSidePanel();+ const moveToProjectAction = makeMoveToProjectAction();if (splitPanel?.splitHotkeyScope) {const reg = registerHotkey({@@ -91,6 +94,28 @@ export function TopBar(props: {const isDone = () => emailCtx.isThreadDone();+ const emailEntity = () => {+ const soupEntity = soup?.items.get(props.id)?.original;+ if (soupEntity?.type === 'email') return soupEntity;++ const thread = emailCtx.thread();+ return buildEntityData({+ id: props.id,+ name: props.title,+ blockName: 'email',+ projectId: thread?.project_id ?? undefined,+ isRead: thread?.is_read,+ isDraft: props.isDraft,+ done: thread ? !thread.inbox_visible : undefined,+ });+ };++ const moveToFolder = () => {+ const entity = emailEntity();+ if (!entity || !moveToProjectAction.canExecute(entity)) return;+ void moveToProjectAction.execute([entity]);+ };+// A send-only thread is permanently done, so neither half of the toggle// does anything — hide it rather than offer a no-op.const showMarkDoneToggle = () => !isDone() || emailCtx.canMarkThreadNotDone();@@ -160,6 +185,7 @@ export function TopBar(props: {};const shareTool: BlockTool = {+ group: 'sharing',label: 'Share',icon: IconShared,action: () => shareCtx.open(),@@ -169,6 +195,35 @@ export function TopBar(props: {};const emailActions: BlockTool[] = [+ {+ label: 'Mark done',+ icon: CheckIcon,+ action: toggleMarkDone,+ condition: () => isOwnThread() && !isDone(),+ hotkeyToken: TOKENS.entity.action.markDone,+ },+ {+ label: 'Mark as not done',+ icon: CheckBoldIcon,+ action: toggleMarkDone,+ condition: () =>+ isOwnThread() && isDone() && emailCtx.canMarkThreadNotDone(),+ hotkeyToken: TOKENS.entity.action.markNotDone,+ },+ {+ label: 'Mark unread',+ icon: EnvelopeSimpleOpenIcon,+ action: toggleMarkUnread,+ condition: () => isOwnThread() && !emailCtx.isThreadMarkedUnread(),+ hotkeyToken: TOKENS.entity.action.markUnread,+ },+ {+ label: 'Mark read',+ icon: EnvelopeSimpleIcon,+ action: toggleMarkUnread,+ condition: () => isOwnThread() && emailCtx.isThreadMarkedUnread(),+ hotkeyToken: TOKENS.entity.action.markRead,+ },{label: 'Ask Macro',icon: ChatWithAgentIcon,@@ -179,20 +234,39 @@ export function TopBar(props: {},condition: () => !!emailCtx.thread()?.db_id,},- shareTool,{- label: 'Task',+ label: 'Create task',icon: AnimatedTaskIcon,action: () => props.onCreateTask?.(),condition: () => !!props.onCreateTask && !!emailCtx.thread()?.db_id,},+ shareTool,+ {+ group: 'file',+ label: 'Move to folder',+ icon: ArrowRightIcon,+ action: moveToFolder,+ condition: () => {+ const entity = emailEntity();+ return !!entity && moveToProjectAction.canExecute(entity);+ },+ },{+ group: 'delete',label: 'Delete',icon: TrashIcon,action: trashThread,condition: isOwnThread,},{+ group: 'sender',+ label: 'Sender → Noise',+ icon: AnimatedNoiseIcon,+ action: () => emailCtx.markSenderNoise(),+ condition: isOwnThread,+ },+ {+ group: 'sender',label: 'Block Sender',icon: ProhibitIcon,action: () => emailCtx.blockSender(),@@ -229,7 +303,7 @@ export function TopBar(props: {class="ph-no-capture"iconType={isInvite() ? 'emailInvite' : 'email'}colorIcon={isInvite()}- label={isMobile() ? '' : props.title}+ label={props.title}badges={props.isDraft? [@@ -243,22 +317,6 @@ export function TopBar(props: {/></SplitHeaderLeft>- <SplitTitleFileMenu>- <Show- when={emailActions.some(- (action) => !action.condition || action.condition()- )}- >- <SplitFileMenu- id={props.id}- itemType="email"- name={props.title}- ops={[]}- tools={emailActions}- />- </Show>- </SplitTitleFileMenu>-{/* Desktop-only Mark done button, sitting just left of the Previous itemcaret. On mobile this action lives in the bottom reply bar instead.A done thread shows a bold accent check and unarchives on click. */}@@ -316,6 +374,7 @@ export function TopBar(props: {<ResponsiveBlockToolbartools={tools}+ menuTools={emailActions}ops={[]}id={props.id}itemType="email"diff --git a/apps/web/src/features/block-image/component/TopBar.tsx b/apps/web/src/features/block-image/component/TopBar.tsxindex 125790cd4b..fcc08310d9 100644--- a/apps/web/src/features/block-image/component/TopBar.tsx+++ b/apps/web/src/features/block-image/component/TopBar.tsx@@ -61,6 +61,7 @@ export function TopBar() {{ op: 'copy' },{ op: 'moveToProject' },{+ group: 'file',label: 'Download',icon: Download,action: downloadDocument,@@ -83,6 +84,7 @@ export function TopBar() {),},{+ group: 'sharing',label: 'Share',icon: IconShared,action: () => shareCtx.open(),diff --git a/apps/web/src/features/block-md/component/TopBar.tsx b/apps/web/src/features/block-md/component/TopBar.tsxindex d256997f62..cb996a36d5 100644--- a/apps/web/src/features/block-md/component/TopBar.tsx+++ b/apps/web/src/features/block-md/component/TopBar.tsx@@ -22,7 +22,6 @@ import {import { useSplitPanel } from '@components/app/split-layout/layoutUtils';import { useBlockAliasedName, useBlockId, useBlockName } from '@core/block';import { BlockLiveIndicators } from '@core/component/LiveIndicators';-import { toast } from '@core/component/Toast/Toast';import {getShareDrawerRecipientInput,ShareTrigger,@@ -34,7 +33,6 @@ import { isMobile } from '@core/mobile/isMobile';import { blockHotkeyScopeSignal } from '@core/signal/blockElement';import { copyBranchNameToClipboard } from '@core/util/branchName';import { useBlockDocumentName } from '@core/util/currentBlockDocumentName';-import { buildSimpleEntityUrl } from '@core/util/url';import Download from '@phosphor/download.svg';import GitBranch from '@phosphor/git-branch.svg';import IconLink from '@phosphor/link.svg';@@ -65,15 +63,6 @@ export function TopBar(props: { name?: Accessor<string | undefined> } = {}) {const isSkill = blockAliasedName === 'skill';const dispatchAgentActions = useDispatchAgentSplitFileActions();- const copyLink = () => {- const url = buildSimpleEntityUrl({ id: blockId, type: blockAliasedName });- navigator.clipboard.writeText(url);- toast.success('Link copied to clipboard.', {- subtext:- 'Sending this link in a Macro message will automatically update permissions to include recipients.',- });- };-const copyBranchName = () => copyBranchNameToClipboard(blockId);if (isTask) {@@ -104,6 +93,7 @@ export function TopBar(props: { name?: Accessor<string | undefined> } = {}) {...(isTask? ([{+ group: 'sharing' as const,label: 'Copy Branch Name',icon: GitBranch,action: copyBranchName,@@ -111,6 +101,7 @@ export function TopBar(props: { name?: Accessor<string | undefined> } = {}) {] satisfies FileOperation[]): []),{+ group: 'file',label: 'Download',icon: Download,action: downloadAsMarkdownText,@@ -178,18 +169,13 @@ export function TopBar(props: { name?: Accessor<string | undefined> } = {}) {),},{+ group: 'sharing',label: 'Share',icon: IconLink,action: () => shareCtx.open(),buttonComponent: () => <ShareTrigger />,focusTarget: getShareDrawerRecipientInput,},- {- label: 'Copy Link',- icon: IconLink,- action: copyLink,- condition: isMobile,- },];const menuTools: BlockTool[] = [diff --git a/apps/web/src/features/block-pdf/component/TopBar.tsx b/apps/web/src/features/block-pdf/component/TopBar.tsxindex 4e4204a825..8a84bc785a 100644--- a/apps/web/src/features/block-pdf/component/TopBar.tsx+++ b/apps/web/src/features/block-pdf/component/TopBar.tsx@@ -162,6 +162,7 @@ export function TopBar() {action: () => printFile(),},{+ group: 'file',label: 'Download',icon: DownloadIcon,action: download,@@ -169,6 +170,7 @@ export function TopBar() {...(fileType === 'docx'? [{+ group: 'file',label: 'Download DOCX',icon: DownloadIcon,action: downloadDocx,@@ -214,6 +216,7 @@ export function TopBar() {),},{+ group: 'sharing',label: 'Share',icon: IconShared,action: () => shareCtx.open(),diff --git a/apps/web/src/features/block-pr/component/PrSplitHeader.tsx b/apps/web/src/features/block-pr/component/PrSplitHeader.tsxindex ba208abc45..2b37cecdec 100644--- a/apps/web/src/features/block-pr/component/PrSplitHeader.tsx+++ b/apps/web/src/features/block-pr/component/PrSplitHeader.tsx@@ -6,12 +6,10 @@ import type { FileOperation } from '@components/app/split-layout/components/Spliimport { SplitHeaderLeft } from '@components/app/split-layout/components/SplitHeader';import { StaticSplitLabel } from '@components/app/split-layout/components/SplitLabel';import { useBlockId } from '@core/block';-import { toast } from '@core/component/Toast/Toast';-import { buildSimpleEntityUrl, openExternalUrl } from '@core/util/url';+import { openExternalUrl } from '@core/util/url';import GithubIcon from '@icon/mcp-github.svg';import GitMerge from '@phosphor/git-merge.svg';import GitPullRequest from '@phosphor/git-pull-request.svg';-import LinkIcon from '@phosphor/link.svg';import type { GithubPullRequest } from '@service-storage/generated/schemas';import { cn, Layer } from '@ui';import { Show } from 'solid-js';@@ -88,13 +86,6 @@ export function PrSplitHeader(props: {const title = () => props.enrichment?.name ?? prDisplayName(props.prRef);const githubUrl = () => props.enrichment?.url ?? prHtmlUrl(props.prRef);- const copyLink = async () => {- await navigator.clipboard.writeText(- buildSimpleEntityUrl({ type: 'pr', id: blockId })- );- toast.success('Link copied to clipboard');- };-const ops: FileOperation[] = [{label: 'Open on GitHub',@@ -103,13 +94,7 @@ export function PrSplitHeader(props: {},];- const tools: BlockTool[] = [- {- label: 'Copy link',- icon: LinkIcon,- action: copyLink,- },- ];+ const tools: BlockTool[] = [];return (<>diff --git a/apps/web/src/features/block-project/component/TopBar.tsx b/apps/web/src/features/block-project/component/TopBar.tsxindex ab72a05a17..38bdf742cd 100644--- a/apps/web/src/features/block-project/component/TopBar.tsx+++ b/apps/web/src/features/block-project/component/TopBar.tsx@@ -106,6 +106,7 @@ export function TopBar() {),},{+ group: 'sharing',label: 'Share',icon: IconShared,action: () => shareCtx.open(),@@ -131,15 +132,13 @@ export function TopBar() {</SplitHeaderRight><ResponsivePermissionsBadge /><SplitTitleFileMenu>- <Show when={ops().length > 0 || (isMobile() && !isSpecialProject)}>- <SplitFileMenu- id={id}- itemType="project"- name={name()}- ops={ops()}- tools={isMobile() ? [...toolbarTools(), ...createTools] : undefined}- />- </Show>+ <SplitFileMenu+ id={id}+ itemType="project"+ name={name()}+ ops={ops()}+ tools={isMobile() ? [...toolbarTools(), ...createTools] : undefined}+ /></SplitTitleFileMenu><Show when={!isMobile()}><SplitToolbarLeft class="flex-0">diff --git a/apps/web/src/features/block-unknown/component/TopBar.tsx b/apps/web/src/features/block-unknown/component/TopBar.tsxindex 11b05b267e..f969d8ef81 100644--- a/apps/web/src/features/block-unknown/component/TopBar.tsx+++ b/apps/web/src/features/block-unknown/component/TopBar.tsx@@ -66,6 +66,7 @@ export function TopBar() {{ op: 'copy' },{ op: 'moveToProject' },{+ group: 'file',label: 'Download',icon: DownloadSimple,action: downloadDocument,@@ -88,6 +89,7 @@ export function TopBar() {),},{+ group: 'sharing',label: 'Share',icon: IconShared,action: () => shareCtx.open(),diff --git a/apps/web/src/features/block-video/component/TopBar.tsx b/apps/web/src/features/block-video/component/TopBar.tsxindex 4b9cad7ebe..9f2fc1b985 100644--- a/apps/web/src/features/block-video/component/TopBar.tsx+++ b/apps/web/src/features/block-video/component/TopBar.tsx@@ -83,6 +83,7 @@ export function TopBar() {{ op: 'copy' },{ op: 'moveToProject' },{+ group: 'file',label: 'Download',icon: Download,action: downloadDocument,@@ -105,6 +106,7 @@ export function TopBar() {),},{+ group: 'sharing',label: 'Share',icon: IconShared,action: () => shareCtx.open(),diff --git a/apps/web/src/features/entity/bulk-edit/BulkDeleteView.tsx b/apps/web/src/features/entity/bulk-edit/BulkDeleteView.tsxindex 7b1f2084f0..bee8b813d2 100644--- a/apps/web/src/features/entity/bulk-edit/BulkDeleteView.tsx+++ b/apps/web/src/features/entity/bulk-edit/BulkDeleteView.tsx@@ -12,6 +12,7 @@ export const BulkDeleteView = (props: {entities: EntityData[];onFinish: () => void;onCancel: () => void;+ onError?: (error: unknown) => void;}) => {const bulkDelete = createBulkDeleteDssItemsMutation();let deleteButton: HTMLButtonElement | undefined;@@ -30,6 +31,7 @@ export const BulkDeleteView = (props: {props.onFinish();} catch (error) {console.error('Failed to delete entities:', error);+ props.onError?.(error);}};diff --git a/apps/web/src/features/entity/bulk-edit/BulkEditEntityModal.tsx b/apps/web/src/features/entity/bulk-edit/BulkEditEntityModal.tsxindex 0ac561d3e5..089540eab3 100644--- a/apps/web/src/features/entity/bulk-edit/BulkEditEntityModal.tsx+++ b/apps/web/src/features/entity/bulk-edit/BulkEditEntityModal.tsx@@ -67,6 +67,7 @@ const BulkEditEntityModalContent = (props: {entities={props.entities}onFinish={handleFinish}onCancel={handleCancel}+ onError={handleError}/></Show></div>diff --git a/apps/web/src/features/next-soup/actions/index.ts b/apps/web/src/features/next-soup/actions/index.tsindex bb736a5e78..b87f00701e 100644--- a/apps/web/src/features/next-soup/actions/index.ts+++ b/apps/web/src/features/next-soup/actions/index.ts@@ -1,3 +1,4 @@+export { makeAddTagAction } from './make-add-tag-action';export { makeBlockSenderAction } from './make-block-sender-action';export { makeCopyAction } from './make-copy-action';export { makeCopyBranchNameAction } from './make-copy-branch-name-action';diff --git a/apps/web/src/features/next-soup/actions/make-add-tag-action.ts b/apps/web/src/features/next-soup/actions/make-add-tag-action.tsnew file mode 100644index 0000000000..e6b34da2b6--- /dev/null+++ b/apps/web/src/features/next-soup/actions/make-add-tag-action.ts@@ -0,0 +1,21 @@+import {+ openPropertyEditor,+ type PropertyEditorEntity,+} from '@property/editor/state/propertyEditor';+import { canTagEntity } from '@property/tags/entityTagging';++/** Open the tag editor for entities supported by the tagging domain. */+export const makeAddTagAction = () => {+ const canExecute = (entity: PropertyEditorEntity): boolean =>+ canTagEntity(entity);++ const execute = (+ entities: PropertyEditorEntity[],+ options?: Parameters<typeof openPropertyEditor>[3]+ ) => {+ if (entities.length === 0 || !entities.every(canExecute)) return;+ openPropertyEditor(entities, 'tag', undefined, options);+ };++ return { canExecute, execute };+};diff --git a/apps/web/src/features/next-soup/actions/make-copy-link-action.ts b/apps/web/src/features/next-soup/actions/make-copy-link-action.tsindex 6b667d3a06..85b7dcdddb 100644--- a/apps/web/src/features/next-soup/actions/make-copy-link-action.ts+++ b/apps/web/src/features/next-soup/actions/make-copy-link-action.ts@@ -67,10 +67,19 @@ export const makeCopyLinkAction = () => {toast.success('Link copied to clipboard');};+ /** Blocks already know their id and URL discriminator even when their full+ * entity is absent from Quick Access (notably email threads and calls). */+ const executeByBlock = async (id: string, blockType: string) => {+ await navigator.clipboard.writeText(+ buildSimpleEntityUrl({ id, type: blockType })+ );+ toast.success('Link copied to clipboard');+ };+const executeWithSoup = async (entities: EntityData[], _soup: SoupState) => {await execute(entities);// Don't clear selection or change focus for copy link};- return { canExecute, execute, executeWithSoup };+ return { canExecute, execute, executeByBlock, executeWithSoup };};diff --git a/apps/web/src/features/next-soup/actions/make-move-to-project-action.ts b/apps/web/src/features/next-soup/actions/make-move-to-project-action.tsindex 03250440dd..1eee9f689a 100644--- a/apps/web/src/features/next-soup/actions/make-move-to-project-action.ts+++ b/apps/web/src/features/next-soup/actions/make-move-to-project-action.ts@@ -27,6 +27,7 @@ export const makeMoveToProjectAction = () => {: 'Moved to folder');},+ onError: () => toast.failure('Failed to move to folder'),});};@@ -50,6 +51,7 @@ export const makeMoveToProjectAction = () => {);restoreSoupFocus(nextRow?.id);},+ onError: () => toast.failure('Failed to move to folder'),onCancel: () => {const firstEntity = entities[0];if (firstEntity) {diff --git a/apps/web/src/features/next-soup/actions/use-block-entity-commands.ts b/apps/web/src/features/next-soup/actions/use-block-entity-commands.tsindex 9982e4cccc..9c595fb092 100644--- a/apps/web/src/features/next-soup/actions/use-block-entity-commands.ts+++ b/apps/web/src/features/next-soup/actions/use-block-entity-commands.ts@@ -17,9 +17,9 @@ import { blockHotkeyScopeSignal } from '@core/signal/blockElement';import { type EntityData, isDocumentEntity, isTaskEntity } from '@entity';import { SYSTEM_PROPERTY_IDS } from '@property/constants';import type { Property, PropertyDefinitionDomain } from '@property/types';-import { macroEntityToPropertyEntityType } from '@property/utils';import { createEffect, onCleanup } from 'solid-js';import {+ makeAddTagAction,makeCopyAction,makeCopyBranchNameAction,makeCopyEntityIdAction,@@ -70,6 +70,7 @@ export const useBlockEntityCommands = (const copyBranchNameAction = makeCopyBranchNameAction();const copyEntityIdAction = makeCopyEntityIdAction();const favoriteAction = makeFavoriteAction();+ const addTagAction = makeAddTagAction();const allProperties = useAllProperties();@@ -101,15 +102,6 @@ export const useBlockEntityCommands = (});}};- const canAssignTags = (entity: EntityData) => {- try {- macroEntityToPropertyEntityType(entity);- return true;- } catch {- return false;- }- };-// The 'e' hotkey from inside a block is reserved for entities opened from// the inbox/mail lists, mirroring the j/k gating in// use-soup-navigation-hotkeys.@@ -463,7 +455,7 @@ export const useBlockEntityCommands = (keyDownHandler: () => {const entity = getEntity();if (!entity) return false;- openPropertyEditor([entity], 'tag', undefined, {+ addTagAction.execute([entity], {restoreFocus: () => {if (soup) return restoreSoupFocus(entity.id);},@@ -472,7 +464,7 @@ export const useBlockEntityCommands = (},condition: () => {const entity = getEntity();- return entity !== undefined && canAssignTags(entity);+ return entity !== undefined && addTagAction.canExecute(entity);},displayPriority: 10,tags: [HotkeyTags.SelectionModification],diff --git a/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.ts b/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.tsindex 1a88d5eac8..74c3b58752 100644--- a/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.ts+++ b/apps/web/src/features/next-soup/actions/use-entity-action-hotkeys.ts@@ -16,10 +16,10 @@ import { TOKENS } from '@core/hotkey/tokens';import { type EntityData, isTaskEntity } from '@entity';import { SYSTEM_PROPERTY_IDS } from '@property/constants';import type { Property, PropertyDefinitionDomain } from '@property/types';-import { macroEntityToPropertyEntityType } from '@property/utils';import { onCleanup } from 'solid-js';import type { SoupState } from '../create-soup-state';import {+ makeAddTagAction,makeCopyAction,makeCopyBranchNameAction,makeCopyEntityIdAction,@@ -96,6 +96,7 @@ export const useEntityActionHotkeys = (const favoriteAction = makeFavoriteAction();const setCompanyPropertyAction = makeSetCompanyPropertyAction();+ const addTagAction = makeAddTagAction();const getEntitiesForAction = (): EntityData[] => {if (@@ -171,15 +172,6 @@ export const useEntityActionHotkeys = (});}};- const canAssignTags = (entity: EntityData) => {- try {- macroEntityToPropertyEntityType(entity);- return true;- } catch {- return false;- }- };-// Mark Done - 'e', not included in Hotkey Group so that we can use it from inside of blocksregisterHotkey({hotkey: ['e'],@@ -599,7 +591,7 @@ export const useEntityActionHotkeys = (keyDownHandler: () => {const entities = getEntitiesForAction();if (entities.length === 0) return false;- openPropertyEditor(entities, 'tag', undefined, {+ addTagAction.execute(entities, {restoreFocus: () => restoreSoupFocus(entities[0]?.id),});return true;@@ -607,7 +599,7 @@ export const useEntityActionHotkeys = (condition: () => {if (condition && !condition()) return false;const entities = getEntitiesForAction();- return entities.length > 0 && entities.every(canAssignTags);+ return entities.length > 0 && entities.every(addTagAction.canExecute);},scopeId,}).withGroup(group);diff --git a/apps/web/src/features/next-soup/soup-view/SoupEntityActionDrawer.tsx b/apps/web/src/features/next-soup/soup-view/SoupEntityActionDrawer.tsxindex dccf151358..e989f20d67 100644--- a/apps/web/src/features/next-soup/soup-view/SoupEntityActionDrawer.tsx+++ b/apps/web/src/features/next-soup/soup-view/SoupEntityActionDrawer.tsx@@ -63,43 +63,48 @@ export function SoupEntityActionDrawer() {)}</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"- disabled={action.disabled}- class={cn(- 'flex items-center gap-3 px-4 py-3 text-sm hover:bg-hover hover-transition-bg text-left not-last:mb-px bg-surface',- action.destructive ? 'text-failure-ink' : 'text-ink',- action.disabled && 'opacity-50'- )}- onClick={async (e: MouseEvent) => {- if (action.id === 'share') {- triggerFocusInput(- getShareDrawerRecipientInput,- e.currentTarget as HTMLElement- );- }- await action.onClick();- drawerState.close();- }}- >- {action.label}- </button>- )}- </For>- </MobileDrawer.Section>- </>- )}- </For>+ {/* Action groups. Scrolls when the groups outgrow the drawer's max+ height; the handle and entity preview stay pinned. */}+ <div class="flex flex-col min-h-0 flex-1 overflow-y-auto">+ <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"+ disabled={action.disabled}+ class={cn(+ 'flex items-center gap-3 px-4 py-3 text-sm hover:bg-hover hover-transition-bg text-left not-last:mb-px bg-surface',+ action.destructive+ ? 'text-failure-ink'+ : 'text-ink',+ action.disabled && 'opacity-50'+ )}+ onClick={async (e: MouseEvent) => {+ if (action.id === 'share') {+ triggerFocusInput(+ getShareDrawerRecipientInput,+ e.currentTarget as HTMLElement+ );+ }+ await action.onClick();+ drawerState.close();+ }}+ >+ {action.label}+ </button>+ )}+ </For>+ </MobileDrawer.Section>+ </>+ )}+ </For>+ </div></MobileDrawer.Content></MobileDrawer.Portal></MobileDrawer>diff --git a/apps/web/src/features/next-soup/soup-view/soup-entity-context-menu.tsx b/apps/web/src/features/next-soup/soup-view/soup-entity-context-menu.tsxindex 2f52f7d779..ec452d5bdb 100644--- a/apps/web/src/features/next-soup/soup-view/soup-entity-context-menu.tsx+++ b/apps/web/src/features/next-soup/soup-view/soup-entity-context-menu.tsx@@ -1,10 +1,14 @@import { ContextMenuContent } from '@core/component/ContextMenu';import { touchHandler } from '@core/directive/touchHandler';import { isMobile } from '@core/mobile/isMobile';-import { type EntityData, isTaskEntity } from '@entity';+import type { EntityData } from '@entity';import { ContextMenu } from '@kobalte/core/context-menu';-import { TagPickerPopover, useSoupDocTags } from '@property/tags';-import { EntityType } from '@service-properties/generated/schemas/entityType';+import {+ TagPickerPopover,+ tagEntityType,+ useSoupDocTags,+} from '@property/tags';+import type { EntityType } from '@service-properties/generated/schemas/entityType';import type { SoupProperty } from '@service-storage/generated/schemas/soupProperty';import {type Accessor,@@ -14,7 +18,7 @@ import {Show,Switch,} from 'solid-js';-import { match } from 'ts-pattern';+import { makeAddTagAction } from '../actions';import { useSoupEntityActionDrawer } from './soup-entity-action-drawer-context';import { SoupEntityActionsMenu } from './soup-entity-actions-menu';import { useSoupView } from './soup-view-context';@@ -24,17 +28,6 @@ interface SoupEntityContextMenuProps {onOpenChange?: (open: boolean) => void;}-function tagEntityType(entity: EntityData): EntityType | undefined {- return match(entity)- .when(isTaskEntity, () => EntityType.TASK)- .with({ type: 'document' }, () => EntityType.DOCUMENT)- .with({ type: 'email' }, () => EntityType.THREAD)- .with({ type: 'project' }, () => EntityType.PROJECT)- .with({ type: 'chat' }, () => EntityType.CHAT)- .with({ type: 'call' }, () => EntityType.CALL_RECORD)- .otherwise(() => undefined);-}-// Detached tag picker anchored at the position the context menu opened from.// Mounted only while open, so picker state resets on every invocation.function RowTagPicker(props: {@@ -67,6 +60,7 @@ export const SoupEntityContextMenu: FlowComponent<> = (props) => {const { soup } = useSoupView();const drawerManager = useSoupEntityActionDrawer();+ const addTagAction = makeAddTagAction();const [tagPickerOpen, setTagPickerOpen] = createSignal(false);const [menuPosition, setMenuPosition] = createSignal<{@@ -84,7 +78,7 @@ export const SoupEntityContextMenu: FlowComponent<return [props.entity];};- const canEditTags = () => tagEntityType(props.entity) !== undefined;+ const canEditTags = () => addTagAction.canExecute(props.entity);return (<Switch>@@ -115,7 +109,7 @@ export const SoupEntityContextMenu: FlowComponent<</ContextMenu.Trigger><ContextMenu.Portal><Show when={props.entity}>- <ContextMenuContent class="text-xs text-ink-muted">+ <ContextMenuContent class="w-64 text-xs text-ink-muted"><SoupEntityActionsMenuentities={menuEntities()}soup={soup}diff --git a/apps/web/src/features/property/editor/PropertyEditorModal.tsx b/apps/web/src/features/property/editor/PropertyEditorModal.tsxindex fc4f18d44a..6f94b48069 100644--- a/apps/web/src/features/property/editor/PropertyEditorModal.tsx+++ b/apps/web/src/features/property/editor/PropertyEditorModal.tsx@@ -21,7 +21,7 @@ import { SYSTEM_PROPERTY_IDS } from '@property/constants';import { OptionCheckBox } from '@property/editors/selectors/OptionCheckBox';import { usePropertySelection } from '@property/hooks';import { usePropertyEntityDisplay } from '@property/hooks/usePropertyEntityDisplay';-import { useDocTags } from '@property/tags';+import { canTagEntity, useDocTags } from '@property/tags';import { TagDot } from '@property/tags/TagDot';import {TagEditorDialog,@@ -203,15 +203,6 @@ function propertyEditorEntityType(entity: PropertyEditorEntity): EntityType {return macroEntityToPropertyEntityType(entity);}-function canAssignTags(entity: PropertyEditorEntity): boolean {- try {- propertyEditorEntityType(entity);- return true;- } catch {- return false;- }-}-function propertyEditorEntityName(entity: PropertyEditorEntity): string {return entity.name || 'Entity';}@@ -465,7 +456,7 @@ function PropertyList(props: {const query = props.searchTerm.toLowerCase().trim();return (- propertyEditorState.selectedEntities.every(canAssignTags) &&+ propertyEditorState.selectedEntities.every(canTagEntity) &&(!query || 'tags'.includes(query) || 'label'.includes(query)));});diff --git a/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.tsx b/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.tsxindex bbcbb883eb..ccb71bdac0 100644--- a/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.tsx+++ b/apps/web/src/features/property/side-panel/properties/EntityPropertiesSection.tsx@@ -19,7 +19,7 @@ import {} from '@property/context/PropertiesContext';import { useAllProperties } from '@property/editor/hooks/useAllProperties';import { useEntityProperties, usePropertyEntityDisplay } from '@property/hooks';-import { TagsRow } from '@property/tags';+import { isTaggableEntityType, TagsRow } from '@property/tags';import type {Property,PropertyApiValues,@@ -81,21 +81,12 @@ export interface EntityTagsSectionProps {order?: number;}-const TAGGABLE_ENTITY_TYPES: ReadonlySet<EntityType> = new Set<EntityType>([- 'DOCUMENT',- 'TASK',- 'THREAD',- 'PROJECT',- 'CHAT',- 'CALL_RECORD',-]);-export function EntityTagsSection(props: EntityTagsSectionProps) {const tagsQuery = useTagsQuery();const isAuthenticated = useIsAuthenticated();return (- <Show when={TAGGABLE_ENTITY_TYPES.has(props.entityType)}>+ <Show when={isTaggableEntityType(props.entityType)}><SidePanel.Section id="tags" title="Tags" defaultOpen order={props.order}><Showwhen={isAuthenticated() !== false && !tagsQuery.isError}@@ -311,8 +302,7 @@ export function EntityPropertiesSection(props: EntityPropertiesSectionProps) {<Showwhen={- props.showTags !== false &&- TAGGABLE_ENTITY_TYPES.has(props.entityType)+ props.showTags !== false && isTaggableEntityType(props.entityType)}><div class="mb-2 flex items-center gap-3">diff --git a/apps/web/src/features/property/tags/entityTagging.ts b/apps/web/src/features/property/tags/entityTagging.tsnew file mode 100644index 0000000000..0b5b5c6997--- /dev/null+++ b/apps/web/src/features/property/tags/entityTagging.ts@@ -0,0 +1,61 @@+import { type EntityData, isTaskEntity } from '@entity/types/entity';+import {+ EntityType,+ type EntityType as PropertyEntityType,+} from '@service-properties/generated/schemas/entityType';+import { match, P } from 'ts-pattern';++/** Property-service entity types that currently support tags in the UI. */+const TAGGABLE_ENTITY_TYPES: ReadonlySet<PropertyEntityType> = new Set([+ EntityType.DOCUMENT,+ EntityType.TASK,+ EntityType.THREAD,+ EntityType.PROJECT,+ EntityType.CHAT,+ EntityType.CALL_RECORD,+]);++export function isTaggableEntityType(entityType: PropertyEntityType): boolean {+ return TAGGABLE_ENTITY_TYPES.has(entityType);+}++/** Resolve a full Macro entity to the identity used by tag mutations. */+export function tagEntityType(+ entity: EntityData+): PropertyEntityType | undefined {+ if (isTaskEntity(entity)) return EntityType.TASK;++ return match(entity.type)+ .with('document', () => EntityType.DOCUMENT)+ .with('email', () => EntityType.THREAD)+ .with('project', () => EntityType.PROJECT)+ .with('chat', () => EntityType.CHAT)+ .with('call', () => EntityType.CALL_RECORD)+ .with(+ P.union(+ 'channel',+ 'channel_message',+ 'channel_thread',+ 'crm_company',+ 'crm_contact',+ 'automation',+ 'reminder',+ 'calendar_event',+ 'foreign'+ ),+ () => undefined+ )+ .exhaustive();+}++/**+ * Whether tags can be offered for a tag-mutation target: either a full Macro+ * entity, or the minimal `{ entityType }` shape the property editor accepts+ * when no full entity is available (the second arm of PropertyEditorEntity).+ */+export function canTagEntity(+ entity: EntityData | { entityType: PropertyEntityType }+): boolean {+ if ('entityType' in entity) return isTaggableEntityType(entity.entityType);+ return tagEntityType(entity) !== undefined;+}diff --git a/apps/web/src/features/property/tags/index.ts b/apps/web/src/features/property/tags/index.tsindex e04a179935..a219080936 100644--- a/apps/web/src/features/property/tags/index.ts+++ b/apps/web/src/features/property/tags/index.ts@@ -4,6 +4,11 @@ export {InlineFetchedEntityTagsPill,InlineTagsPill,} from './EntityRowTags';+export {+ canTagEntity,+ isTaggableEntityType,+ tagEntityType,+} from './entityTagging';export { TagPicker, TagPickerPopover } from './TagPicker';export { TagsRow } from './TagsRow';export { DEFAULT_TAG_COLOR, TAG_COLORS } from './tagColors';diff --git a/apps/web/src/lib/core/component/ContextMenu.tsx b/apps/web/src/lib/core/component/ContextMenu.tsxindex bd9dffdbea..a62af40040 100644--- a/apps/web/src/lib/core/component/ContextMenu.tsx+++ b/apps/web/src/lib/core/component/ContextMenu.tsx@@ -300,14 +300,6 @@ function MobileConditionalOverlay();}-type MenuWidth = 'sm' | 'md' | 'lg' | `w-${string}` | 'screen';-const menuWidths: Record<MenuWidth, string> = {- sm: 'w-28',- md: 'w-44',- lg: 'w-72',- screen: 'w-screen',-};-const MENU_SURFACE_SCOPE = '[--color-surface:var(--color-menu)]';export const MENU_CONTENT_CLASS = `flex flex-col justify-start items-start border border-edge bg-menu ${MENU_SURFACE_SCOPE} shadow-menu rounded-xl p-1.5 cursor-default select-none max-w-full max-h-[calc(100dvh-10rem)] overflow-y-auto z-modal menu-open-animation`;@@ -315,7 +307,6 @@ export const MENU_CONTENT_CLASS = `flex flex-col justify-start items-start bordetype MenuContentProps = ParentProps<{class?: string;submenu?: boolean;- width?: MenuWidth;onOpenAutoFocus?: (event: Event) => void;onCloseAutoFocus?: (event: Event) => void;overrideStyling?: boolean;@@ -425,7 +416,6 @@ export function ContextMenuContent(props: ParentProps<MenuContentProps>) {!props.overrideStyling && MENU_CONTENT_CLASS,'menu-open-animation',props.class,- props.width && menuWidths[props.width],props.mobileFullScreen &&isMobile() &&'flex flex-col justify-center px-4 max-h-[80vh] shrink w-[calc(100vw-1rem)]'@@ -442,11 +432,7 @@ export function ContextMenuContent(props: ParentProps<MenuContentProps>) {<ContextMenu.Portal><Layer depth={2}><ContextMenu.SubContent- class={cn(- MENU_CONTENT_CLASS,- props.class,- props.width && menuWidths[props.width]- )}+ class={cn(MENU_CONTENT_CLASS, props.class)}ref={contentRef}>{props.children}diff --git a/apps/web/src/lib/queries/agent-schedule/entities.ts b/apps/web/src/lib/queries/agent-schedule/entities.tsindex ee654ec1af..b1fd21a306 100644--- a/apps/web/src/lib/queries/agent-schedule/entities.ts+++ b/apps/web/src/lib/queries/agent-schedule/entities.ts@@ -14,7 +14,7 @@ function isClaimActive(claimed: string | undefined | null): boolean {return Date.now() - Date.parse(claimed) < MAX_CLAIMED_MS;}-function scheduleToEntity(+export function scheduleToEntity(schedule: ScheduledAction): AutomationEntity | undefined {if (!schedule.id) return undefined;