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
fix(unified-list): add tag filtering to email and tasks views (#7837)
Jacob Beckerman1c67d5b93446
diff --git a/apps/web/src/features/email-view/components/EmailList.tsx b/apps/web/src/features/email-view/components/EmailList.tsxindex a2ca5fddb3..586a003f54 100644--- a/apps/web/src/features/email-view/components/EmailList.tsx+++ b/apps/web/src/features/email-view/components/EmailList.tsx@@ -76,8 +76,14 @@ export type EmailListProps = {};export function EmailList(props: EmailListProps) {- const { state, source, list, registerListActivationHandler, openThread } =- useEmailView();+ const {+ state,+ source,+ list,+ registerListActivationHandler,+ openThread,+ filterByTag,+ } = useEmailView();const panel = useSplitPanelOrThrow();function openEntity(@@ -577,6 +583,7 @@ export function EmailList(props: EmailListProps) {<div role="gridcell"><ListEntityentity={entityRow().entity}+ onFilterByTag={filterByTag}scheduleStatus={<Showwhen={source.reminderForThread?.(diff --git a/apps/web/src/features/email-view/email-view-context.tsx b/apps/web/src/features/email-view/email-view-context.tsxindex 48d3bedf65..8db65969fc 100644--- a/apps/web/src/features/email-view/email-view-context.tsx+++ b/apps/web/src/features/email-view/email-view-context.tsx@@ -90,6 +90,11 @@ export type EmailViewContext = {* lands on the All tab. Clearing keeps the current tab.*/showTags: (tagIds: string[]) => void;+ /**+ * Filters by a single tag without changing tabs. Used by the inline+ * "filter by tag" button on entity rows.+ */+ filterByTag: (optionId: string) => void;source: EmailDataSource;list: EmailListController;registerListActivationHandler: (@@ -378,6 +383,16 @@ export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<closeThread();};+ // Filters by a single tag without changing tabs. Used by the inline+ // "filter by tag" button on entity rows.+ const filterByTag = (optionId: string) => {+ closeThread();+ setState(+ 'facets',+ reconcile(normalizeFacetSelection({ tags: [optionId] }))+ );+ };+const isSidebarSectionOpen = (id: string) =>!state.collapsedSidebarSectionIds.includes(id);@@ -393,6 +408,7 @@ export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<setInboxIds,setFacets,showTags,+ filterByTag,source,list,registerListActivationHandler,diff --git a/apps/web/src/features/tasks-view/components/task-list/TaskGridLayout.tsx b/apps/web/src/features/tasks-view/components/task-list/TaskGridLayout.tsxindex 92ac4cf697..1645e7b275 100644--- a/apps/web/src/features/tasks-view/components/task-list/TaskGridLayout.tsx+++ b/apps/web/src/features/tasks-view/components/task-list/TaskGridLayout.tsx@@ -60,6 +60,7 @@ function buildStubProperty(col: TaskGridColumn): Property {type TaskGridLayoutProps = Omit<LayoutProps, 'entity'> & {entity: TaskEntityWithProperties;+ onFilterByTag?: (optionId: string) => void;};export function TaskGridLayout(props: TaskGridLayoutProps) {@@ -177,6 +178,7 @@ export function TaskGridLayout(props: TaskGridLayoutProps) {entityId={props.entity.id}entityType={EntityType.TASK}properties={entity().properties}+ onFilterByTag={props.onFilterByTag}class="ml-auto"/></Entity.Slot>diff --git a/apps/web/src/features/tasks-view/components/task-list/TaskList.tsx b/apps/web/src/features/tasks-view/components/task-list/TaskList.tsxindex 7d3c6aab8a..787e059e8e 100644--- a/apps/web/src/features/tasks-view/components/task-list/TaskList.tsx+++ b/apps/web/src/features/tasks-view/components/task-list/TaskList.tsx@@ -103,6 +103,7 @@ export function TaskList(props: TaskListProps) {registerListActivationHandler,openTask,scopeKey,+ filterByTag,} = useTasksView();const forceEmptyState = useDebugSetting(DEBUG_SETTING_KEYS.FORCE_EMPTY_STATES@@ -521,6 +522,7 @@ export function TaskList(props: TaskListProps) {checked={list.selection.isSelected(entityRow().id)}+ onFilterByTag={filterByTag}onMouseMove={() =>list.focus.set(entityRow().id, {reason: 'hover',diff --git a/apps/web/src/features/tasks-view/components/task-list/TaskListEntity.tsx b/apps/web/src/features/tasks-view/components/task-list/TaskListEntity.tsxindex f06535992e..cf4da1e751 100644--- a/apps/web/src/features/tasks-view/components/task-list/TaskListEntity.tsx+++ b/apps/web/src/features/tasks-view/components/task-list/TaskListEntity.tsx@@ -53,6 +53,8 @@ type TaskListEntityProps = Omit<BaseListEntityProps, 'entity'> & {showUnrollNotifications?: boolean;/** Show the Project column (Projects enabled). */showProject?: boolean;+ /** Called when "filter by tag" is clicked on an entity row tag. */+ onFilterByTag?: (optionId: string) => void;};function MaybeEntityRow(props: {@@ -129,6 +131,7 @@ export function TaskListEntity(props: TaskListEntityProps) {chars: chars(),onProjectClick: props.onProjectClick,showProject: props.showProject,+ onFilterByTag: props.onFilterByTag,});const draggable = createEntityDraggable({diff --git a/apps/web/src/features/tasks-view/tasks-view-context.tsx b/apps/web/src/features/tasks-view/tasks-view-context.tsxindex 022bd59f6a..2cf8913f46 100644--- a/apps/web/src/features/tasks-view/tasks-view-context.tsx+++ b/apps/web/src/features/tasks-view/tasks-view-context.tsx@@ -117,6 +117,11 @@ export type TasksViewContext = {closeTask: () => void;setTab: (tab: TasksTab) => void;setFacets: (facets: TasksViewState['facets']) => void;+ /**+ * Filters by a single tag without changing tabs. Used by the inline+ * "filter by tag" button on entity rows.+ */+ filterByTag: (optionId: string) => void;setPrimarySort: (id: TaskSortId) => void;isSidebarSectionOpen: (id: string) => boolean;setSidebarSectionOpen: (id: string, open: boolean) => void;@@ -386,6 +391,16 @@ export const [TasksViewProvider, useTasksView] = createAssertedContextProvider<setState('facets', reconcile(normalizeFacetSelection(facets)));};+ // Filters by a single tag without changing tabs. Used by the inline+ // "filter by tag" button on entity rows.+ const filterByTag = (optionId: string) => {+ closeTask();+ setState(+ 'facets',+ reconcile(normalizeFacetSelection({ tags: [optionId] }))+ );+ };+const isSidebarSectionOpen = (id: string) =>!state.collapsedSidebarSectionIds.includes(id);@@ -408,6 +423,7 @@ export const [TasksViewProvider, useTasksView] = createAssertedContextProvider<closeTask,setTab,setFacets,+ filterByTag,setPrimarySort,isSidebarSectionOpen,setSidebarSectionOpen,