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(tasks): surface default status filter (#4144)
gbirman51524c0e7a95
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.tsindex 421d2bb9ec..480153de43 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@@ -43,6 +43,31 @@ type ViewTabConfig = {tabs: TabConfig;};+// Default statuses for the open-task tabs; keep the ids and include props in sync.+const OPEN_TASK_STATUS_FILTER_IDS: FilterID[] = [+ 'task-not-started',+ 'task-in-progress',+ 'task-in-review',+];++const OPEN_TASK_STATUS_INCLUDE_PROPS = [+ {+ propertyId: SYSTEM_PROPERTY_IDS.STATUS,+ type: 'select' as const,+ value: PROPERTY_OPTION_IDS.STATUS.NOT_STARTED,+ },+ {+ propertyId: SYSTEM_PROPERTY_IDS.STATUS,+ type: 'select' as const,+ value: PROPERTY_OPTION_IDS.STATUS.IN_PROGRESS,+ },+ {+ propertyId: SYSTEM_PROPERTY_IDS.STATUS,+ type: 'select' as const,+ value: PROPERTY_OPTION_IDS.STATUS.IN_REVIEW,+ },+];+const getExcludedDocumentSubTypes = (...subTypes: string[]) =>ENABLE_SNIPPETS() ? subTypes : [...subTypes, 'snippet'];@@ -301,24 +326,14 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {type: 'entity',value: ctx.userId,},- ],- },- exclude: {- properties: [- {- propertyId: SYSTEM_PROPERTY_IDS.STATUS,- type: 'select',- value: PROPERTY_OPTION_IDS.STATUS.COMPLETED,- },- {- propertyId: SYSTEM_PROPERTY_IDS.STATUS,- type: 'select',- value: PROPERTY_OPTION_IDS.STATUS.CANCELED,- },+ ...OPEN_TASK_STATUS_INCLUDE_PROPS,],},}),- clientFilters: { and: ['task', 'assigned-to', 'active-task'] },+ clientFilters: {+ and: ['task', 'assigned-to'],+ or: [...OPEN_TASK_STATUS_FILTER_IDS],+ },groupBy: `property:${SYSTEM_PROPERTY_IDS.PRIORITY}`,};},@@ -326,9 +341,16 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {if (!ctx.userId) return undefined;return {filters: defineQueryFilters({- include: { subType: ['task'], documentOwnerId: [ctx.userId] },+ include: {+ subType: ['task'],+ documentOwnerId: [ctx.userId],+ properties: [...OPEN_TASK_STATUS_INCLUDE_PROPS],+ },}),- clientFilters: { and: ['task', 'active-task', 'owned-entity'] },+ clientFilters: {+ and: ['task', 'owned-entity'],+ or: [...OPEN_TASK_STATUS_FILTER_IDS],+ },groupBy: `property:${SYSTEM_PROPERTY_IDS.STATUS}`,};},diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/task-status-filter.ts b/js/app/packages/app/component/next-soup/soup-view/filters-bar/task-status-filter.tsnew file mode 100644index 0000000000..58ea30009a--- /dev/null+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/task-status-filter.ts@@ -0,0 +1,45 @@+import type { FilterID } from '@app/component/next-soup/filters';+import type { Query } from '@app/component/next-soup/filters/filter-store';+import { useSoupView } from '@app/component/next-soup/soup-view/soup-view-context';+import { batch } from 'solid-js';++export const TASK_STATUS_FILTER_IDS: FilterID[] = [+ 'task-not-started',+ 'task-in-progress',+ 'task-in-review',+ 'task-completed',+ 'task-canceled',+];++export function useTaskStatusFilter() {+ const { soup, queryFilters } = useSoupView();++ const statusQuery = (id: FilterID): Query | undefined => {+ const query = soup.predicates.getConfig(id)?.query;+ return query ? (query as Query) : undefined;+ };++ const setStatus = (id: FilterID, wasActive: boolean) => {+ soup.predicates.toggle({ or: [id] });+ const query = statusQuery(id);+ if (!query) return;+ if (wasActive) queryFilters.remove(query);+ else queryFilters.add(query);+ };++ const isActive = (id: FilterID) => soup.predicates.isActive(id);++ const clear = () =>+ batch(() => {+ for (const id of TASK_STATUS_FILTER_IDS) {+ if (isActive(id)) setStatus(id, true);+ }+ });++ const toggle = (id: FilterID) => {+ const active = isActive(id);+ batch(() => setStatus(id, active));+ };++ return { isActive, toggle, clear };+}diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/use-filter-refinements.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/use-filter-refinements.tsxindex 8ffbc923b3..4193778c85 100644--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/use-filter-refinements.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/use-filter-refinements.tsx@@ -30,6 +30,10 @@ import type {FilterValue,} from './consolidated-filter-chip';import type { SearchableOption } from './searchable-multi-select';+import {+ TASK_STATUS_FILTER_IDS,+ useTaskStatusFilter,+} from './task-status-filter';import {buildContactLabel,VIEW_FILTER_CATEGORIES,@@ -68,6 +72,7 @@ export function useFilterRefinements() {const user = useUserContext();const contacts = useContacts();const currentUserId = useUserId();+ const taskStatus = useTaskStatusFilter();const getPresetContext = (): PresetContext => ({userId: user.userId(),@@ -295,6 +300,9 @@ export function useFilterRefinements() {>();for (const category of viewCategories()) {+ // Status has a dedicated chip below.+ if (view === 'tasks' && category.id === 'status') continue;+const activeValues: FilterValue[] = [];const allOptions: FilterValue[] = [];@@ -406,6 +414,43 @@ export function useFilterRefinements() {);}+ // Dedicated chip: the generic builder would hide the preset-seeded default.+ const pushTaskStatusChip = () => {+ if (view !== 'tasks') return;+ const statusCategory = viewCategories().find((c) => c.id === 'status');+ if (!statusCategory) return;++ const allOptions: FilterValue[] = statusCategory.options.map((o) => ({+ id: o.id,+ label: o.label,+ icon: o.icon,+ }));++ const getActiveValues = (): FilterValue[] =>+ allOptions.filter((o) => taskStatus.isActive(o.id as FilterID));++ // No chip when not narrowed (empty, or all selected = no filter).+ const activeCount = getActiveValues().length;+ if (activeCount === 0 || activeCount === allOptions.length) return;++ const key = 'status';+ seenKeys.add(key);++ filters.push(+ getOrCreateConsolidatedChip(key, () => ({+ key,+ categoryLabel: 'Status',+ categoryLabelPlural: 'Statuses',+ values: getActiveValues,+ availableOptions: allOptions,+ multiple: true,+ isValueActive: (id) => taskStatus.isActive(id as FilterID),+ onToggleValue: (id) => taskStatus.toggle(id as FilterID),+ onRemoveAll: () => taskStatus.clear(),+ }))+ );+ };+// Assignee filter (consolidated) - using searchable approachconst pushAssigneeConsolidatedChip = () => {const key = 'assignee';@@ -454,6 +499,7 @@ export function useFilterRefinements() {);};+ pushTaskStatusChip();pushAssigneeConsolidatedChip();// Evict stale chips@@ -565,10 +611,16 @@ export function useFilterRefinements() {const preset = currentPreset();if (!preset) return;+ // "Clear all" empties the status filter rather than restoring the default subset.+ const presetSeedsStatusSubset = (preset.clientFilters.or ?? []).some((id) =>+ TASK_STATUS_FILTER_IDS.includes(id as FilterID)+ );+batch(() => {soup.predicates.set(preset.clientFilters);queryFilters.replace(preset.filters ?? null);setAssigneeFilter([]);+ if (presetSeedsStatusSubset) taskStatus.clear();});};