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.

chg(entity): add indication that empty message previews have attachments (#539)

Seamus1a80bc36d8ac
diff --git a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
index 04bbbb4c04..f6d0b85a85 100644
--- a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
+++ b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
@@ -327,9 +327,7 @@ export function EntityWithEverything(
props.entity.type === 'channel' ? props.entity : null
);
- const latestMessageContent = createMemo(
- () => channelEntity()?.latestMessage?.content
- );
+ const latestMessage = createMemo(() => channelEntity()?.latestMessage);
const userNameFromSender = createMemo(() => {
const senderId = channelEntity()?.latestMessage?.senderId;
@@ -342,8 +340,7 @@ export function EntityWithEverything(
return (
!props.showUnrollNotifications &&
props.entity.type === 'channel' &&
- !isSearchEntity(props.entity) &&
- !!props.entity.latestMessage?.content
+ !isSearchEntity(props.entity)
);
};
@@ -374,14 +371,26 @@ export function EntityWithEverything(
{userNameFromSender()}
</span>
</div>
- <Show when={latestMessageContent()}>
- {(lastMessageContent) => (
+ <Show when={latestMessage()}>
+ {(lastMessage) => (
<div class="truncate shrink grow opacity-60 flex items-center">
- <StaticMarkdown
- markdown={lastMessageContent().trim()}
- theme={unifiedListMarkdownTheme}
- singleLine={true}
- />
+ {/* TODO (seamus): Channels endpoint does not return any information about attachments. If we have an empty message, assume it's attachments.*/}
+ <Show
+ when={lastMessage().content.trim()}
+ fallback={
+ <span class="italic text-ink-disabled">
+ Attached items
+ </span>
+ }
+ >
+ {(content) => (
+ <StaticMarkdown
+ markdown={content()}
+ theme={unifiedListMarkdownTheme}
+ singleLine={true}
+ />
+ )}
+ </Show>
</div>
)}
</Show>
@@ -672,12 +681,25 @@ export function EntityWithEverything(
)
return '';
+ // TODO (seamus): Notifs endpoint does not return any information
+ // about attachments. If we have an empty message, assume it's attachments.
return (
- <StaticMarkdown
- markdown={metadata.messageContent.trim()}
- theme={unifiedListMarkdownTheme}
- singleLine={true}
- />
+ <Show
+ when={metadata.messageContent.trim()}
+ fallback={
+ <span class="italic text-ink-disabled">
+ Attached items
+ </span>
+ }
+ >
+ {(content) => (
+ <StaticMarkdown
+ markdown={content()}
+ theme={unifiedListMarkdownTheme}
+ singleLine={true}
+ />
+ )}
+ </Show>
);
};