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[sidebar]: Merge Files and Documents, add Folders (#2041)

Peter Chinmanba46c6063a57
diff --git a/js/app/packages/app/component/Launcher.tsx b/js/app/packages/app/component/Launcher.tsx
index c4860cd060..3dd4ec45f4 100644
--- a/js/app/packages/app/component/Launcher.tsx
+++ b/js/app/packages/app/component/Launcher.tsx
@@ -2,10 +2,7 @@ import type { BlockAlias, BlockName } from '@core/block';
import { getIconConfig } from '@core/component/EntityIcon';
import { Hotkey } from '@core/component/Hotkey';
import { PcNoiseGrid } from '@core/component/PcNoiseGrid';
-import {
- ENABLE_ANIMATED_ICONS,
- ENABLE_CREATE_TASK,
-} from '@core/constant/featureFlags';
+import { ENABLE_ANIMATED_ICONS } from '@core/constant/featureFlags';
import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';
import { pressedKeys } from '@core/hotkey/state';
import { type HotkeyToken, TOKENS } from '@core/hotkey/tokens';
@@ -53,7 +50,6 @@ import { Dynamic } from 'solid-js/web';
import { type FocusableElement, tabbable } from 'tabbable';
import { useSplitLayout } from './split-layout/layout';
import { cn } from '@ui/utils/classname';
-import type { ListViewCreateActionId } from './list-view-create';
const createBlock = async (spec: {
blockName: BlockName | BlockAlias;
@@ -129,13 +125,13 @@ const createComponent = async (spec: {
};
export function runCreateAction(
- actionId: ListViewCreateActionId,
+ blockName: BlockName,
options: { shouldInsert?: boolean } = {}
) {
const shouldInsert = options.shouldInsert ?? false;
- switch (actionId) {
- case 'doc':
+ switch (blockName) {
+ case 'md':
createBlock({
blockName: 'md',
loading: true,
@@ -176,13 +172,13 @@ export function runCreateAction(
shouldInsert,
});
return;
- case 'message':
+ case 'channel':
createComponent({
componentId: 'channel-compose',
shouldInsert,
});
return;
- case 'agent':
+ case 'chat':
createBlock({
blockName: 'chat',
createFn: async () => {
@@ -195,13 +191,30 @@ export function runCreateAction(
shouldInsert,
});
return;
- case 'folder':
+ case 'project':
createBlock({
blockName: 'project',
createFn: () => createProject({ name: 'New Folder' }),
shouldInsert,
});
return;
+ case 'code':
+ createBlock({
+ blockName: 'code',
+ loading: true,
+ createFn: async () => {
+ const result = await createCodeFileFromText({
+ code: 'print("Hello, World!")',
+ extension: 'py',
+ title: 'New Code File',
+ });
+ if (isErr(result)) return;
+ const [, id] = ok(result[1]?.documentId);
+ return id;
+ },
+ shouldInsert,
+ });
+ return;
}
}
@@ -223,28 +236,24 @@ export const CREATABLE_BLOCKS: CreatableBlock[] = [
altHotkeyToken: TOKENS.create.noteNewSplit,
hotkey: 'd',
keyDownHandler: () => {
- runCreateAction('doc', { shouldInsert: pressedKeys().has('shift') });
+ runCreateAction('md', { shouldInsert: pressedKeys().has('shift') });
+ return true;
+ },
+ },
+ {
+ label: 'Task',
+ icon: WideTask,
+ animatedIcon: AnimatedTaskIcon,
+ description: 'Create task',
+ blockName: 'task',
+ hotkeyToken: TOKENS.create.task,
+ altHotkeyToken: TOKENS.create.taskNewSplit,
+ hotkey: 't' as const,
+ keyDownHandler: () => {
+ runCreateAction('task');
return true;
},
},
- ...(ENABLE_CREATE_TASK
- ? [
- {
- label: 'Task',
- icon: WideTask,
- animatedIcon: AnimatedTaskIcon,
- description: 'Create task',
- blockName: 'task' as BlockName,
- hotkeyToken: TOKENS.create.task,
- altHotkeyToken: TOKENS.create.taskNewSplit,
- hotkey: 't' as const,
- keyDownHandler: () => {
- runCreateAction('task');
- return true;
- },
- },
- ]
- : []),
{
label: 'Email',
icon: WideEmail,
@@ -269,7 +278,7 @@ export const CREATABLE_BLOCKS: CreatableBlock[] = [
altHotkeyToken: TOKENS.create.messageNewSplit,
hotkey: 'm',
keyDownHandler: () => {
- runCreateAction('message', { shouldInsert: pressedKeys().has('shift') });
+ runCreateAction('channel', { shouldInsert: pressedKeys().has('shift') });
return true;
},
},
@@ -278,12 +287,12 @@ export const CREATABLE_BLOCKS: CreatableBlock[] = [
icon: WideStar,
animatedIcon: AnimatedStarIcon,
description: 'Create AI chat',
- blockName: 'chat' as BlockName,
+ blockName: 'chat',
hotkeyToken: TOKENS.create.chat,
altHotkeyToken: TOKENS.create.chatNewSplit,
hotkey: 'a',
keyDownHandler: () => {
- runCreateAction('agent', { shouldInsert: pressedKeys().has('shift') });
+ runCreateAction('chat', { shouldInsert: pressedKeys().has('shift') });
return true;
},
},
@@ -313,7 +322,7 @@ export const CREATABLE_BLOCKS: CreatableBlock[] = [
altHotkeyToken: TOKENS.create.projectNewSplit,
hotkey: 'f',
keyDownHandler: () => {
- runCreateAction('folder', { shouldInsert: pressedKeys().has('shift') });
+ runCreateAction('project', { shouldInsert: pressedKeys().has('shift') });
return true;
},
},
@@ -327,21 +336,7 @@ export const CREATABLE_BLOCKS: CreatableBlock[] = [
altHotkeyToken: TOKENS.create.codeNewSplit,
hotkey: 'o',
keyDownHandler: () => {
- createBlock({
- blockName: 'code',
- loading: true,
- createFn: async () => {
- const result = await createCodeFileFromText({
- code: 'print("Hello, World!")',
- extension: 'py',
- title: 'New Code File',
- });
- if (isErr(result)) return;
- const [, id] = ok(result[1]?.documentId);
- return id;
- },
- shouldInsert: pressedKeys().has('shift'),
- });
+ runCreateAction('code', { shouldInsert: pressedKeys().has('shift') });
return true;
},
},
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsx
index 5162b2f2d7..4ce7d46cd0 100644
--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx
+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx
@@ -102,9 +102,9 @@ export const SIDEBAR_LINKS = [
hotkey: 'c',
},
{
- id: 'files',
- label: 'Files',
- href: LIST_VIEW_PATHS.files,
+ id: 'folders',
+ label: 'Folders',
+ href: LIST_VIEW_PATHS.folders,
icon: AnimatedFolderIcon,
hotkey: 'f',
},
diff --git a/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts b/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts
index c4cf062971..ac6cdfed14 100644
--- a/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts
+++ b/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts
@@ -133,19 +133,44 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {
if (!ctx.userId) return undefined;
return {
queryFilters: {
- ...QUERY_FILTERS.document,
- document_filters: { owners: [ctx.userId] },
+ ...QUERY_FILTERS.documentAndFile,
+ document_filters: {
+ ...QUERY_FILTERS.documentAndFile.document_filters,
+ is_email_attachment: false,
+ owners: [ctx.userId],
+ },
+ project_filters: { project_ids: EXCLUDE },
},
- clientFilters: { and: ['document'] },
+ clientFilters: { and: ['not-task'] },
};
},
shared: () => ({
- queryFilters: QUERY_FILTERS.document,
- clientFilters: { and: ['document', 'shared-entity'] },
+ queryFilters: {
+ ...QUERY_FILTERS.documentAndFile,
+ document_filters: {
+ ...QUERY_FILTERS.documentAndFile.document_filters,
+ is_email_attachment: false,
+ },
+ project_filters: { project_ids: EXCLUDE },
+ },
+ clientFilters: { and: ['not-task', 'shared-entity'] },
+ }),
+ attachments: () => ({
+ queryFilters: {
+ ...QUERY_FILTERS.documentAndFile,
+ document_filters: {
+ is_email_attachment: true,
+ },
+ project_filters: { project_ids: EXCLUDE },
+ },
+ clientFilters: { and: ['not-task'] },
}),
all: () => ({
- queryFilters: QUERY_FILTERS.document,
- clientFilters: { and: ['document'] },
+ queryFilters: {
+ ...QUERY_FILTERS.documentAndFile,
+ project_filters: { project_ids: EXCLUDE },
+ },
+ clientFilters: { and: ['not-task'] },
}),
},
},
@@ -198,50 +223,31 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {
}),
},
},
- files: {
+ folders: {
default: 'owned',
tabs: {
owned: (ctx) => {
if (!ctx.userId) return undefined;
return {
queryFilters: {
- ...QUERY_FILTERS.file,
- document_filters: {
- ...QUERY_FILTERS.file.document_filters,
- is_email_attachment: false,
- owners: [ctx.userId],
- },
+ channel_filters: { channel_ids: EXCLUDE },
+ chat_filters: { chat_ids: EXCLUDE },
+ email_filters: { recipients: EXCLUDE },
+ document_filters: { document_ids: EXCLUDE },
project_filters: { owners: [ctx.userId] },
},
- clientFilters: { and: ['file-folder'] },
+ clientFilters: {},
};
},
- shared: () => ({
- queryFilters: {
- ...QUERY_FILTERS.file,
- document_filters: {
- ...QUERY_FILTERS.file.document_filters,
- is_email_attachment: false,
- },
- },
- clientFilters: { and: ['file-folder', 'shared-entity'] },
- }),
- attachments: () => ({
- queryFilters: {
- ...QUERY_FILTERS.file,
- document_filters: {
- is_email_attachment: true,
- },
- project_filters: { project_ids: EXCLUDE },
- },
- clientFilters: { and: ['file-folder'] },
- }),
all: () => ({
queryFilters: {
- ...QUERY_FILTERS.file,
+ channel_filters: { channel_ids: EXCLUDE },
+ chat_filters: { chat_ids: EXCLUDE },
+ email_filters: { recipients: EXCLUDE },
+ document_filters: { document_ids: EXCLUDE },
project_filters: {},
},
- clientFilters: { and: ['file-folder'] },
+ clientFilters: {},
}),
},
},
@@ -259,7 +265,7 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {
};
/** Views whose default tab requires user context */
-type ContextRequiredView = 'agents' | 'documents' | 'tasks' | 'files';
+type ContextRequiredView = 'agents' | 'documents' | 'tasks' | 'folders';
/** Views whose default tab works without user context */
type ContextOptionalView = Exclude<ListView, ContextRequiredView>;
diff --git a/js/app/packages/app/component/list-view-create.test.ts b/js/app/packages/app/component/list-view-create.test.ts
deleted file mode 100644
index 2f81b83919..0000000000
--- a/js/app/packages/app/component/list-view-create.test.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import { describe, expect, test } from 'vitest';
-import {
- getCreateActionLabel,
- getCreateOptionLabel,
- getListViewCreateActionId,
- getListViewCreateButtonLabel,
- getListViewCreateOptions,
-} from './list-view-create';
-
-describe('getListViewCreateActionId', () => {
- test.each([
- ['agents', 'agent'],
- ['mail', 'email'],
- ['documents', 'doc'],
- ['tasks', 'task'],
- ['channels', 'message'],
- ['files', 'folder'],
- ] as const)('maps %s to %s', (view, actionId) => {
- expect(getListViewCreateActionId(view)).toBe(actionId);
- });
-
- test('does not expose create actions for aggregate views', () => {
- expect(getListViewCreateActionId('inbox')).toBeUndefined();
- expect(getListViewCreateActionId('search')).toBeUndefined();
- });
-
- test.each([
- ['agents', 'New agent'],
- ['mail', 'New email'],
- ['documents', 'New doc'],
- ['tasks', 'New task'],
- ['channels', 'New message'],
- ['files', 'New folder'],
- ] as const)('builds the correct button label for %s', (view, label) => {
- expect(getListViewCreateButtonLabel(view)).toBe(label);
- });
-
- test('returns the action label for each create action', () => {
- expect(getCreateActionLabel('doc')).toBe('doc');
- expect(getCreateActionLabel('canvas')).toBe('canvas');
- expect(getCreateActionLabel('task')).toBe('task');
- expect(getCreateActionLabel('email')).toBe('email');
- expect(getCreateActionLabel('folder')).toBe('folder');
- expect(getCreateActionLabel('message')).toBe('message');
- expect(getCreateActionLabel('agent')).toBe('agent');
- });
-
- test('returns the option label for import', () => {
- expect(getCreateOptionLabel('import')).toBe('Import');
- });
-
- test('returns the full documents create menu', () => {
- expect(getListViewCreateOptions('documents')).toEqual([
- { id: 'doc', label: 'New doc' },
- { id: 'canvas', label: 'New canvas' },
- { id: 'import', label: 'Import' },
- ]);
- });
-
- test('returns a single create option for non-document views', () => {
- expect(getListViewCreateOptions('tasks')).toEqual([
- { id: 'task', label: 'New task' },
- ]);
- });
-});
diff --git a/js/app/packages/app/component/list-view-create.ts b/js/app/packages/app/component/list-view-create.ts
deleted file mode 100644
index 8dad4952a2..0000000000
--- a/js/app/packages/app/component/list-view-create.ts
+++ /dev/null
@@ -1,78 +0,0 @@
-import type { ListView } from '@app/constants/list-views';
-
-export const LIST_VIEW_CREATE_ACTIONS: Partial<
- Record<ListView, ListViewCreateActionId>
-> = {
- agents: 'agent',
- mail: 'email',
- documents: 'doc',
- tasks: 'task',
- channels: 'message',
- files: 'folder',
-};
-
-export type ListViewCreateActionId =
- | 'agent'
- | 'canvas'
- | 'doc'
- | 'email'
- | 'folder'
- | 'message'
- | 'task';
-
-export type ListViewCreateOptionId = ListViewCreateActionId | 'import';
-
-const CREATE_OPTION_LABELS: Record<ListViewCreateOptionId, string> = {
- agent: 'agent',
- canvas: 'canvas',
- doc: 'doc',
- email: 'email',
- folder: 'folder',
- import: 'Import',
- message: 'message',
- task: 'task',
-};
-
-export type ListViewCreateOption = {
- id: ListViewCreateOptionId;
- label: string;
-};
-
-export function getListViewCreateActionId(
- view: ListView
-): ListViewCreateActionId | undefined {
- return LIST_VIEW_CREATE_ACTIONS[view];
-}
-
-export function getCreateActionLabel(actionId: ListViewCreateActionId): string {
- return CREATE_OPTION_LABELS[actionId];
-}
-
-export function getListViewCreateButtonLabel(
- view: ListView
-): string | undefined {
- const actionId = getListViewCreateActionId(view);
- if (!actionId) return;
- return `New ${getCreateActionLabel(actionId)}`;
-}
-
-export function getCreateOptionLabel(optionId: ListViewCreateOptionId): string {
- return CREATE_OPTION_LABELS[optionId];
-}
-
-export function getListViewCreateOptions(
- view: ListView
-): ListViewCreateOption[] {
- if (view === 'documents') {
- return [
- { id: 'doc', label: 'New doc' },
- { id: 'canvas', label: 'New canvas' },
- { id: 'import', label: 'Import' },
- ];
- }
-
- const actionId = getListViewCreateActionId(view);
- if (!actionId) return [];
-
- return [{ id: actionId, label: `New ${getCreateOptionLabel(actionId)}` }];
-}
diff --git a/js/app/packages/app/component/mobile/MobileDock.tsx b/js/app/packages/app/component/mobile/MobileDock.tsx
index ec1a2ef1d2..5924f3083b 100644
--- a/js/app/packages/app/component/mobile/MobileDock.tsx
+++ b/js/app/packages/app/component/mobile/MobileDock.tsx
@@ -63,7 +63,7 @@ function MobileDockButton(props: MobileDockButtonProps) {
);
}
-const PRIMARY_IDS = ['inbox', 'channels', 'files', 'search'] as const;
+const PRIMARY_IDS = ['inbox', 'channels', 'folders', 'search'] as const;
const MORE_VIEWS = SIDEBAR_LINKS.filter(
(l) => !(PRIMARY_IDS as readonly string[]).includes(l.id)
@@ -239,8 +239,8 @@ export function MobileDock() {
<MobileDockButton
icon={AnimatedFolderIcon}
label="Files"
- active={isActive('files')}
- onClick={() => navigate('files')}
+ active={isActive('folders')}
+ onClick={() => navigate('folders')}
/>
<MorePopover
active={isMoreActive()}
diff --git a/js/app/packages/app/component/next-soup/filters/configs.ts b/js/app/packages/app/component/next-soup/filters/configs.ts
index 4dd2af6404..98bf445041 100644
--- a/js/app/packages/app/component/next-soup/filters/configs.ts
+++ b/js/app/packages/app/component/next-soup/filters/configs.ts
@@ -386,6 +386,11 @@ export const createSoupFilters = (
label: 'Task assigned to user',
predicate: taskAssignedToUserFilter(getUserID),
},
+ {
+ id: 'not-task',
+ label: 'Not Task',
+ predicate: (entity) => !taskFilter(entity),
+ },
...TASK_STATUS_FILTERS,
...TASK_PRIORITY_FILTERS,
...DOCUMENT_CONTEXTUAL_FILTERS,
diff --git a/js/app/packages/app/component/next-soup/filters/query-filters.ts b/js/app/packages/app/component/next-soup/filters/query-filters.ts
index 623e199995..b6a79fd651 100644
--- a/js/app/packages/app/component/next-soup/filters/query-filters.ts
+++ b/js/app/packages/app/component/next-soup/filters/query-filters.ts
@@ -136,6 +136,15 @@ export const QUERY_FILTERS = {
document_filters: { file_types: getFileAssociations('soup') },
},
+ documentAndFile: {
+ channel_filters: { channel_ids: EXCLUDE },
+ chat_filters: { chat_ids: EXCLUDE },
+ email_filters: { recipients: EXCLUDE },
+ document_filters: {
+ file_types: ['md', 'canvas', ...getFileAssociations('soup')],
+ },
+ },
+
channels: {
chat_filters: { chat_ids: EXCLUDE },
document_filters: { document_ids: EXCLUDE },
diff --git a/js/app/packages/app/component/next-soup/soup-view/empty-states.tsx b/js/app/packages/app/component/next-soup/soup-view/empty-states.tsx
index ef5ac153b9..ec2cacbe6b 100644
--- a/js/app/packages/app/component/next-soup/soup-view/empty-states.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/empty-states.tsx
@@ -80,9 +80,6 @@ export function EmptyState(props: {
<Match when={props.viewId === 'people'}>
<EmptyStateInner message={'No messages to show.'} />
</Match>
- <Match when={props.viewId === 'files'}>
- <EmptyStateInner message={'No files to show.'} showDropZone />
- </Match>
<Match when={props.viewId === 'folders'}>
<EmptyStateInner message={'No folders to show.'} showDropZone />
</Match>
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-context-filters.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-context-filters.tsx
index 7bd71fd890..d4062617ef 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-context-filters.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-context-filters.tsx
@@ -60,7 +60,7 @@ export const SoupViewContextFilters = () => {
<Match when={isComponentListView('channels')}>
<ChannelsFilters />
</Match>
- <Match when={isComponentListView('files')}>
+ <Match when={isComponentListView('folders')}>
<FilesFilters />
</Match>
</Switch>
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-context-sort.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-context-sort.tsx
index 4055b2ac6e..32bd4231c2 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-context-sort.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/soup-view-context-sort.tsx
@@ -48,7 +48,7 @@ export const SoupViewContextSort = () => {
<Match when={isComponentListView('channels')}>
<ChannelsSort />
</Match>
- <Match when={isComponentListView('files')}>
+ <Match when={isComponentListView('folders')}>
<FilesSort />
</Match>
</Switch>
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx
index 3c815e464b..d65cf69a32 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx
@@ -22,10 +22,6 @@ import { EntityIcon } from '@core/component/EntityIcon';
import { PropertyValueIcon } from '@core/component/Properties/component/propertyValue/PropertyValueIcon';
import { PROPERTY_OPTION_IDS } from '@core/component/Properties/constants';
-import FileCodeIcon from '@icon/regular/file-code.svg';
-import FileImageIcon from '@icon/regular/file-image.svg';
-import FilePdfIcon from '@icon/regular/file-pdf.svg';
-import FileIcon from '@icon/regular/file.svg';
import { useContacts } from '@queries/contacts/contacts';
import { useUserId } from '@core/context/user';
import { UserIcon } from '@core/component/UserIcon';
@@ -112,17 +108,17 @@ const MAIL_FILTER_CATEGORIES: FilterCategory[] = [
{
id: 'attachment-pdf',
label: 'PDFs',
- icon: () => <FilePdfIcon class="size-3.5" />,
+ icon: () => <EntityIcon targetType="pdf" size="xs" />,
},
{
id: 'attachment-image',
label: 'Images',
- icon: () => <FileImageIcon class="size-3.5" />,
+ icon: () => <EntityIcon targetType="image" size="xs" />,
},
{
id: 'attachment-document',
label: 'Documents',
- icon: () => <FileIcon class="size-3.5" />,
+ icon: () => <EntityIcon targetType="unknown" size="xs" />,
},
],
multiple: true,
@@ -244,41 +240,39 @@ const TASKS_FILTER_CATEGORIES: FilterCategory[] = [
];
const DOCUMENTS_FILTER_CATEGORIES: FilterCategory[] = [
- {
- id: 'type',
- label: 'Type',
- options: [
- { id: 'doc-markdown', label: 'Markdown' },
- { id: 'doc-canvas', label: 'Canvas' },
- ],
- multiple: true,
- },
-];
-
-const FILES_FILTER_CATEGORIES: FilterCategory[] = [
{
id: 'type',
label: 'Type',
options: [
+ {
+ id: 'doc-markdown',
+ label: 'Markdown',
+ icon: () => <EntityIcon targetType="md" size="xs" />,
+ },
+ {
+ id: 'doc-canvas',
+ label: 'Canvas',
+ icon: () => <EntityIcon targetType="canvas" size="xs" />,
+ },
{
id: 'file-code',
label: 'Code',
- icon: () => <FileCodeIcon class="size-3.5" />,
+ icon: () => <EntityIcon targetType="code" size="xs" />,
},
{
id: 'file-image',
label: 'Images',
- icon: () => <FileImageIcon class="size-3.5" />,
+ icon: () => <EntityIcon targetType="image" size="xs" />,
},
{
id: 'file-pdf',
label: 'PDFs',
- icon: () => <FilePdfIcon class="size-3.5" />,
+ icon: () => <EntityIcon targetType="pdf" size="xs" />,
},
{
id: 'file-other',
label: 'Other',
- icon: () => <FileIcon class="size-3.5" />,
+ icon: () => <EntityIcon targetType="unknown" size="xs" />,
},
],
multiple: true,
@@ -302,7 +296,7 @@ export const VIEW_FILTER_CATEGORIES: Record<ListView, FilterCategory[]> = {
documents: DOCUMENTS_FILTER_CATEGORIES,
tasks: TASKS_FILTER_CATEGORIES,
channels: [],
- files: FILES_FILTER_CATEGORIES,
+ folders: [],
search: [],
};
@@ -560,74 +554,123 @@ export const UnifiedFilterDropdown = () => {
<DropdownMenu.Portal>
<DropdownMenu.Content class="z-action-menu bg-menu border border-edge-muted rounded-sm shadow-xl min-w-[180px] p-1">
- <For each={categories()}>
- {(category) => (
- <DropdownMenu.Sub gutter={4}>
- <DropdownMenu.SubTrigger class="w-full flex items-center justify-between gap-2 px-3 py-1.5 rounded-xs text-left text-xs transition-colors hover:bg-hover outline-none data-[highlighted]:bg-hover">
- <span class="text-ink">{category.label}</span>
- <CaretRightIcon class="size-3 text-ink-muted" />
- </DropdownMenu.SubTrigger>
-
- <DropdownMenu.Portal>
- <DropdownMenu.SubContent class="z-action-menu bg-menu border border-edge-muted rounded-sm shadow-xl min-w-[160px] p-1">
- <For each={category.options}>
- {(option) => {
- const active = () => isOptionActive(option.id);
- return (
- <DropdownMenu.Item
- class="w-full flex items-center gap-2.5 px-3 py-1.5 rounded-xs text-left text-xs transition-colors hover:bg-hover outline-none data-[highlighted]:bg-hover cursor-pointer"
- onSelect={() => toggleFilter(option.id)}
- closeOnSelect={!category.multiple}
- >
- <span
- class={cn(
- 'size-4 flex items-center justify-center shrink-0 rounded border transition-colors',
- active()
- ? 'bg-accent border-accent'
- : 'border-edge'
- )}
- >
- <Show when={active()}>
- <CheckIcon class="size-2.5 text-page" />
- </Show>
- </span>
-
- <Show when={option.icon}>
- {(icon) => (
- <span class="size-4 flex items-center justify-center shrink-0">
- {icon()()}
- </span>
- )}
- </Show>
-
- <span
- class={cn(
- 'flex-1 truncate',
- active() ? 'text-ink' : 'text-ink-muted'
- )}
- >
- {option.label}
- </span>
- </DropdownMenu.Item>
- );
- }}
- </For>
- </DropdownMenu.SubContent>
- </DropdownMenu.Portal>
- </DropdownMenu.Sub>
- )}
- </For>
+ <Show
+ when={categories().length === 1 && !isTasksView()}
+ fallback={
+ <>
+ <For each={categories()}>
+ {(category) => (
+ <DropdownMenu.Sub gutter={4}>
+ <DropdownMenu.SubTrigger class="w-full flex items-center justify-between gap-2 px-3 py-1.5 rounded-xs text-left text-xs transition-colors hover:bg-hover outline-none data-[highlighted]:bg-hover">
+ <span class="text-ink">{category.label}</span>
+ <CaretRightIcon class="size-3 text-ink-muted" />
+ </DropdownMenu.SubTrigger>
+
+ <DropdownMenu.Portal>
+ <DropdownMenu.SubContent class="z-action-menu bg-menu border border-edge-muted rounded-sm shadow-xl min-w-[160px] p-1">
+ <For each={category.options}>
+ {(option) => {
+ const active = () => isOptionActive(option.id);
+ return (
+ <DropdownMenu.Item
+ class="w-full flex items-center gap-2.5 px-3 py-1.5 rounded-xs text-left text-xs transition-colors hover:bg-hover outline-none data-[highlighted]:bg-hover cursor-pointer"
+ onSelect={() => toggleFilter(option.id)}
+ closeOnSelect={!category.multiple}
+ >
+ <span
+ class={cn(
+ 'size-4 flex items-center justify-center shrink-0 rounded border transition-colors',
+ active()
+ ? 'bg-accent border-accent'
+ : 'border-edge'
+ )}
+ >
+ <Show when={active()}>
+ <CheckIcon class="size-2.5 text-page" />
+ </Show>
+ </span>
+
+ <Show when={option.icon}>
+ {(icon) => (
+ <span class="size-4 flex items-center justify-center shrink-0">
+ {icon()()}
+ </span>
+ )}
+ </Show>
+
+ <span
+ class={cn(
+ 'flex-1 truncate',
+ active() ? 'text-ink' : 'text-ink-muted'
+ )}
+ >
+ {option.label}
+ </span>
+ </DropdownMenu.Item>
+ );
+ }}
+ </For>
+ </DropdownMenu.SubContent>
+ </DropdownMenu.Portal>
+ </DropdownMenu.Sub>
+ )}
+ </For>
+
+ {/* Assignee filter for tasks view */}
+ <Show when={isTasksView()}>
+ <SearchableFilterSubmenu
+ label="Assignee"
+ options={assigneeOptions}
+ activeIds={assigneeFilter}
+ onToggle={toggleAssignee}
+ placeholder="Search assignees..."
+ multiple
+ />
+ </Show>
+ </>
+ }
+ >
+ {/* Single category: render options directly */}
+ <For each={categories()[0]!.options}>
+ {(option) => {
+ const active = () => isOptionActive(option.id);
+ return (
+ <DropdownMenu.Item
+ class="w-full flex items-center gap-2.5 px-3 py-1.5 rounded-xs text-left text-xs transition-colors hover:bg-hover outline-none data-[highlighted]:bg-hover cursor-pointer"
+ onSelect={() => toggleFilter(option.id)}
+ closeOnSelect={!categories()[0]!.multiple}
+ >
+ <span
+ class={cn(
+ 'size-4 flex items-center justify-center shrink-0 rounded border transition-colors',
+ active() ? 'bg-accent border-accent' : 'border-edge'
+ )}
+ >
+ <Show when={active()}>
+ <CheckIcon class="size-2.5 text-page" />
+ </Show>
+ </span>
+
+ <Show when={option.icon}>
+ {(icon) => (
+ <span class="size-4 flex items-center justify-center shrink-0">
+ {icon()()}
+ </span>
+ )}
+ </Show>
- {/* Assignee filter for tasks view */}
- <Show when={isTasksView()}>
- <SearchableFilterSubmenu
- label="Assignee"
- options={assigneeOptions}
- activeIds={assigneeFilter}
- onToggle={toggleAssignee}
- placeholder="Search assignees..."
- multiple
- />
+ <span
+ class={cn(
+ 'flex-1 truncate',
+ active() ? 'text-ink' : 'text-ink-muted'
+ )}
+ >
+ {option.label}
+ </span>
+ </DropdownMenu.Item>
+ );
+ }}
+ </For>
</Show>
</DropdownMenu.Content>
</DropdownMenu.Portal>
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/use-filter-refinements.ts b/js/app/packages/app/component/next-soup/soup-view/filters-bar/use-filter-refinements.ts
index 0eaf3f83c0..c26193e3e1 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/use-filter-refinements.ts
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/use-filter-refinements.ts
@@ -31,6 +31,7 @@ const TAB_ONLY_FILTERS = new Set([
'email',
'no-drafts',
'email-drafts',
+ 'not-task',
]);
/**
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view-create-button.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view-create-button.tsx
new file mode 100644
index 0000000000..93d812bdf5
--- /dev/null
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view-create-button.tsx
@@ -0,0 +1,119 @@
+import { CREATABLE_BLOCKS, runCreateAction } from '@app/component/Launcher';
+import { useSplitPanelOrThrow } from '@app/component/split-layout/layoutUtils';
+import { isListViewID, type ListView } from '@app/constants/list-views';
+import { DropdownMenuContent, MenuItem } from '@core/component/Menu';
+import { EntityIcon } from '@core/component/EntityIcon';
+import { openFilePicker } from '@core/util/upload';
+import { useHandleFileUpload } from '@app/util/handleFileUpload';
+import type { BlockName } from '@core/block';
+import ChevronDownIcon from '@icon/regular/caret-down.svg';
+import UploadIcon from '@icon/regular/upload.svg';
+import { DropdownMenu } from '@kobalte/core/dropdown-menu';
+import { createMemo, For, Show } from 'solid-js';
+import { Button } from '@ui/components/Button';
+
+// Which blocks to show as create options per view, in order
+const VIEW_CREATE_BLOCKNAMES: Partial<Record<ListView, BlockName[]>> = {
+ documents: ['md', 'canvas', 'code'],
+ tasks: ['task'],
+ agents: ['chat'],
+ mail: ['email'],
+ channels: ['channel'],
+ folders: ['project'],
+};
+
+type CreateOption = {
+ id: BlockName | 'import';
+ label: string;
+};
+
+const IMPORT_OPTION: CreateOption = { id: 'import', label: 'Import' };
+
+function getViewCreateOptions(view: ListView): CreateOption[] {
+ const createNames = VIEW_CREATE_BLOCKNAMES[view] ?? [];
+ const options: CreateOption[] = createNames.flatMap((name) => {
+ const block = CREATABLE_BLOCKS.find((b) => b.blockName === name);
+ if (!block) return [];
+ return [{ id: block.blockName, label: block.label }];
+ });
+ if (view === 'documents') options.push(IMPORT_OPTION);
+ return options;
+}
+
+function CreateOptionIcon(props: { id: BlockName | 'import' }) {
+ return (
+ <Show
+ when={props.id !== 'import'}
+ fallback={<UploadIcon class="size-3.5" />}
+ >
+ <EntityIcon targetType={props.id as BlockName} size="xs" />
+ </Show>
+ );
+}
+
+export const SoupViewCreateButton = () => {
+ const panel = useSplitPanelOrThrow();
+ const handleFileUpload = useHandleFileUpload();
+
+ const options = createMemo<CreateOption[]>(() => {
+ const content = panel.handle.content();
+ if (content.type !== 'component') return [];
+ const view = isListViewID(content.id) ? content.id : undefined;
+ if (!view) return [];
+ return getViewCreateOptions(view);
+ });
+
+ const handleSelect = (option: CreateOption) => {
+ if (option.id === 'import') {
+ openFilePicker({ multiple: true }, async (files) => {
+ await handleFileUpload(files, false);
+ });
+ return;
+ }
+ runCreateAction(option.id);
+ };
+
+ return (
+ <Show when={options().length > 0}>
+ <Show
+ when={options().length > 1}
+ fallback={
+ <Button
+ variant="secondary"
+ size="sm"
+ class="rounded-xs whitespace-nowrap px-2"
+ onClick={() => handleSelect(options()[0])}
+ >
+ <CreateOptionIcon id={options()[0].id} />
+ Create
+ </Button>
+ }
+ >
+ <DropdownMenu placement="bottom-start" gutter={4}>
+ <DropdownMenu.Trigger
+ as={Button}
+ variant="secondary"
+ size="sm"
+ class="rounded-xs whitespace-nowrap px-2"
+ >
+ <span>Create</span>
+ <ChevronDownIcon class="size-3" />
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Portal>
+ <DropdownMenuContent class="z-action-menu min-w-[160px]">
+ <For each={options()}>
+ {(item) => (
+ <MenuItem
+ text={item.label}
+ icon={<CreateOptionIcon id={item.id} />}
+ onClick={() => handleSelect(item)}
+ />
+ )}
+ </For>
+ </DropdownMenuContent>
+ </DropdownMenu.Portal>
+ </DropdownMenu>
+ </Show>
+ </Show>
+ );
+};
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx
index b0c4fbe8a0..9896f9786c 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx
@@ -2,38 +2,25 @@ import {
VIEW_TAB_PRESETS,
type PresetContext,
} from '@app/component/app-sidebar/soup-filter-presets';
-import { runCreateAction } from '@app/component/Launcher';
import type { FilterID } from '@app/component/next-soup/filters/configs';
import type { SoupItemsQueryFilters } from '@queries/soup/items';
import { useSoup } from '@app/component/next-soup/soup-context';
import { useSoupView } from '@app/component/next-soup/soup-view/soup-view-context';
import { useSplitPanelOrThrow } from '@app/component/split-layout/layoutUtils';
import { isListViewID, type ListView } from '@app/constants/list-views';
-import {
- type ListViewCreateActionId,
- type ListViewCreateOptionId,
- getListViewCreateOptions,
-} from '@app/component/list-view-create';
-import { useHandleFileUpload } from '@app/util/handleFileUpload';
-import { DropdownMenuContent, MenuItem } from '@core/component/Menu';
import { useUserContext } from '@core/context/user';
-import { openFilePicker } from '@core/util/upload';
-import ChevronDownIcon from '@icon/regular/caret-down.svg';
import {
batch,
createMemo,
For,
Match,
type ParentComponent,
- Show,
Switch,
} from 'solid-js';
-import { DropdownMenu } from '@kobalte/core/dropdown-menu';
import {
SegmentedControl as KSegmentedControl,
type SegmentedControlRootProps,
} from '@kobalte/core/segmented-control';
-import { Button } from '@ui/components/Button';
const useCurrentListView = () => {
const panel = useSplitPanelOrThrow();
@@ -109,80 +96,13 @@ export const SoupViewTabs = () => {
<Match when={isComponentListView('channels')}>
<ChannelsTabs />
</Match>
- <Match when={isComponentListView('files')}>
+ <Match when={isComponentListView('folders')}>
<FilesTabs />
</Match>
</Switch>
);
};
-export const SoupViewCreateButton = () => {
- const listView = useCurrentListView();
- const handleFileUpload = useHandleFileUpload();
- const options = createMemo(() => {
- const view = listView();
- if (!view) return [];
- return getListViewCreateOptions(view);
- });
-
- const primaryOption = createMemo(() => options()[0]);
-
- const handleSelect = (optionId: ListViewCreateOptionId) => {
- if (optionId === 'import') {
- openFilePicker({ multiple: true }, async (files) => {
- await handleFileUpload(files, false);
- });
- return;
- }
-
- runCreateAction(optionId as ListViewCreateActionId);
- };
-
- return (
- <Show when={primaryOption()}>
- {(option) => (
- <Show
- when={options().length > 1}
- fallback={
- <Button
- variant="secondary"
- size="sm"
- class="rounded-xs whitespace-nowrap px-3"
- onClick={() => handleSelect(option().id)}
- >
- {option().label}
- </Button>
- }
- >
- <DropdownMenu placement="bottom-start" gutter={4}>
- <DropdownMenu.Trigger
- as={Button}
- variant="secondary"
- size="sm"
- class="rounded-xs whitespace-nowrap px-3"
- >
- <span>{option().label}</span>
- <ChevronDownIcon class="size-3" />
- </DropdownMenu.Trigger>
- <DropdownMenu.Portal>
- <DropdownMenuContent class="z-action-menu min-w-[160px]">
- <For each={options()}>
- {(item) => (
- <MenuItem
- text={item.label}
- onClick={() => handleSelect(item.id)}
- />
- )}
- </For>
- </DropdownMenuContent>
- </DropdownMenu.Portal>
- </DropdownMenu>
- </Show>
- )}
- </Show>
- );
-};
-
const InboxTabs = () => {
const { applyTabPreset } = useApplyPreset();
const { activeTab } = useSoupView();
@@ -254,6 +174,7 @@ const DocumentsTabs = () => {
list={[
{ value: 'owned', label: 'Owned' },
{ value: 'shared', label: 'Shared' },
+ { value: 'attachments', label: 'Attachments' },
{ value: 'all', label: 'All' },
]}
value={activeTab()}
@@ -313,13 +234,11 @@ const FilesTabs = () => {
<SegmentedControl
list={[
{ value: 'owned', label: 'Owned' },
- { value: 'shared', label: 'Shared' },
- { value: 'attachments', label: 'Attachments' },
{ value: 'all', label: 'All' },
]}
value={activeTab()}
- defaultValue={VIEW_TAB_PRESETS.files.default}
- onChange={(value) => applyTabPreset('files', value)}
+ defaultValue={VIEW_TAB_PRESETS.folders.default}
+ onChange={(value) => applyTabPreset('folders', value)}
/>
</div>
);
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
index 6bf4baa93b..76532aa235 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
@@ -80,10 +80,10 @@ import type { SystemSortOption } from '@app/component/next-soup/soup-view/sort-o
import type { SoupItemsQueryFilters } from '@queries/soup/items';
import type { FilterID } from '@app/component/next-soup/filters';
import {
- SoupViewCreateButton,
SoupViewTabs,
useApplyPreset,
} from '@app/component/next-soup/soup-view/soup-view-tabs';
+import { SoupViewCreateButton } from '@app/component/next-soup/soup-view/soup-view-create-button';
import { isListViewID, type ListView } from '@app/constants/list-views';
import {
SplitHeaderLeft,
@@ -212,8 +212,8 @@ export const SoupView = (props: SoupViewProps) => {
</h1>
</Show>
<Show when={!narrowSearchExpanded()}>
- <SoupViewCreateButton />
<SoupViewTabs />
+ <SoupViewCreateButton />
</Show>
<Show when={narrowSearchExpanded()}>
<div class="flex-1 min-w-0">
diff --git a/js/app/packages/app/component/split-layout/componentRegistry.tsx b/js/app/packages/app/component/split-layout/componentRegistry.tsx
index 5cd315fe12..5f2d7484ad 100644
--- a/js/app/packages/app/component/split-layout/componentRegistry.tsx
+++ b/js/app/packages/app/component/split-layout/componentRegistry.tsx
@@ -188,10 +188,10 @@ registerComponent(
);
registerComponent(
- 'files',
+ 'folders',
withAuth(() => {
const user = useUserContext();
- const preset = getDefaultListViewPreset('files', {
+ const preset = getDefaultListViewPreset('folders', {
userId: user.userId(),
email: user.email(),
});
diff --git a/js/app/packages/app/constants/list-views.ts b/js/app/packages/app/constants/list-views.ts
index 97757a758e..01b0cb546e 100644
--- a/js/app/packages/app/constants/list-views.ts
+++ b/js/app/packages/app/constants/list-views.ts
@@ -7,7 +7,7 @@ export const LIST_VIEWS = [
'documents',
'tasks',
'channels',
- 'files',
+ 'folders',
'search',
] as const;
@@ -20,7 +20,7 @@ export const LIST_VIEW_PATHS = {
documents: '/documents',
tasks: '/tasks',
channels: '/channels',
- files: '/files',
+ folders: '/folders',
search: '/search',
} as const satisfies Record<ListView, string>;
@@ -35,7 +35,7 @@ export const LIST_VIEW_ID = {
documents: 'documents',
tasks: 'tasks',
channels: 'channels',
- files: 'files',
+ folders: 'folders',
search: 'search',
} as const satisfies Record<ListView, string>;
@@ -49,18 +49,18 @@ const BLOCK_LIST_VIEW_MAP = {
channel: 'channels',
canvas: 'documents',
chat: 'agents',
- code: 'files',
+ code: 'documents',
contact: 'channels',
- csv: 'files',
+ csv: 'documents',
email: 'mail',
- image: 'files',
+ image: 'documents',
md: 'documents',
- pdf: 'files',
- project: 'files',
+ pdf: 'documents',
+ project: 'folders',
task: 'tasks',
unknown: 'inbox',
- video: 'files',
- write: 'files',
+ video: 'documents',
+ write: 'documents',
} as const satisfies Record<BlockName | BlockAlias, ListView>;
export const getBlockListView = (block: BlockName | BlockAlias): ListView => {
diff --git a/js/app/packages/block-channel/component/Compose.tsx b/js/app/packages/block-channel/component/Compose.tsx
index 1bc1eb94a7..aab69fc0fe 100644
--- a/js/app/packages/block-channel/component/Compose.tsx
+++ b/js/app/packages/block-channel/component/Compose.tsx
@@ -15,6 +15,7 @@ import {
type WithCustomUserInput,
} from '@core/user';
import { handleFileFolderDrop } from '@core/util/upload';
+import InfoIcon from '@icon/regular/info.svg';
import { createEffect, createMemo, createSignal, on, Show } from 'solid-js';
import { createStore } from 'solid-js/store';
import { handleFileUpload } from '../utils/inputAttachments';
@@ -152,12 +153,15 @@ export function ChannelCompose() {
triedToSubmit={triedToSubmit}
focusOnMount
/>
- <p class="text-ink-muted text-xs pt-8">
- Send a Macro message to anyone; share macro files, tasks, and
- communicate with your team. If your message recipient is not
- already a Macro user, they will receive an email to sign up for
- free. If you want to send an email instead, send an email.
- </p>
+ <div class="mt-6 p-3 flex flex-row items-center border border-edge-muted text-ink-placeholder rounded-md">
+ <InfoIcon class="shrink-0 size-8 mr-4 fill-edge" />
+ <p class="text-xs">
+ Send a Macro message to anyone. Share your files, tasks, emails;
+ you can <code>@mention</code> anything. If your message
+ recipient is not already a Macro user, they will receive an
+ email letting them know they received a message on Macro.
+ </p>
+ </div>
</div>
</div>
<div class="shrink-0 w-full pb-2 @min-[40rem]:px-4">
diff --git a/js/app/packages/core/block.ts b/js/app/packages/core/block.ts
index 1ceccbe905..a348a48eac 100644
--- a/js/app/packages/core/block.ts
+++ b/js/app/packages/core/block.ts
@@ -58,6 +58,7 @@ export const BlockRegistry = [
'video',
'email',
'contact',
+ 'task',
] as const;
type BlockNameKeys = keyof typeof BlockRegistry & number;
@@ -138,6 +139,7 @@ export const ValidBlockCombinations: BlockCombinationRules = {
unknown: allBlockNames,
video: allBlockNames,
contact: allBlockNames,
+ task: allBlockNames,
} as const;
// maps block name to valid parents
@@ -155,6 +157,7 @@ export const ValidNestingCombinations: BlockCombinationRules = {
unknown: new Set([]),
video: new Set([]),
contact: new Set([]),
+ task: new Set([]),
};
export const LoadErrors = {
diff --git a/js/app/packages/core/constant/featureFlags.ts b/js/app/packages/core/constant/featureFlags.ts
index 131c84bf0c..55e1293144 100644
--- a/js/app/packages/core/constant/featureFlags.ts
+++ b/js/app/packages/core/constant/featureFlags.ts
@@ -234,10 +234,6 @@ export const ENABLE_DOCK_NOTITIFCATIONS = resolveFeatureFlag(
);
export const ENABLE_TTFT = resolveFeatureFlag('ENABLE_TTFT', DEV_MODE_ENV);
-export const ENABLE_CREATE_TASK = resolveFeatureFlag(
- 'ENABLE_CREATE_TASK',
- true
-);
export const ENABLE_TASKS_TABS = resolveFeatureFlag('ENABLE_TASKS_TABS', true);
export const ENABLE_EMAIL_SHARING = resolveFeatureFlag(