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.

add [properties-fe] - navigate to thread + specific message (#580)

Daniel Kweon51e397689bf9
diff --git a/js/app/packages/core/component/AI/signal/attachment.ts b/js/app/packages/core/component/AI/signal/attachment.ts
index 8360bde0db..9d26390254 100644
--- a/js/app/packages/core/component/AI/signal/attachment.ts
+++ b/js/app/packages/core/component/AI/signal/attachment.ts
@@ -56,7 +56,7 @@ export const useChatAttachableHistory = () => {
export const useGetChatAttachmentInfo = () => {
const history = useChatAttachableHistory();
const { channels } = useChannelsContext();
- const emails = useEmails();
+ const _emails = useEmails();
const getDocumentAttachment = (id: string): Attachment | undefined => {
const item = history().find((item) => item.id === id);
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/core/BlockLink.tsx b/js/app/packages/core/component/LexicalMarkdown/component/core/BlockLink.tsx
index a990ac3367..15b8976ee7 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/core/BlockLink.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/core/BlockLink.tsx
@@ -11,6 +11,8 @@ export const blockNamesWithLocations = [
'canvas',
'channel',
'md',
+ 'email',
+ 'chat',
] as const;
export type BlockNameWithLocations = (typeof blockNamesWithLocations)[number];
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/EntityIcon.tsx b/js/app/packages/core/component/Properties/component/propertyValue/EntityIcon.tsx
index b787b91b69..7afd8036c4 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/EntityIcon.tsx
+++ b/js/app/packages/core/component/Properties/component/propertyValue/EntityIcon.tsx
@@ -10,6 +10,7 @@ type EntityValueDisplayProps = ParentProps<{
property: Property;
entityId: string;
entityType: EntityType;
+ specificMessageId?: string | null;
canEdit?: boolean;
onRemove?: () => void;
isSaving?: boolean;
@@ -18,9 +19,12 @@ type EntityValueDisplayProps = ParentProps<{
export const EntityIcon: Component<EntityValueDisplayProps> = (props) => {
const [isHovered, setIsHovered] = createSignal(false);
- const { name, icon, blockOrFileType } = usePropertyEntityDisplay(
+ const { name, icon, blockOrFileType, linkParams } = usePropertyEntityDisplay(
() => props.entityId,
- () => props.entityType
+ () => props.entityType,
+ {
+ specificMessageId: () => props.specificMessageId,
+ }
);
const content = (
@@ -33,7 +37,11 @@ export const EntityIcon: Component<EntityValueDisplayProps> = (props) => {
const innerContent = (
<Show when={blockOrFileType()} fallback={props.children ?? content}>
{(linkType) => (
- <BlockLink blockOrFileName={linkType()} id={props.entityId}>
+ <BlockLink
+ blockOrFileName={linkType()}
+ id={props.entityId}
+ params={linkParams()}
+ >
{props.children ?? content}
</BlockLink>
)}
diff --git a/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsx b/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsx
index f3dc7b0b6c..2e7cba03d7 100644
--- a/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsx
+++ b/js/app/packages/core/component/Properties/component/propertyValue/EntityValue.tsx
@@ -79,6 +79,7 @@ export const EntityValue: Component<EntityValueProps> = (props) => {
property={props.property}
entityId={entityRef.entity_id}
entityType={entityRef.entity_type}
+ specificMessageId={entityRef.specific_message_id}
canEdit={!isReadOnly()}
onRemove={() => handleRemoveEntity(entityRef)}
isSaving={isSaving()}
diff --git a/js/app/packages/core/component/Properties/hooks/usePropertyEntityDisplay.tsx b/js/app/packages/core/component/Properties/hooks/usePropertyEntityDisplay.tsx
index 635737fbc3..cb85eb9339 100644
--- a/js/app/packages/core/component/Properties/hooks/usePropertyEntityDisplay.tsx
+++ b/js/app/packages/core/component/Properties/hooks/usePropertyEntityDisplay.tsx
@@ -33,6 +33,8 @@ type PropertyEntityDisplayResult = {
isLoading: Accessor<boolean>;
/** Block or file type for linking (null if not linkable) */
blockOrFileType: Accessor<string | null>;
+ /** URL params for navigation (e.g., message ID for threads) */
+ linkParams: Accessor<Record<string, string> | undefined>;
};
/**
@@ -50,6 +52,8 @@ export function usePropertyEntityDisplay(
options?: {
/** Custom fallback icon for unknown entity types (null to show nothing) */
fallbackIcon?: JSX.Element | null;
+ /** Specific message ID for THREAD/CHANNEL/CHAT entities */
+ specificMessageId?: Accessor<string | null | undefined>;
}
): PropertyEntityDisplayResult {
const needsPreview = () =>
@@ -194,6 +198,11 @@ export function usePropertyEntityDisplay(
return 'task';
}
+ // Threads route to email block
+ if (type === 'THREAD') {
+ return 'email';
+ }
+
// For documents, get the file type from preview
if (type === 'DOCUMENT') {
const previewItem = preview();
@@ -214,10 +223,28 @@ export function usePropertyEntityDisplay(
return null;
});
+ const linkParams = createMemo((): Record<string, string> | undefined => {
+ const messageId = options?.specificMessageId?.();
+ if (!messageId) return undefined;
+
+ const type = entityType().toUpperCase();
+ switch (type) {
+ case 'THREAD':
+ return { email_message_id: messageId };
+ case 'CHANNEL':
+ return { channel_message_id: messageId };
+ case 'CHAT':
+ return { message_id: messageId };
+ default:
+ return undefined;
+ }
+ });
+
return {
name,
icon,
isLoading,
blockOrFileType,
+ linkParams,
};
}