Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(drive): adapt the Drive view to mobile instead of using legacy (#6802)

dev-rb50946db80bc7
diff --git a/apps/web/src/components/app/split-layout/componentRegistry.tsx b/apps/web/src/components/app/split-layout/componentRegistry.tsx
index 8f9d375add..faba6421da 100644
--- a/apps/web/src/components/app/split-layout/componentRegistry.tsx
+++ b/apps/web/src/components/app/split-layout/componentRegistry.tsx
@@ -496,9 +496,7 @@ registerComponent(
'documents',
withAuth((params: DocumentsComponentParams = {}) => {
usePageViewTracking('documents');
- const newAppViews = useNewAppViews({
- enabledLayout: () => (isTouchDevice() ? 'legacy' : 'composable'),
- });
+ const newAppViews = useNewAppViews();
const user = useUserContext();
const preset = getViewPreset('documents', undefined, {
userId: user.userId(),
@@ -515,7 +513,7 @@ registerComponent(
return (
<Show when={newAppViews.ready()} fallback={<LoadingBlock />}>
<Show
- when={newAppViews.enabled() && !isTouchDevice()}
+ when={newAppViews.enabled()}
fallback={
<SoupView
viewName="Files"
diff --git a/apps/web/src/features/drive-view/core/types.ts b/apps/web/src/features/drive-view/core/types.ts
index 66ea808363..fe90abc628 100644
--- a/apps/web/src/features/drive-view/core/types.ts
+++ b/apps/web/src/features/drive-view/core/types.ts
@@ -33,3 +33,29 @@ export const DRIVE_TABS = [
{ id: 'recent', label: 'Recent' },
{ id: 'shared', label: 'Shared with me' },
] satisfies { id: DriveTab; label: string }[];
+
+export const DRIVE_SORT_OPTIONS = [
+ { id: 'updated_at', label: 'Last modified' },
+ { id: 'created_at', label: 'Created' },
+ { id: 'viewed_at', label: 'Last viewed' },
+] satisfies { id: DriveSort; label: string }[];
+
+/** The touch header's pills: the tabs plus the folder overview. */
+export type DriveMobileTab = DriveTab | 'folders';
+
+/**
+ * Pill order for the touch header; the first entry is the default location
+ * on touch devices. DRIVE_TABS keeps the desktop sidebar order.
+ */
+export const DRIVE_MOBILE_TABS = [
+ { id: 'recent', label: 'Recent' },
+ { id: 'owned', label: 'My Files' },
+ { id: 'shared', label: 'Shared with me' },
+ { id: 'folders', label: 'Folders' },
+] satisfies { id: DriveMobileTab; label: string }[];
+
+export function driveMobileTabLocation(tab: DriveMobileTab): DriveLocation {
+ return tab === 'folders'
+ ? { kind: 'folder', id: null }
+ : { kind: 'tab', tab };
+}
diff --git a/apps/web/src/features/drive-view/drive-view.tsx b/apps/web/src/features/drive-view/drive-view.tsx
index 5ee70d24d8..6264efe940 100644
--- a/apps/web/src/features/drive-view/drive-view.tsx
+++ b/apps/web/src/features/drive-view/drive-view.tsx
@@ -15,12 +15,18 @@ import {
withSplitPanelOwner,
} from '@components/app/split-layout/layoutUtils';
import { useUserId } from '@core/context/user';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { ListEntityMetadataQueryProvider } from '@entity';
import { useTagSets, useTagSetsReady } from '@property/tags/tag-sets-context';
import { onCleanup, onMount, Suspense } from 'solid-js';
import { DriveProvider } from './context/drive-context';
import { driveLocationLabel } from './core/location-label';
-import type { DriveState } from './core/types';
+import {
+ DRIVE_MOBILE_TABS,
+ DRIVE_TABS,
+ type DriveState,
+ driveMobileTabLocation,
+} from './core/types';
import { createDriveHostActions } from './drive-host-actions';
import {
createDriveList,
@@ -49,7 +55,10 @@ function DriveComposition(props: DriveViewProps) {
const [value, setValue] = useEntryState<DriveState>('drive.view.v2', {
default: {
- location: { kind: 'tab', tab: 'owned' },
+ // Each form factor opens on the first entry of its own tab list.
+ location: isTouchDevice()
+ ? driveMobileTabLocation(DRIVE_MOBILE_TABS[0].id)
+ : { kind: 'tab', tab: DRIVE_TABS[0].id },
scope: 'default',
sort: 'updated_at',
search: '',
diff --git a/apps/web/src/features/drive-view/filters/use-drive-filters.tsx b/apps/web/src/features/drive-view/filters/use-drive-filters.tsx
new file mode 100644
index 0000000000..17013cba7d
--- /dev/null
+++ b/apps/web/src/features/drive-view/filters/use-drive-filters.tsx
@@ -0,0 +1,174 @@
+import type { ListFilterGroup } from '@app/components/view-shell';
+import { EntityIcon } from '@core/component/EntityIcon';
+import { UserIcon } from '@core/component/UserIcon';
+import { useTagFilterGroup } from '@property/tags/use-tag-filter-group';
+import { useContacts } from '@queries/contacts/contacts';
+import { createMemo } from 'solid-js';
+import { useDriveView } from '../context/drive-context';
+
+export type DriveFilterGroupId = 'type' | 'created-by' | 'tags' | 'scope';
+
+const typeOptions = [
+ { id: 'doc-markdown', label: 'Markdown', type: 'md' },
+ { id: 'doc-canvas', label: 'Canvas', type: 'canvas' },
+ { id: 'doc-spreadsheet', label: 'Spreadsheet', type: 'spreadsheet' },
+ { id: 'file-code', label: 'Code', type: 'code' },
+ { id: 'file-image', label: 'Images', type: 'image' },
+ { id: 'file-pdf', label: 'PDFs', type: 'pdf' },
+ { id: 'file-docx', label: 'DOCX', type: 'write' },
+ { id: 'file-video', label: 'Videos', type: 'video' },
+ { id: 'doc-snippet', label: 'Snippets', type: 'snippet' },
+ { id: 'doc-skill', label: 'Skills', type: 'skill' },
+ { id: 'file-other', label: 'Other', type: 'files' },
+] as const;
+
+/** Filter model shared by the desktop filter dropdown and the mobile drawer. */
+export function useDriveFilters() {
+ const { state, actions } = useDriveView();
+
+ const userId = actions.userId;
+
+ const contacts = useContacts();
+
+ const tagGroup = useTagFilterGroup();
+
+ const people = createMemo(() => {
+ const sorted = [...contacts()].sort(
+ (a, b) => Number(b.id === userId()) - Number(a.id === userId())
+ );
+
+ return sorted.map((person) => {
+ let label = person.name || person.id;
+
+ if (person.id === userId()) {
+ label = person.name ? `${person.name} (me)` : 'Me';
+ }
+
+ return {
+ id: person.id,
+ label,
+
+ icon: () => (
+ <UserIcon
+ id={person.id}
+ size="sm"
+ suppressClick
+ showTooltip={false}
+ />
+ ),
+ };
+ });
+ });
+
+ const showCreators = () => {
+ const { location, scope } = state.value();
+
+ if (location.kind === 'folder') return true;
+
+ return location.tab !== 'owned' || scope !== 'default';
+ };
+
+ const groups = createMemo(() => {
+ const groups: ListFilterGroup<DriveFilterGroupId, string>[] = [];
+
+ const location = state.value().location;
+
+ const isRecent = location.kind === 'tab' && location.tab === 'recent';
+
+ if (!isRecent) {
+ const tags = tagGroup();
+
+ if (tags.options.length > 0) groups.push(tags);
+
+ groups.push({
+ id: 'type',
+ label: 'Type',
+ options: typeOptions.map((option) => ({
+ id: option.id,
+ label: option.label,
+
+ icon: () => <EntityIcon targetType={option.type} size="xs" />,
+ })),
+ });
+
+ if (showCreators()) {
+ groups.push({
+ id: 'created-by',
+ label: 'Created by',
+ searchPlaceholder: 'Search creators...',
+ options: people(),
+ });
+ }
+ }
+
+ groups.push({
+ id: 'scope',
+ label: 'Files',
+ selectionMode: 'single',
+ defaultOptionId: 'default',
+ options: [
+ { id: 'default', label: 'Default' },
+ { id: 'all', label: 'All files' },
+ { id: 'attachments', label: 'Email attachments' },
+ ],
+ });
+
+ return groups;
+ });
+
+ const setTagSelected = (id: string, selected: boolean) => {
+ const ids = (state.value().facets.tags ?? []).filter(
+ (value) => value !== id
+ );
+
+ if (selected) ids.push(id);
+
+ state.setTags(ids);
+ };
+
+ const isSelected = (group: DriveFilterGroupId, id: string) => {
+ if (group === 'scope') return state.value().scope === id;
+
+ return state.value().facets[group]?.includes(id) ?? false;
+ };
+
+ const setSelected = (
+ group: DriveFilterGroupId,
+ id: string,
+ selected: boolean
+ ) => {
+ if (group === 'scope') {
+ if (id === 'default' || id === 'all' || id === 'attachments')
+ state.setScope(id);
+
+ return;
+ }
+
+ if (group === 'tags') {
+ setTagSelected(id, selected);
+
+ return;
+ }
+
+ state.setFacetSelected(group, id, selected);
+ };
+
+ const activeCount = () => {
+ const { facets, scope } = state.value();
+
+ const facetCount = Object.values(facets).reduce(
+ (count, ids) => count + ids.length,
+ 0
+ );
+
+ return facetCount + (scope === 'default' ? 0 : 1);
+ };
+
+ return {
+ groups,
+ isSelected,
+ setSelected,
+ activeCount,
+ clear: state.clearFilters,
+ };
+}
diff --git a/apps/web/src/features/drive-view/views/drive-filter-drawer.tsx b/apps/web/src/features/drive-view/views/drive-filter-drawer.tsx
new file mode 100644
index 0000000000..77f5c591aa
--- /dev/null
+++ b/apps/web/src/features/drive-view/views/drive-filter-drawer.tsx
@@ -0,0 +1,99 @@
+import { MobileFilterDrawer } from '@app/components/view-shell/MobileFilterDrawer';
+import { MobileDrawer } from '@components/app/mobile/MobileDrawer';
+import { Accordion } from '@kobalte/core/accordion';
+import { createMemo, For, Show } from 'solid-js';
+import { useDriveView } from '../context/drive-context';
+import { DRIVE_SORT_OPTIONS } from '../core/types';
+import { useDriveFilters } from '../filters/use-drive-filters';
+
+export function DriveFilterDrawer() {
+ const { state } = useDriveView();
+
+ const filters = useDriveFilters();
+
+ const isRecent = () => {
+ const location = state.value().location;
+
+ return location.kind === 'tab' && location.tab === 'recent';
+ };
+
+ return (
+ <MobileFilterDrawer
+ triggerLabel="Open file filters"
+ label="File list controls"
+ activeCount={filters.activeCount()}
+ onClear={filters.clear}
+ >
+ {/* Recent keeps the viewer's own interaction order; no sort override. */}
+ <Show when={!isRecent()}>
+ <MobileDrawer.Label id="drive-sort-label" class="pt-4">
+ Sort
+ </MobileDrawer.Label>
+ <MobileDrawer.Section
+ role="radiogroup"
+ aria-labelledby="drive-sort-label"
+ >
+ <For each={DRIVE_SORT_OPTIONS}>
+ {(option) => (
+ <MobileFilterDrawer.Option
+ selectionMode="single"
+ checked={state.value().sort === option.id}
+ onChange={() => state.setSort(option.id)}
+ >
+ {option.label}
+ </MobileFilterDrawer.Option>
+ )}
+ </For>
+ </MobileDrawer.Section>
+ </Show>
+
+ {/* Folder locations offer no filters, matching the desktop header. */}
+ <Show when={state.value().location.kind === 'tab'}>
+ <MobileDrawer.Label class="pt-4">Filters</MobileDrawer.Label>
+ <Accordion
+ multiple
+ collapsible
+ defaultValue={[filters.groups()[0]?.id ?? 'type']}
+ >
+ <div class="flex flex-col gap-3">
+ <For each={filters.groups()}>
+ {(group) => {
+ const activeCount = createMemo(
+ () =>
+ group.options.filter(
+ (option) =>
+ option.id !== group.defaultOptionId &&
+ filters.isSelected(group.id, option.id)
+ ).length
+ );
+
+ return (
+ <MobileFilterDrawer.Section
+ value={group.id}
+ label={group.label}
+ activeCount={activeCount()}
+ >
+ <For each={group.options}>
+ {(option) => (
+ <MobileFilterDrawer.Option
+ selectionMode={group.selectionMode}
+ checked={filters.isSelected(group.id, option.id)}
+ onChange={(checked) =>
+ filters.setSelected(group.id, option.id, checked)
+ }
+ icon={option.icon?.()}
+ >
+ {option.label}
+ </MobileFilterDrawer.Option>
+ )}
+ </For>
+ </MobileFilterDrawer.Section>
+ );
+ }}
+ </For>
+ </div>
+ </Accordion>
+ </Show>
+ </MobileFilterDrawer>
+ );
+}
diff --git a/apps/web/src/features/drive-view/views/drive-filter-menu.tsx b/apps/web/src/features/drive-view/views/drive-filter-menu.tsx
index fd55d5ab66..01b61124b3 100644
--- a/apps/web/src/features/drive-view/views/drive-filter-menu.tsx
+++ b/apps/web/src/features/drive-view/views/drive-filter-menu.tsx
@@ -1,43 +1,16 @@
import {
ListFilterDropdown,
- type ListFilterGroup,
useViewControlHotkeys,
} from '@app/components/view-shell';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
-import { EntityIcon } from '@core/component/EntityIcon';
-import { UserIcon } from '@core/component/UserIcon';
-import { useTagFilterGroup } from '@property/tags/use-tag-filter-group';
-import { useContacts } from '@queries/contacts/contacts';
-import { createMemo, createSignal } from 'solid-js';
-import { useDriveView } from '../context/drive-context';
-
-type GroupId = 'type' | 'created-by' | 'tags' | 'scope';
-
-const typeOptions = [
- { id: 'doc-markdown', label: 'Markdown', type: 'md' },
- { id: 'doc-canvas', label: 'Canvas', type: 'canvas' },
- { id: 'doc-spreadsheet', label: 'Spreadsheet', type: 'spreadsheet' },
- { id: 'file-code', label: 'Code', type: 'code' },
- { id: 'file-image', label: 'Images', type: 'image' },
- { id: 'file-pdf', label: 'PDFs', type: 'pdf' },
- { id: 'file-docx', label: 'DOCX', type: 'write' },
- { id: 'file-video', label: 'Videos', type: 'video' },
- { id: 'doc-snippet', label: 'Snippets', type: 'snippet' },
- { id: 'doc-skill', label: 'Skills', type: 'skill' },
- { id: 'file-other', label: 'Other', type: 'files' },
-] as const;
+import { createSignal } from 'solid-js';
+import { useDriveFilters } from '../filters/use-drive-filters';
export function DriveFilterMenu() {
- const { state, actions } = useDriveView();
+ const filters = useDriveFilters();
const panel = useSplitPanelOrThrow();
- const userId = actions.userId;
-
- const contacts = useContacts();
-
- const tagGroup = useTagFilterGroup();
-
const [open, setOpen] = createSignal(false);
useViewControlHotkeys({
@@ -54,128 +27,15 @@ export function DriveFilterMenu() {
},
});
- const people = createMemo(() => {
- const sorted = [...contacts()].sort(
- (a, b) => Number(b.id === userId()) - Number(a.id === userId())
- );
-
- return sorted.map((person) => {
- let label = person.name || person.id;
-
- if (person.id === userId()) {
- label = person.name ? `${person.name} (me)` : 'Me';
- }
-
- return {
- id: person.id,
- label,
-
- icon: () => (
- <UserIcon
- id={person.id}
- size="sm"
- suppressClick
- showTooltip={false}
- />
- ),
- };
- });
- });
-
- const showCreators = () => {
- const { location, scope } = state.value();
-
- if (location.kind === 'folder') return true;
-
- return location.tab !== 'owned' || scope !== 'default';
- };
-
- const groups = createMemo(() => {
- const groups: ListFilterGroup<GroupId, string>[] = [];
-
- const location = state.value().location;
-
- const isRecent = location.kind === 'tab' && location.tab === 'recent';
-
- if (!isRecent) {
- const tags = tagGroup();
-
- if (tags.options.length > 0) groups.push(tags);
-
- groups.push({
- id: 'type',
- label: 'Type',
- options: typeOptions.map((option) => ({
- id: option.id,
- label: option.label,
-
- icon: () => <EntityIcon targetType={option.type} size="xs" />,
- })),
- });
-
- if (showCreators()) {
- groups.push({
- id: 'created-by',
- label: 'Created by',
- searchPlaceholder: 'Search creators...',
- options: people(),
- });
- }
- }
-
- groups.push({
- id: 'scope',
- label: 'Files',
- selectionMode: 'single',
- defaultOptionId: 'default',
- options: [
- { id: 'default', label: 'Default' },
- { id: 'all', label: 'All files' },
- { id: 'attachments', label: 'Email attachments' },
- ],
- });
-
- return groups;
- });
-
- const setTagSelected = (id: string, selected: boolean) => {
- const ids = (state.value().facets.tags ?? []).filter(
- (value) => value !== id
- );
-
- if (selected) ids.push(id);
-
- state.setTags(ids);
- };
-
return (
<ListFilterDropdown
label="Filter files"
open={open()}
onOpenChange={setOpen}
- groups={groups()}
- onClear={state.clearFilters}
- isSelected={(group, id) => {
- if (group === 'scope') return state.value().scope === id;
-
- return state.value().facets[group]?.includes(id) ?? false;
- }}
- onSelectionChange={(group, id, selected) => {
- if (group === 'scope') {
- if (id === 'default' || id === 'all' || id === 'attachments')
- state.setScope(id);
-
- return;
- }
-
- if (group === 'tags') {
- setTagSelected(id, selected);
-
- return;
- }
-
- state.setFacetSelected(group, id, selected);
- }}
+ groups={filters.groups()}
+ onClear={filters.clear}
+ isSelected={filters.isSelected}
+ onSelectionChange={filters.setSelected}
/>
);
}
diff --git a/apps/web/src/features/drive-view/views/drive-header.tsx b/apps/web/src/features/drive-view/views/drive-header.tsx
index a2cb6676a2..ed5d65e129 100644
--- a/apps/web/src/features/drive-view/views/drive-header.tsx
+++ b/apps/web/src/features/drive-view/views/drive-header.tsx
@@ -6,15 +6,14 @@ import {
} from '@app/components/view-shell';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
-import CaretDownIcon from '@phosphor/caret-down.svg';
-import { Dropdown } from '@ui';
-import { createSignal, Show, Suspense } from 'solid-js';
+import { Show, Suspense } from 'solid-js';
import { DriveBreadcrumbsOutlet } from '../components/DriveBreadcrumbs';
import { useDriveView } from '../context/drive-context';
import { driveLocationLabel } from '../core/location-label';
+import { DRIVE_SORT_OPTIONS } from '../core/types';
import { DriveCreateMenu } from '../drive-create-menu';
import { DriveFilterMenu } from './drive-filter-menu';
-import { DriveSidebarContent } from './drive-sidebar';
+import { DriveMobileTabs } from './drive-mobile-tabs';
export function DriveHeader() {
const { state, sidebar } = useDriveView();
@@ -30,13 +29,11 @@ export function DriveHeader() {
const panel = useSplitPanelOrThrow();
- const [navigationOpen, setNavigationOpen] = createSignal(false);
-
let searchInput: HTMLInputElement | undefined;
useViewControlHotkeys({
scopeId: panel.splitHotkeyScope,
- enabled: panel.isPanelActive,
+ enabled: () => panel.isPanelActive() && !isTouchDevice(),
search: {
description: 'Search Drive',
@@ -53,7 +50,7 @@ export function DriveHeader() {
return (
<>
- <ViewShell.TopBar class="touch:flex">
+ <ViewShell.TopBar>
<h1 class="hidden min-w-0 truncate text-sm font-semibold tracking-[-0.03em] text-ink @max-[720px]/view-shell:block">
Drive
</h1>
@@ -64,78 +61,53 @@ export function DriveHeader() {
</ViewShell.TopBar>
<ViewShell.Header>
<div class="flex min-w-0 flex-col gap-3">
- <div class="hidden min-w-0 items-center gap-2 @max-[720px]/view-shell:flex">
- <Show
- when={isTouchDevice()}
- fallback={
- <h1 class="min-w-0 truncate text-xl font-semibold tracking-[-0.03em] text-ink">
- {title()}
- </h1>
- }
- >
- <Dropdown
- open={navigationOpen()}
- onOpenChange={setNavigationOpen}
- placement="bottom-start"
- >
- <h1 class="min-w-0">
- <Dropdown.Trigger
- variant="ghost"
- size="sm"
- class="h-auto min-w-0 max-w-full gap-1 rounded-lg px-2 py-1 text-xl font-semibold tracking-[-0.03em] text-ink"
- aria-label={`Select Drive view: ${title()}`}
- >
- <span class="truncate">{title()}</span>
- <CaretDownIcon class="size-3.5 shrink-0 text-ink-muted" />
- </Dropdown.Trigger>
- </h1>
- <Dropdown.Content class="max-h-[70vh] w-72 overflow-auto rounded-2xl">
- <Dropdown.Group class="gap-5 p-3">
- <DriveSidebarContent
- onNavigate={() => setNavigationOpen(false)}
+ <Show
+ when={isTouchDevice()}
+ fallback={
+ <>
+ <div class="hidden min-w-0 items-center gap-2 @max-[720px]/view-shell:flex">
+ <h1 class="min-w-0 truncate text-xl font-semibold tracking-[-0.03em] text-ink">
+ {title()}
+ </h1>
+ <div class="ml-auto shrink-0">
+ <DriveCreateMenu />
+ </div>
+ </div>
+ <div class="flex min-w-0 items-center justify-between gap-3">
+ <Show when={!state.projectId()}>
+ <SearchBar
+ ref={(element) => {
+ searchInput = element;
+ }}
+ label="Search Drive"
+ placeholder="Search files"
+ value={state.value().search}
+ onValueChange={state.setSearch}
+ hotkey="cmd+f"
+ class="max-w-md flex-1"
/>
- </Dropdown.Group>
- </Dropdown.Content>
- </Dropdown>
- </Show>
- <div class="ml-auto shrink-0">
- <DriveCreateMenu />
- </div>
- </div>
- <div class="flex min-w-0 items-center justify-between gap-3">
- <Show when={!state.projectId()}>
- <SearchBar
- ref={(element) => {
- searchInput = element;
- }}
- label="Search Drive"
- placeholder="Search files"
- value={state.value().search}
- onValueChange={state.setSearch}
- hotkey="cmd+f"
- class="max-w-md flex-1"
- />
- </Show>
- <div class="ml-auto flex shrink-0 items-center gap-2">
- <Show when={!isRecent()}>
- <ListSortDropdown
- label="Sort files"
- value={state.value().sort}
- onChange={state.setSort}
- options={[
- { id: 'updated_at', label: 'Last modified' },
- { id: 'created_at', label: 'Created' },
- { id: 'viewed_at', label: 'Last viewed' },
- ]}
- />
- </Show>
- <Show when={state.value().location.kind === 'tab'}>
- <Suspense>
- <DriveFilterMenu />
- </Suspense>
- </Show>
- </div>
- </div>
+ </Show>
+ <div class="ml-auto flex shrink-0 items-center gap-2">
+ <Show when={!isRecent()}>
+ <ListSortDropdown
+ label="Sort files"
+ value={state.value().sort}
+ onChange={state.setSort}
+ options={DRIVE_SORT_OPTIONS}
+ />
+ </Show>
+ <Show when={state.value().location.kind === 'tab'}>
+ <Suspense>
+ <DriveFilterMenu />
+ </Suspense>
+ </Show>
+ </div>
+ </div>
+ </>
+ }
+ >
+ <DriveMobileTabs />
+ </Show>
</div>
</ViewShell.Header>
</>
diff --git a/apps/web/src/features/drive-view/views/drive-mobile-tabs.tsx b/apps/web/src/features/drive-view/views/drive-mobile-tabs.tsx
new file mode 100644
index 0000000000..18d706556c
--- /dev/null
+++ b/apps/web/src/features/drive-view/views/drive-mobile-tabs.tsx
@@ -0,0 +1,37 @@
+import { type PillTabItem, PillTabs } from '@components/app/mobile/PillTabs';
+import { useDriveView } from '../context/drive-context';
+import {
+ DRIVE_MOBILE_TABS,
+ type DriveMobileTab,
+ driveMobileTabLocation,
+} from '../core/types';
+import { DriveFilterDrawer } from './drive-filter-drawer';
+
+export function DriveMobileTabs() {
+ const { state } = useDriveView();
+
+ const items = (): PillTabItem<DriveMobileTab>[] =>
+ DRIVE_MOBILE_TABS.map((tab) => ({ value: tab.id, label: tab.label }));
+
+ // Folders covers the folder overview and any folder inside it; tapping the
+ // pill from inside a folder returns to the overview.
+ const activeTab = (): DriveMobileTab => {
+ const location = state.value().location;
+
+ return location.kind === 'folder' ? 'folders' : location.tab;
+ };
+
+ return (
+ <div class="h-10 min-w-0 flex-1">
+ <PillTabs
+ scrollable
+ class="-ml-(--mobile-chrome-gutter) w-[calc(100%+2*var(--mobile-chrome-gutter))] max-w-none flex-none"
+ contentClass="px-(--mobile-chrome-gutter)"
+ leading={<DriveFilterDrawer />}
+ items={items()}
+ value={activeTab()}
+ onChange={(tab) => state.navigate(driveMobileTabLocation(tab))}
+ />
+ </div>
+ );
+}
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index 5d1b8d25cc..8238599efa 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -477,11 +477,21 @@ just client-side row filtering. Cached inserts enforce the same rule before a
refetch, including expanded groups and inactive cached Shared queries. Until
viewer identity is available, document inserts into Shared are rejected.
-On touch devices (phones and tablets), Files keeps the original tabbed view and
-mobile navigation even when `enable-new-app-views` is enabled.
-
-On desktop, with `enable-new-app-views` enabled, Files opens **Drive** using the
-same shell as Tasks. The sidebar contains `New file or folder`, `My Files`, `Recent`,
+With `enable-new-app-views` enabled, Files opens **Drive** using the
+same shell as Tasks, on desktop and touch devices alike.
+
+On touch devices (phones and tablets), the Drive header is a scrollable pill
+strip — **Recent**, **My Files**, **Shared with me**, and **Folders** — with a
+leading filter-drawer button, like Tasks. Touch opens on **Recent** (the first
+pill). The drawer holds Sort (hidden on Recent, where the viewer's own
+edit order applies) and, on tab locations only, the same filter groups as the
+desktop **Filter** menu; active selections show a count badge on the trigger
+and a `Clear all` action in the drawer. The in-view `Search Drive` field, the
+Sort/Filter dropdowns, and the header New menu are desktop-only — search on
+touch uses the global search overlay and creation uses the dock's New button.
+The **Folders** pill opens the folder overview and stays highlighted inside
+any folder; tapping it from inside a folder returns to the overview, and
+selecting another pill leaves the folder tree. The sidebar contains `New file or folder`, `My Files`, `Recent`,
`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
@@ -534,8 +544,9 @@ navigation originating inside a detail appends to that path. Cmd/Ctrl-clicking a
row toggles selection; Shift-clicking a checkbox selects a range, and Shift+Enter
opens the focused row in a new split. Cmd/Ctrl-clicking a row's folder link or
search hit opens a new tab. Short filtered pages load more results automatically;
-a failed page shows a retry action instead of silently stopping. On narrow layouts,
-use `Select Drive view` for tabs, favorites, folders, and tags. Location, search,
+a failed page shows a retry action instead of silently stopping. On touch, tabs
+switch via the header pills; on narrow desktop layouts the header keeps a plain
+title and navigation goes through the hamburger overlay. Location, search,
filters, expanded folders, list focus, and scroll position are restored when
returning from an opened file.