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(drive): add tags section to Drive sidebar beneath folders (#6591)
Peter Chinman4ac3e19509c7
diff --git a/apps/web/src/features/drive-view/core/types.ts b/apps/web/src/features/drive-view/core/types.tsindex 42cb535809..bf4cf68a44 100644--- a/apps/web/src/features/drive-view/core/types.ts+++ b/apps/web/src/features/drive-view/core/types.ts@@ -21,6 +21,7 @@ export type DriveState = {expandedFolderIds: string[];favoritesOpen: boolean;rootOpen: boolean;+ tagsOpen: boolean;};export const DRIVE_TABS = [diff --git a/apps/web/src/features/drive-view/drive-view.tsx b/apps/web/src/features/drive-view/drive-view.tsxindex cb2bb1686e..bd89f9a902 100644--- a/apps/web/src/features/drive-view/drive-view.tsx+++ b/apps/web/src/features/drive-view/drive-view.tsx@@ -155,6 +155,7 @@ function DriveViewContent(props: DriveViewProps) {expandedFolderIds: [],favoritesOpen: true,rootOpen: true,+ tagsOpen: true,},});onCleanup(@@ -184,15 +185,17 @@ function DriveViewContent(props: DriveViewProps) {) && isCreatableEnabled(block.blockName));+ /** Exit any inline detail so the list reflects the chosen location or tags. */+ const showList = () => {+ navigationStack.clear();+ panel.handle.resetPreview();+ };const { navigate, setScope } = createDriveNavigation({state,setState,folders,results: createDriveResults(view, userId),- onNavigate: () => {- navigationStack.clear();- panel.handle.resetPreview();- },+ onNavigate: showList,});const selectTab = (tab: DriveTab) => navigate({ kind: 'tab', tab });const selectFolder = (id: string | null) => navigate({ kind: 'folder', id });@@ -496,102 +499,115 @@ function DriveViewContent(props: DriveViewProps) {selectFolder(parentId ?? null);}}/>- <DriveLayout- locationMenu={LocationMenu}- state={state()}- folders={folders()}- foldersLoading={projects.isPending}- foldersError={projects.isError}- onRetryFolders={() => void projects.refetch()}- search={view.searchText()}- onSearch={view.setSearchText}- searchRef={(element) => {- searchInput = element;- }}- onTab={selectTab}- onFolder={selectFolder}- filterMenu={FilterMenu}- onSort={(sort) => {- setState((current) => ({ ...current, sort }));- view.soup.sort.setAll([sort]);- }}- onToggleFolder={(id) =>- setState((current) => ({- ...current,- expandedFolderIds: current.expandedFolderIds.includes(id)- ? current.expandedFolderIds.filter((value) => value !== id)- : [...current.expandedFolderIds, id],- }))- }- onFavoritesOpen={(favoritesOpen) =>- setState((current) => ({ ...current, favoritesOpen }))- }- onRootOpen={(rootOpen) =>- setState((current) => ({ ...current, rootOpen }))- }- createMenu={CreateMenu}- favorites={Favorites}- detail={- navigationStack.active() ? (- <TagSetsProvider tagSets={view.tagFilter.tagSets}>+ <TagSetsProvider tagSets={view.tagFilter.tagSets}>+ <DriveLayout+ locationMenu={LocationMenu}+ state={state()}+ folders={folders()}+ foldersLoading={projects.isPending}+ foldersError={projects.isError}+ onRetryFolders={() => void projects.refetch()}+ search={view.searchText()}+ onSearch={view.setSearchText}+ searchRef={(element) => {+ searchInput = element;+ }}+ onTab={selectTab}+ onFolder={selectFolder}+ filterMenu={FilterMenu}+ onSort={(sort) => {+ setState((current) => ({ ...current, sort }));+ view.soup.sort.setAll([sort]);+ }}+ onToggleFolder={(id) =>+ setState((current) => ({+ ...current,+ expandedFolderIds: current.expandedFolderIds.includes(id)+ ? current.expandedFolderIds.filter((value) => value !== id)+ : [...current.expandedFolderIds, id],+ }))+ }+ onFavoritesOpen={(favoritesOpen) =>+ setState((current) => ({ ...current, favoritesOpen }))+ }+ onRootOpen={(rootOpen) =>+ setState((current) => ({ ...current, rootOpen }))+ }+ activeTagIds={view.tagFilter.activeIds()}+ onTags={(ids) =>+ batch(() => {+ view.tagFilter.onChange(ids);+ showList();+ })+ }+ onTagsOpen={(tagsOpen) =>+ setState((current) => ({ ...current, tagsOpen }))+ }+ createMenu={CreateMenu}+ favorites={Favorites}+ detail={+ navigationStack.active() ? (<DriveDetailViewbreadcrumbOrderOffset={locationBreadcrumbs().length}/>- </TagSetsProvider>- ) : undefined- }- >- <Suspense- fallback={- <div class="grid size-full place-items-center text-ink-muted">- <SpinnerIcon- aria-label="Loading files"- class="size-5 animate-spin"- />- </div>+ ) : undefined}>- <SoupViewList- emptyState={- projectId() && state().scope === 'default'- ? () => (- <EmptyStatePanel- centered- graphic={EmptyStateFolderGraphic}- title="This folder is empty"- description="Create something new or drop files here to add them to this folder."- primaryAction={{- label: 'Back to Drive',- icon: ArrowLeftIcon,- onClick: () => selectFolder(null),- }}- />- )- : undefined+ <Suspense+ fallback={+ <div class="grid size-full place-items-center text-ink-muted">+ <SpinnerIcon+ aria-label="Loading files"+ class="size-5 animate-spin"+ />+ </div>}- onOpenProject={selectFolder}- onOpenEntity={(entity, event) => {- if (entity.type !== 'document') return false;+ >+ <SoupViewList+ emptyState={+ // A folder emptied by a tag filter is a filter miss, not a vacant folder.+ projectId() &&+ state().scope === 'default' &&+ view.tagFilter.activeIds().length === 0+ ? () => (+ <EmptyStatePanel+ centered+ graphic={EmptyStateFolderGraphic}+ title="This folder is empty"+ description="Create something new or drop files here to add them to this folder."+ primaryAction={{+ label: 'Back to Drive',+ icon: ArrowLeftIcon,+ onClick: () => selectFolder(null),+ }}+ />+ )+ : undefined+ }+ onOpenProject={selectFolder}+ onOpenEntity={(entity, event) => {+ if (entity.type !== 'document') return false;- const target = entityDetailTarget.document({- id: entity.id,- fileType: entity.fileType,- subType: entity.subType,- fallbackName: entity.name,- });- if (!entityDetailBlockType(target)) return false;- if (!navigationStack.shouldNavigate(target, { event }))- return false;- navigationStack.reset(target);- return true;- }}- uploadProjectId={projectId()}- disableTabHotkeys- navigationKey={JSON.stringify([state().location, state().scope])}- timestamp={isRecent() ? (entity) => entity.touchedAt : undefined}- />- </Suspense>- </DriveLayout>+ const target = entityDetailTarget.document({+ id: entity.id,+ fileType: entity.fileType,+ subType: entity.subType,+ fallbackName: entity.name,+ });+ if (!entityDetailBlockType(target)) return false;+ if (!navigationStack.shouldNavigate(target, { event }))+ return false;+ navigationStack.reset(target);+ return true;+ }}+ uploadProjectId={projectId()}+ disableTabHotkeys+ navigationKey={JSON.stringify([state().location, state().scope])}+ timestamp={isRecent() ? (entity) => entity.touchedAt : undefined}+ />+ </Suspense>+ </DriveLayout>+ </TagSetsProvider></ViewBreadcrumbs.Root>);}diff --git a/apps/web/src/features/drive-view/primitives/drive-navigation.test.ts b/apps/web/src/features/drive-view/primitives/drive-navigation.test.tsindex e91fdec00d..b2c1d6a860 100644--- a/apps/web/src/features/drive-view/primitives/drive-navigation.test.ts+++ b/apps/web/src/features/drive-view/primitives/drive-navigation.test.ts@@ -13,6 +13,7 @@ describe('Drive navigation state', () => {expandedFolderIds: ['unrelated'],favoritesOpen: false,rootOpen: false,+ tagsOpen: false,});const apply = vi.fn();const onNavigate = vi.fn();@@ -36,6 +37,7 @@ describe('Drive navigation state', () => {scope: 'default',rootOpen: true,favoritesOpen: false,+ tagsOpen: false,sort: 'created_at',});expect(apply).toHaveBeenLastCalledWith(state(), true);diff --git a/apps/web/src/features/drive-view/views/drive-layout.tsx b/apps/web/src/features/drive-view/views/drive-layout.tsxindex 93521546f6..794915839f 100644--- a/apps/web/src/features/drive-view/views/drive-layout.tsx+++ b/apps/web/src/features/drive-view/views/drive-layout.tsx@@ -10,6 +10,7 @@ import { isTouchDevice } from '@core/mobile/isTouchDevice';import CaretDownIcon from '@phosphor/caret-down.svg';import FolderIcon from '@phosphor/folder.svg';import SearchIcon from '@phosphor/magnifying-glass.svg';+import { SidebarTagsSection } from '@property/tags/SidebarTagsSection';import { Button, Dropdown } from '@ui';import { createMemo, createSignal, type JSX, Show } from 'solid-js';import { DriveBreadcrumbsOutlet } from '../components/DriveBreadcrumbs';@@ -43,6 +44,10 @@ export function DriveLayout(props: {onToggleFolder: (id: string) => void;onFavoritesOpen: (open: boolean) => void;onRootOpen: (open: boolean) => void;+ /** Tag option ids narrowing the current location. */+ activeTagIds: readonly string[];+ onTags: (ids: string[]) => void;+ onTagsOpen: (open: boolean) => void;createMenu: () => JSX.Element;favorites: () => JSX.Element;locationMenu: DriveLocationMenu;@@ -178,6 +183,13 @@ export function DriveLayout(props: {</ViewSidebar.Nav></CollapsibleSection.Content></CollapsibleSection.Root>+ <SidebarTagsSection+ activeIds={props.activeTagIds}+ onActiveIdsChange={props.onTags}+ open={props.state.tagsOpen}+ onOpenChange={props.onTagsOpen}+ onNavigate={() => setNavigationOpen(false)}+ /></>);diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.mdindex 986b9efbf3..ab465a99e8 100644--- a/docs/AGENT_GUIDE/surfaces.md+++ b/docs/AGENT_GUIDE/surfaces.md@@ -398,7 +398,14 @@ mobile navigation even when `enable-new-app-views` is enabled.On desktop, with `enable-new-app-views` enabled, Files opens **Drive** using thesame shell as Tasks. The sidebar contains `New file or folder`, `My Files`, `Recent`,-`Shared with me`, collapsible Favorites, and a searchable folder hierarchy.+`Shared with me`, collapsible Favorites, a searchable folder hierarchy, and a+collapsible Tags section beneath the folders. Tags lists every tag you can apply,+nested by `/` in the tag name, with a `New tag` action in its header. Choosing a+tag shows only that tag's files within the current tab or folder and exits any+inline file detail; choosing the highlighted tag again clears it, and the same+selection appears under the **Filter** menu's Tags submenu. Navigating to another+tab or folder clears tag filters. A folder with no files matching the active tag+shows the list's no-match state rather than `This folder is empty`.Drive omits split-history back/forward buttons in both wide and narrow layouts;the split close button remains available when multiple splits are open.Files opened in place from Drive show a return link labeled with their originating@@ -438,7 +445,7 @@ breadcrumb to return to the list; choosing an ancestor file drops newer detailentries. Opening a list row or sidebar favorite starts a new detail path; onlynavigation originating inside a detail appends to that path. Modified clicksretain existing split navigation. On narrow layouts, use `Select Drive view` for tabs, favorites,-and folders. Navigation state and expanded folders are restored when returning+folders, and tags. Navigation state and expanded folders are restored when returningfrom an opened file.## Calendar — `/app/calendar/view`