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
fix(drive): hide broken search and add ctx menus (#6526)
Seamus51bc8c81f531
diff --git a/apps/web/src/components/app/app-sidebar/sidebar.tsx b/apps/web/src/components/app/app-sidebar/sidebar.tsxindex 429fe4142d..3f8d15276f 100644--- a/apps/web/src/components/app/app-sidebar/sidebar.tsx+++ b/apps/web/src/components/app/app-sidebar/sidebar.tsx@@ -1720,6 +1720,9 @@ interface SidebarOpenInSplitMenuProps {* account rows scope the freshly opened mail list to their inbox.*/onOpened?: (split: SplitHandle, action: SidebarOpenAction) => void;+ /** View-owned navigation for rows that select a location inside this split. */+ onOpenCurrentSplit?: () => void;+ onOpenFullscreen?: () => void;onOpenChange?: (open: boolean) => void;/*** Overrides the trigger's default `h-7`, which otherwise clips triggers of a@@ -1727,6 +1730,7 @@ interface SidebarOpenInSplitMenuProps {* size utility here wins.*/triggerClass?: string;+ additionalActions?: JSX.Element;children: JSX.Element;}@@ -1744,6 +1748,10 @@ export const SidebarOpenInSplitMenu = (props: SidebarOpenInSplitMenuProps) => {const canOpenFullscreen = () => layout.getSplitCount() > 1;const openInCurrentSplit = () => {+ if (props.onOpenCurrentSplit) {+ props.onOpenCurrentSplit();+ return;+ }const split = layout.openWithSplit(props.content(), {allowDuplicate: true,mergeHistory: false,@@ -1768,6 +1776,11 @@ export const SidebarOpenInSplitMenu = (props: SidebarOpenInSplitMenuProps) => {};const openFullscreen = () => {+ if (props.onOpenFullscreen) {+ props.onOpenFullscreen();+ globalSplitManager()?.returnFocus();+ return;+ }const split = layout.replaceAllSplits(props.content(), {referredFrom: 'sidebar',});@@ -1792,6 +1805,7 @@ export const SidebarOpenInSplitMenu = (props: SidebarOpenInSplitMenuProps) => {<MenuItem text="Open fullscreen" onClick={openFullscreen} /></Show><MenuItem text="Open in current split" onClick={openInCurrentSplit} />+ {props.additionalActions}</ContextMenuContent></ContextMenu.Portal></ContextMenu>diff --git a/apps/web/src/features/drive-view/components/drive-navigation.tsx b/apps/web/src/features/drive-view/components/drive-navigation.tsxindex 5790db0e72..42982483b7 100644--- a/apps/web/src/features/drive-view/components/drive-navigation.tsx+++ b/apps/web/src/features/drive-view/components/drive-navigation.tsx@@ -2,34 +2,39 @@ import { ViewSidebar } from '@app/components/view-shell';import ClockIcon from '@phosphor/clock.svg';import FilesIcon from '@phosphor/files.svg';import UsersIcon from '@phosphor/users.svg';-import { For } from 'solid-js';+import { For, type ParentComponent } from 'solid-js';import { Dynamic } from 'solid-js/web';import { DRIVE_TABS, type DriveLocation, type DriveTab } from '../core/types';const icons = { owned: FilesIcon, recent: ClockIcon, shared: UsersIcon };+export type DriveLocationMenu = ParentComponent<{ location: DriveLocation }>;+export function DriveNavigation(props: {location: DriveLocation;onNavigate: (tab: DriveTab) => void;+ locationMenu: DriveLocationMenu;}) {return (<ViewSidebar.Nav aria-label="Drive views"><For each={DRIVE_TABS}>{(tab) => (- <ViewSidebar.Item- active={- props.location.kind === 'tab' && props.location.tab === tab.id- }- class="font-normal"- onClick={() => props.onNavigate(tab.id)}- >- <Dynamic- component={icons[tab.id]}- class="size-4 shrink-0"- aria-hidden="true"- />- <span class="truncate">{tab.label}</span>- </ViewSidebar.Item>+ <props.locationMenu location={{ kind: 'tab', tab: tab.id }}>+ <ViewSidebar.Item+ active={+ props.location.kind === 'tab' && props.location.tab === tab.id+ }+ class="font-normal"+ onClick={() => props.onNavigate(tab.id)}+ >+ <Dynamic+ component={icons[tab.id]}+ class="size-4 shrink-0"+ aria-hidden="true"+ />+ <span class="truncate">{tab.label}</span>+ </ViewSidebar.Item>+ </props.locationMenu>)}</For></ViewSidebar.Nav>diff --git a/apps/web/src/features/drive-view/components/folder-tree.tsx b/apps/web/src/features/drive-view/components/folder-tree.tsxindex d52538bbac..63c7a1e8b0 100644--- a/apps/web/src/features/drive-view/components/folder-tree.tsx+++ b/apps/web/src/features/drive-view/components/folder-tree.tsx@@ -4,6 +4,7 @@ import FolderIcon from '@phosphor/folder.svg';import { Button, cn } from '@ui';import { For, Show } from 'solid-js';import type { DriveFolderNode } from '../core/types';+import type { DriveLocationMenu } from './drive-navigation';export function FolderTree(props: {nodes: DriveFolderNode[];@@ -12,6 +13,7 @@ export function FolderTree(props: {searching: boolean;onToggle: (id: string) => void;onSelect: (id: string) => void;+ locationMenu: DriveLocationMenu;}) {return (<ul class="flex min-w-0 flex-col gap-0.5">@@ -21,48 +23,52 @@ export function FolderTree(props: {props.searching || props.expandedIds.includes(node.id);return (<li class="min-w-0">- <div- class={cn(- 'flex min-w-0 items-center rounded-xl',- props.selectedId === node.id ? 'bg-active' : 'hover:bg-hover'- )}- >- <Show- when={node.children.length > 0}- fallback={<span class="w-6 shrink-0" />}- >- <Button- variant="ghost"- size="sm"- square- class="size-6 shrink-0 rounded-lg not-disabled:hover:bg-transparent not-touch:not-disabled:hover:bg-none not-touch:not-disabled:active:bg-none"- aria-label={`${open() ? 'Collapse' : 'Expand'} ${node.name}`}- aria-expanded={open()}- onClick={() => props.onToggle(node.id)}- >- <CaretRightIcon- class={cn(- 'size-3 transition-transform',- open() && 'rotate-90'- )}- />- </Button>- </Show>- <ViewSidebar.Item+ <props.locationMenu location={{ kind: 'folder', id: node.id }}>+ <divclass={cn(- 'min-w-0 flex-1 justify-start px-2 font-normal bg-transparent not-disabled:hover:bg-transparent not-touch:not-disabled:hover:bg-none not-touch:not-disabled:active:bg-none',- props.selectedId === node.id && 'text-ink'+ 'flex min-w-0 items-center rounded-xl',+ props.selectedId === node.id+ ? 'bg-active'+ : 'hover:bg-hover')}- title={node.name}- aria-current={- props.selectedId === node.id ? 'page' : undefined- }- onClick={() => props.onSelect(node.id)}>- <FolderIcon class="size-4 shrink-0" />- <span class="truncate">{node.name}</span>- </ViewSidebar.Item>- </div>+ <Show+ when={node.children.length > 0}+ fallback={<span class="w-6 shrink-0" />}+ >+ <Button+ variant="ghost"+ size="sm"+ square+ class="size-6 shrink-0 rounded-lg not-disabled:hover:bg-transparent not-touch:not-disabled:hover:bg-none not-touch:not-disabled:active:bg-none"+ aria-label={`${open() ? 'Collapse' : 'Expand'} ${node.name}`}+ aria-expanded={open()}+ onClick={() => props.onToggle(node.id)}+ >+ <CaretRightIcon+ class={cn(+ 'size-3 transition-transform',+ open() && 'rotate-90'+ )}+ />+ </Button>+ </Show>+ <ViewSidebar.Item+ class={cn(+ 'min-w-0 flex-1 justify-start px-2 font-normal bg-transparent not-disabled:hover:bg-transparent not-touch:not-disabled:hover:bg-none not-touch:not-disabled:active:bg-none',+ props.selectedId === node.id && 'text-ink'+ )}+ title={node.name}+ aria-current={+ props.selectedId === node.id ? 'page' : undefined+ }+ onClick={() => props.onSelect(node.id)}+ >+ <FolderIcon class="size-4 shrink-0" />+ <span class="truncate">{node.name}</span>+ </ViewSidebar.Item>+ </div>+ </props.locationMenu><Show when={open() && node.children.length > 0}><div class="ml-3 border-l border-edge pl-3"><FolderTree {...props} nodes={node.children} />diff --git a/apps/web/src/features/drive-view/drive-folder-actions.tsx b/apps/web/src/features/drive-view/drive-folder-actions.tsxnew file mode 100644index 0000000000..abf5a52363--- /dev/null+++ b/apps/web/src/features/drive-view/drive-folder-actions.tsx@@ -0,0 +1,72 @@+import { openBulkEditModal } from '@app/features/entity/bulk-edit/BulkEditEntityModal';+import {+ makeCopyLinkAction,+ makeDeleteAction,+ makeFavoriteAction,+} from '@app/features/next-soup/actions';+import { MenuItem, MenuSeparator } from '@core/component/ContextMenu';+import { toast } from '@core/component/Toast/Toast';+import { useUserId } from '@core/context/user';+import type { ProjectEntity } from '@entity';+import { invalidateProjects } from '@queries/storage/projects';+import type { Project } from '@service-storage/generated/schemas/project';+import { Show } from 'solid-js';++/** App wiring for sidebar folder actions using the shared list dialogs and mutations. */+export function DriveFolderActions(props: { folder: Project }) {+ const userId = useUserId();+ const entity = (): ProjectEntity => ({+ type: 'project',+ id: props.folder.id,+ name: props.folder.name,+ ownerId: props.folder.userId,+ projectId: props.folder.parentId ?? undefined,+ });+ const favorite = makeFavoriteAction();+ const copyLink = makeCopyLinkAction();+ const deleteFolder = makeDeleteAction({+ userId,+ onDeleted: () => void invalidateProjects(),+ });++ const editFolder = (view: 'rename' | 'moveToProject') => {+ openBulkEditModal({+ view,+ entities: [entity()],+ onFinish: () => {+ void invalidateProjects();+ toast.success(view === 'rename' ? 'Renamed' : 'Moved to folder');+ },+ onError: () => toast.failure('Failed to update folder'),+ });+ };++ return (+ <>+ <MenuSeparator />+ <Show when={entity().ownerId === userId()}>+ <MenuItem text="Rename" onClick={() => editFolder('rename')} />+ </Show>+ <MenuItem+ text={favorite.isFavorited(entity()) ? 'Unfavorite' : 'Favorite'}+ onClick={() => void favorite.execute([entity()])}+ />+ <MenuItem+ text="Move to folder"+ onClick={() => editFolder('moveToProject')}+ />+ <MenuItem+ text="Copy Link"+ onClick={() => void copyLink.execute([entity()])}+ />+ <Show when={deleteFolder.canExecute(entity())}>+ <MenuSeparator />+ <MenuItem+ text="Delete"+ class="text-failure-ink"+ onClick={() => void deleteFolder.execute([entity()])}+ />+ </Show>+ </>+ );+}diff --git a/apps/web/src/features/drive-view/drive-view.tsx b/apps/web/src/features/drive-view/drive-view.tsxindex ffa5fbe44f..f59979a4c7 100644--- a/apps/web/src/features/drive-view/drive-view.tsx+++ b/apps/web/src/features/drive-view/drive-view.tsx@@ -17,6 +17,7 @@ import {runCreateAction,useCreatableEnabled,} from '@app/features/command/Launcher';+import { FavoriteContextMenu } from '@app/features/favorites/FavoriteContextMenu';import { FavoriteIcon } from '@app/features/favorites/FavoriteIcon';import { makeShareAction } from '@app/features/next-soup/actions';import type { Query } from '@app/features/next-soup/filters/filter-store';@@ -35,8 +36,10 @@ import {useFavoriteDisplayName,} from '@app/util/favorites';import { useHandleFileUpload } from '@app/util/handleFileUpload';+import { SidebarOpenInSplitMenu } from '@components/app/app-sidebar/sidebar';import { useEntryState } from '@components/app/split-layout/entry-state';import { useSplitLayout } from '@components/app/split-layout/layout';+import type { SplitContent } from '@components/app/split-layout/layoutManager';import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';import { useUserId } from '@core/context/user';import { isTouchDevice } from '@core/mobile/isTouchDevice';@@ -58,10 +61,11 @@ import { useFavoritesData } from '@queries/favorites/favorites';import { useProjectsQuery } from '@queries/storage/projects';import type { Favorite } from '@service-storage/generated/schemas/favorite';import { Dropdown, EmptyStatePanel } from '@ui';-import { createMemo, For, onCleanup, Show, Suspense } from 'solid-js';+import { batch, createMemo, For, onCleanup, Show, Suspense } from 'solid-js';import { Dynamic } from 'solid-js/web';import { DriveLocationBreadcrumbItems } from './components/DriveBreadcrumbs';import { DriveDetailView } from './components/DriveDetailView';+import type { DriveLocationMenu } from './components/drive-navigation';import { driveLocationBreadcrumbs } from './core/breadcrumbs';import { driveLocationLabel } from './core/location-label';import {@@ -70,6 +74,7 @@ import {type DriveState,type DriveTab,} from './core/types';+import { DriveFolderActions } from './drive-folder-actions';import { createDriveNavigation } from './primitives/drive-navigation';import { driveFilterTab, driveQuery } from './queries/drive-query';import { createDriveResults } from './queries/drive-results';@@ -114,14 +119,16 @@ function DriveFavorite(props: {}) {const name = useFavoriteDisplayName(props.favorite);return (- <ViewSidebar.Item- class="font-normal"- title={name()}- onClick={(event) => props.onOpen(props.favorite, name(), event)}- >- <FavoriteIcon favorite={props.favorite} class="size-4 shrink-0" />- <span class="truncate">{name()}</span>- </ViewSidebar.Item>+ <FavoriteContextMenu favorite={props.favorite} triggerClass="block">+ <ViewSidebar.Item+ class="font-normal"+ title={name()}+ onClick={(event) => props.onOpen(props.favorite, name(), event)}+ >+ <FavoriteIcon favorite={props.favorite} class="size-4 shrink-0" />+ <span class="truncate">{name()}</span>+ </ViewSidebar.Item>+ </FavoriteContextMenu>);}@@ -207,7 +214,7 @@ function DriveViewContent(props: DriveViewProps) {? mergeQuery(queryStateFrom(initial.filters), props.initialFilters): initial.filters,initialClientFilters: props.initialClientFilters ?? initial.clientFilters,- initialSearchText: view.searchText(),+ initialSearchText: projectId() ? '' : view.searchText(),preferInitialFilters: true,sortMethod: () => (isRecent() ? 'touched_by_me' : undefined),persistFilters: false,@@ -226,6 +233,7 @@ function DriveViewContent(props: DriveViewProps) {enabled: panel.isPanelActive,search: {description: 'Search Drive',+ condition: () => !projectId() && !navigationStack.active(),run: () => {searchInput?.focus();searchInput?.select();@@ -390,6 +398,56 @@ function DriveViewContent(props: DriveViewProps) {</ViewSidebar.Nav>);+ const LocationMenu: DriveLocationMenu = (menuProps) => {+ const folder = () => {+ const location = menuProps.location;+ return location.kind === 'folder'+ ? folders().find((folder) => folder.id === location.id)+ : undefined;+ };+ const content = (): SplitContent => ({+ type: 'component',+ id: 'documents',+ state: {+ 'drive.view': {+ ...state(),+ location: menuProps.location,+ scope: 'default',+ } satisfies DriveState,+ },+ });+ const openFullscreen = () => {+ const manager = globalSplitManager();+ if (!manager) return;++ // Keep this Drive instance so the chosen location is applied to its navigation.+ batch(() => {+ navigate(menuProps.location);+ for (const split of manager.splits()) {+ if (split.id !== panel.handle.id) manager.removeSplit(split.id);+ }+ manager.unSpotlightSplit();+ panel.handle.activate();+ });+ };++ return (+ <SidebarOpenInSplitMenu+ content={content}+ triggerClass="block h-auto"+ onOpenCurrentSplit={() => navigate(menuProps.location)}+ onOpenFullscreen={openFullscreen}+ additionalActions={+ <Show when={folder()}>+ {(folder) => <DriveFolderActions folder={folder()} />}+ </Show>+ }+ >+ {menuProps.children}+ </SidebarOpenInSplitMenu>+ );+ };+return (<ViewBreadcrumbs.Rootvalue={@@ -445,6 +503,7 @@ function DriveViewContent(props: DriveViewProps) {}}/><DriveLayout+ locationMenu={LocationMenu}state={state()}folders={folders()}foldersLoading={projects.isPending}diff --git a/apps/web/src/features/drive-view/views/drive-layout.tsx b/apps/web/src/features/drive-view/views/drive-layout.tsxindex 314d08f405..e19c7fd529 100644--- a/apps/web/src/features/drive-view/views/drive-layout.tsx+++ b/apps/web/src/features/drive-view/views/drive-layout.tsx@@ -12,7 +12,10 @@ import SearchIcon from '@phosphor/magnifying-glass.svg';import { Button, Dropdown } from '@ui';import { createMemo, createSignal, type JSX, Show } from 'solid-js';import { DriveBreadcrumbsOutlet } from '../components/DriveBreadcrumbs';-import { DriveNavigation } from '../components/drive-navigation';+import {+ type DriveLocationMenu,+ DriveNavigation,+} from '../components/drive-navigation';import { FolderTree } from '../components/folder-tree';import { buildFolderTree, filterFolderTree } from '../core/folder-tree';import { driveLocationLabel } from '../core/location-label';@@ -41,6 +44,7 @@ export function DriveLayout(props: {onRootOpen: (open: boolean) => void;createMenu: () => JSX.Element;favorites: () => JSX.Element;+ locationMenu: DriveLocationMenu;detail?: JSX.Element;children: JSX.Element;}) {@@ -60,6 +64,7 @@ export function DriveLayout(props: {const SidebarContent = () => (<><DriveNavigation+ locationMenu={props.locationMenu}location={props.state.location}onNavigate={(tab) => {props.onTab(tab);@@ -113,18 +118,20 @@ export function DriveLayout(props: {/></Show><ViewSidebar.Nav aria-label="Folders">- <ViewSidebar.Item- active={selectedFolder() === null}- onClick={() => {- props.onFolder(null);- setNavigationOpen(false);- }}- >- <ViewSidebar.Icon>- <FolderIcon class="size-4" />- </ViewSidebar.Icon>- <span>Drive</span>- </ViewSidebar.Item>+ <props.locationMenu location={{ kind: 'folder', id: null }}>+ <ViewSidebar.Item+ active={selectedFolder() === null}+ onClick={() => {+ props.onFolder(null);+ setNavigationOpen(false);+ }}+ >+ <ViewSidebar.Icon>+ <FolderIcon class="size-4" />+ </ViewSidebar.Icon>+ <span>Drive</span>+ </ViewSidebar.Item>+ </props.locationMenu><div class="ml-3 border-l border-edge pl-3"><Showwhen={!props.foldersLoading}@@ -149,6 +156,7 @@ export function DriveLayout(props: {}><FolderTree+ locationMenu={props.locationMenu}nodes={filteredTree()}selectedId={selectedFolder()}expandedIds={props.state.expandedFolderIds}@@ -245,20 +253,18 @@ export function DriveLayout(props: {</div></div><div class="flex min-w-0 items-center justify-between gap-3">- <SearchBar- ref={props.searchRef}- label="Search Drive"- placeholder={- selectedFolder()- ? 'Search this folder'- : 'Search files'- }- value={props.search}- onValueChange={props.onSearch}- hotkey="cmd+f"- class="max-w-md flex-1"- />- <div class="flex shrink-0 items-center gap-2">+ <Show when={!selectedFolder()}>+ <SearchBar+ ref={props.searchRef}+ label="Search Drive"+ placeholder="Search files"+ value={props.search}+ onValueChange={props.onSearch}+ hotkey="cmd+f"+ class="max-w-md flex-1"+ />+ </Show>+ <div class="ml-auto flex shrink-0 items-center gap-2"><Showwhen={!(diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.mdindex b03a0adfbf..1cfed0ce14 100644--- a/docs/AGENT_GUIDE/surfaces.md+++ b/docs/AGENT_GUIDE/surfaces.md@@ -399,7 +399,14 @@ file details. Empty folders show `This folder is empty` and a `Back to Drive`action that returns to the folder overview. Folder search retains matchingdescendants' ancestors and reveals their branches.-`Search Drive` searches the current tab or folder. The **Filter** menu reuses the+`Search Drive` searches the current tab or folder overview; search within a folder+is temporarily hidden, including its Cmd+F shortcut. The sidebar's folder-name+search remains available. Right-click any Drive view, the Drive folder overview,+or a folder at any depth for **Open in new split**, **Open in current split**, and+**Open fullscreen** (when multiple splits are open). Folder menus also offer+Favorite/Unfavorite, Move to folder, Copy Link, and owner-only Rename and Delete.+Favorites use the same open actions and **Remove from favorites** menu as Tasks.+The **Filter** menu reuses thelegacy **Type**, searchable **Tags**, and **Created by** submenus alongside **Files**for Default, All files, and Email attachments. Created by is hidden while My Filesis restricted to your own files. Recent offers only file-scope filtering.