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(md): add inline properties to document mention decorator (#2295)
Seamusd56f9b319b09
diff --git a/js/app/packages/core/component/DocumentPreview.tsx b/js/app/packages/core/component/DocumentPreview.tsxindex 6927426cc0..ab6ae101b7 100644--- a/js/app/packages/core/component/DocumentPreview.tsx+++ b/js/app/packages/core/component/DocumentPreview.tsx@@ -650,7 +650,11 @@ export function PopupPreview(props: {{/* Task properties: status, priority, assignees */}<Show when={props.documentInfo.type === 'task'}>- <TaskPropertiesPreview taskId={props.documentInfo.id} />+ <Suspense+ fallback={<div class="w-full bg-hover/50 h-4 m-2" />}+ >+ <TaskPropertiesPreview taskId={props.documentInfo.id} />+ </Suspense></Show>{/* Visual preview for images */}diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsxindex 7ecfa1a27e..2f4bc571b3 100644--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx@@ -56,6 +56,10 @@ import {useContext,} from 'solid-js';import { HoverCard } from '@core/component/HoverCard';+import { useEntityProperties } from '@core/component/Properties/hooks';+import { SYSTEM_PROPERTY_IDS } from '@core/component/Properties/constants';+import { PropertyValueIcon } from '@core/component/Properties/component/propertyValue/PropertyValueIcon';+import { UserIcon } from '@core/component/UserIcon';import { LexicalWrapperContext } from '../../context/LexicalWrapperContext';import { autoRegister, UPDATE_DOCUMENT_NAME_COMMAND } from '../../plugins';import { openDocument } from '../core/BlockLink';@@ -97,6 +101,67 @@ function Loading(props: { collapsed?: boolean }) {);}+function InlineTaskProperties(props: { taskId: string }) {+ const { properties, isLoading } = useEntityProperties(+ props.taskId,+ 'TASK',+ false+ );++ const statusOptionId = createMemo(() => {+ const p = properties().find(+ (p) => p.propertyDefinitionId === SYSTEM_PROPERTY_IDS.STATUS+ );+ return p?.valueType === 'SELECT_STRING' ? p.value?.[0] : undefined;+ });++ const priorityOptionId = createMemo(() => {+ const p = properties().find(+ (p) => p.propertyDefinitionId === SYSTEM_PROPERTY_IDS.PRIORITY+ );+ return p?.valueType === 'SELECT_STRING' ? p.value?.[0] : undefined;+ });++ const firstAssigneeId = createMemo(() => {+ const p = properties().find(+ (p) => p.propertyDefinitionId === SYSTEM_PROPERTY_IDS.ASSIGNEES+ );+ return p?.valueType === 'ENTITY' ? p.value?.[0]?.entity_id : undefined;+ });++ const hasAny = createMemo(+ () =>+ !isLoading() &&+ !!(statusOptionId() || priorityOptionId() || firstAssigneeId())+ );++ return (+ <Show when={hasAny()}>+ <span class="inline-flex items-center gap-1 mx-1 align-middle relative top-[-0.05em]">+ <Show when={statusOptionId()}>+ {(id) => <PropertyValueIcon optionId={id()} class="size-3" />}+ </Show>+ <Show when={priorityOptionId()}>+ {(id) => <PropertyValueIcon optionId={id()} class="size-3" />}+ </Show>+ <Show when={firstAssigneeId()}>+ {(id) => (+ <span class="inline-flex ml-0.5 size-3.25">+ <UserIcon+ id={id()}+ isDeleted={false}+ size="fill"+ suppressClick+ showTooltip={false}+ />+ </span>+ )}+ </Show>+ </span>+ </Show>+ );+}+function InlinePreview(props: {entity: ItemEntity;blockName: BlockName | BlockAlias;@@ -149,6 +214,11 @@ function InlinePreview(props: {}})()}</span>+ <Show when={props.blockName === 'task'}>+ <Suspense>+ <InlineTaskProperties taskId={accessibleItem().id} />+ </Suspense>+ </Show></span>}collapsed={props.collapsed}