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(soup): add default tasks view (#523)

Seamuse88cdf01f108
diff --git a/js/app/packages/app/component/UnifiedListView.tsx b/js/app/packages/app/component/UnifiedListView.tsx
index b5bd8832ff..f24d34ee0f 100644
--- a/js/app/packages/app/component/UnifiedListView.tsx
+++ b/js/app/packages/app/component/UnifiedListView.tsx
@@ -49,9 +49,10 @@ import {
type EntityClickHandler,
type EntityData,
type EntityFilter,
- type EntityType,
+ type ExpandedEntityType,
importantFilterFn,
isSearchEntity,
+ isTaskEntity,
notDoneFilterFn,
type SortOption,
sortByCreatedAt,
@@ -676,8 +677,15 @@ export function UnifiedListView(props: UnifiedListViewProps) {
filterFns.push(createProjectFilterFn(projectFilter_));
}
- if (entityTypeFilter().length > 0)
- filterFns.push(({ type }) => entityTypeFilter().includes(type));
+ if (entityTypeFilter().length > 0) {
+ filterFns.push((entity) => {
+ // special case the tasks, entity type will still be document
+ if (isTaskEntity(entity)) {
+ return entityTypeFilter().includes('task');
+ }
+ return entityTypeFilter().includes(entity.type);
+ });
+ }
const fileTypeCompatibilityFilter_ = fileTypeCompatibilityFilter();
if (fileTypeCompatibilityFilter_)
@@ -698,6 +706,7 @@ export function UnifiedListView(props: UnifiedListViewProps) {
for (const type of types) {
switch (type) {
case 'document':
+ case 'task':
includeArray.push('documents');
break;
case 'chat':
@@ -804,6 +813,7 @@ export function UnifiedListView(props: UnifiedListViewProps) {
document_filters: {
document_ids:
entityTypeFilter().includes('document') ||
+ entityTypeFilter().includes('task') ||
entityTypeFilter().length === 0
? []
: [GARBAGE_UUID],
@@ -981,7 +991,7 @@ export function UnifiedListView(props: UnifiedListViewProps) {
},
{
query: searchNameContentInfiniteQuery,
- operations: { filter: false, search: false },
+ operations: { filter: true, search: false },
},
],
entityMapper,
@@ -1312,6 +1322,11 @@ export function UnifiedListView(props: UnifiedListViewProps) {
setFilter={setEntityTypeFilter}
type="channel"
/>
+ <EntityTypeToggle
+ filter={entityTypeFilter}
+ setFilter={setEntityTypeFilter}
+ type="task"
+ />
<EntityTypeToggle
filter={entityTypeFilter}
setFilter={setEntityTypeFilter}
@@ -1737,12 +1752,12 @@ export function UnifiedListView(props: UnifiedListViewProps) {
}
const EntityTypeToggle = (props: {
- type: EntityType;
+ type: ExpandedEntityType;
filter: Accessor<typeof VIEWCONFIG_BASE.filters.typeFilter>;
setFilter: Setter<typeof VIEWCONFIG_BASE.filters.typeFilter>;
setFileTypeFilter?: Setter<typeof VIEWCONFIG_BASE.filters.documentTypeFilter>;
}) => {
- const toggleEntityTypeFilter = (type: EntityType) => {
+ const toggleEntityTypeFilter = (type: ExpandedEntityType) => {
props.setFilter((prev) =>
prev.includes(type) ? prev.filter((t) => t !== type) : [...prev, type]
);
diff --git a/js/app/packages/app/component/ViewConfig.tsx b/js/app/packages/app/component/ViewConfig.tsx
index fa27cdb508..31128b1b31 100644
--- a/js/app/packages/app/component/ViewConfig.tsx
+++ b/js/app/packages/app/component/ViewConfig.tsx
@@ -12,6 +12,7 @@ import {
queryKeys,
type WithNotification,
} from '@macro-entity';
+
import {
markNotificationsForEntityAsDone,
type NotificationSource,
@@ -240,6 +241,12 @@ const ALL_VIEWCONFIG_DEFAULTS = {
typeFilter: ['document'],
},
},
+ tasks: {
+ view: 'Tasks',
+ filters: {
+ typeFilter: ['task'],
+ },
+ },
folders: {
view: 'Folders',
filters: {
@@ -296,13 +303,14 @@ export const VIEWCONFIG_SORT_ORDER: readonly SortOptions['sortOrder'][] = [
export const VIEWCONFIG_FILTER_DOCUMENT_TYPE_FILTER: readonly FilterOptions['documentTypeFilter'][number][] =
['md', 'code', 'image', 'canvas', 'pdf', 'unknown'] as const;
export const VIEWCONFIG_FILTER_ENTITY_TYPE: readonly FilterOptions['typeFilter'][number][] =
- ['channel', 'chat', 'document', 'email', 'project'] as const;
+ ['channel', 'chat', 'document', 'email', 'project', 'task'] as const;
export const VIEW_CLIENT_FILTERS: Record<ViewId, ClientFilter[]> = {
signal: [signalFilter],
noise: [noiseFilter],
people: [],
files: [],
+ tasks: [],
folders: [],
all: [],
};
diff --git a/js/app/packages/core/types/view.ts b/js/app/packages/core/types/view.ts
index cc28b5cf22..dce6134ad8 100644
--- a/js/app/packages/core/types/view.ts
+++ b/js/app/packages/core/types/view.ts
@@ -3,6 +3,7 @@ export const DEFAULT_VIEWS = [
'noise',
'people',
'files',
+ 'tasks',
'folders',
'all',
] as const;
diff --git a/js/app/packages/macro-entity/src/types/entity.ts b/js/app/packages/macro-entity/src/types/entity.ts
index 72abf26d47..784566f657 100644
--- a/js/app/packages/macro-entity/src/types/entity.ts
+++ b/js/app/packages/macro-entity/src/types/entity.ts
@@ -118,12 +118,10 @@ export const isTaskEntity = (entity: EntityData): entity is TaskEntity => {
);
};
-export const isMarkdownEntity = (
+export const isPureDocumentEntity = (
entity: EntityData
-): entity is MarkdownEntity => {
- return (
- entity.type === 'document' && entity.fileType === 'md' && !entity.subType
- );
+): entity is DocumentEntity => {
+ return entity.type === 'document' && !entity.subType;
};
export type EntityType = EntityData['type'];