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(soup): group by assignee (#3339)
dev-rbebdb8e1a7f86
diff --git a/js/app/packages/app/component/next-soup/soup-view/group-options.ts b/js/app/packages/app/component/next-soup/soup-view/group-options.tsindex 65cd2b8c5c..6273cd5506 100644--- a/js/app/packages/app/component/next-soup/soup-view/group-options.ts+++ b/js/app/packages/app/component/next-soup/soup-view/group-options.ts@@ -29,6 +29,7 @@ export const TASK_GROUP_OPTIONS: GroupOption[] = [{ value: 'none', label: 'None' },{ value: `property:${SYSTEM_PROPERTY_IDS.STATUS}`, label: 'Status' },{ value: `property:${SYSTEM_PROPERTY_IDS.PRIORITY}`, label: 'Priority' },+ { value: `property:${SYSTEM_PROPERTY_IDS.ASSIGNEES}`, label: 'Assignee' },{ value: 'project', label: 'Project' },{ value: 'date', label: 'Date' },];diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsxindex c14782dd73..02997a10d0 100644--- a/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx@@ -80,6 +80,7 @@ interface SoupViewContextValues {setAssigneeFilter: Setter<string[]>;activeTab: Accessor<string | undefined>;setActiveTab: Setter<string | undefined>;+ groupByField: Accessor<GroupByField | undefined>;}export const SoupViewContext = createContext<SoupViewContextValues>();@@ -560,6 +561,7 @@ export const SoupViewContextProvider: FlowComponent<setAssigneeFilter,activeTab,setActiveTab,+ groupByField,};return (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.tsxindex 374a1625e2..3c5888dd73 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@@ -66,12 +66,16 @@ import { EmailPermissionsBanner } from '@core/component/EmailPermissionsBanner';import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';import { LoadingBlock } from '@core/component/LoadingBlock';import { PropertyValueIcon } from '@core/component/Properties/component/propertyValue/PropertyValueIcon';+import { SYSTEM_PROPERTY_IDS } from '@core/component/Properties/constants';import { Resize } from '@core/component/Resize';+import { UserIcon } from '@core/component/UserIcon';import { ENABLE_UNIFIED_LIST_AI_INPUT } from '@core/constant/featureFlags';import { useUserId } from '@core/context/user';import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';import { TOKENS } from '@core/hotkey/tokens';import { isMobile } from '@core/mobile/isMobile';+import { useDisplayName } from '@core/user/displayName';+import type { MacroId } from '@core/user/macroId';import { useIsKeyPressActive } from '@core/util/useIsKeyPressActive';import {type EntityData,@@ -122,6 +126,21 @@ import { SoupEntitySelectionToolbar } from './soup-entity-selection-toolbar';import { useSoupNavigationHotkeys } from './use-soup-navigation-hotkeys';import { useSoupViewHotkeys } from './use-soup-view-hotkeys';+// Property values for entity-reference properties (e.g. assignees) are stored+// as `{"entity_id": "...", "entity_type": "USER"}` and arrive in group keys as+// the JSON-encoded text of that object.+const parseEntityRefId = (key: string): string | null => {+ try {+ const parsed: unknown = JSON.parse(key);+ if (typeof parsed === 'string') return parsed;+ if (typeof parsed !== 'object' || parsed === null) return null;+ const id = (parsed as Record<string, unknown>).entity_id;+ return typeof id === 'string' ? id : null;+ } catch {+ return null;+ }+};+export const SoupSectionHeader = (props: {children: JSX.Element;onClick?: () => void;@@ -149,6 +168,21 @@ export const SoupSectionHeader = (props: {const DefaultGroupHeader = (props: GroupHeaderProps & { highlighted?: boolean }) => {+ const { groupByField } = useSoupView();+ const field = groupByField();+ const isAssigneeGroup =+ field?.type === 'property' &&+ field.propertyDefinitionId === SYSTEM_PROPERTY_IDS.ASSIGNEES &&+ props.group.key !== '';+ const assigneeId = isAssigneeGroup ? parseEntityRefId(props.group.key) : null;+ const [assigneeName] = useDisplayName(+ assigneeId ? (assigneeId as MacroId) : null+ );+ const label = () =>+ isAssigneeGroup+ ? assigneeName() || assigneeId || props.group.label+ : props.group.label;+return (<SoupSectionHeaderonClick={() => props.group.toggle()}@@ -163,11 +197,23 @@ const DefaultGroupHeader = (/></div></Layer>- <PropertyValueIcon- optionId={props.group.value as string}- class="size-3.5"- />- <span class="truncate">{props.group.label}</span>+ <Show+ when={isAssigneeGroup && assigneeId}+ fallback={+ <PropertyValueIcon+ optionId={props.group.value as string}+ class="size-3.5"+ />+ }+ >+ <UserIcon+ id={assigneeId as string}+ size="sm"+ suppressClick+ showTooltip={false}+ />+ </Show>+ <span class="truncate">{label()}</span><spanclass={cn('shrink-0 tabular-nums text-xs font-medium',