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.

fix(entity): add attached items fallback for empty latest message (#1617)

Seamusafb6ecd3b665
diff --git a/js/app/packages/entity/src/composed/ListEntity.tsx b/js/app/packages/entity/src/composed/ListEntity.tsx
index eb23c36d71..0b626bd8f8 100644
--- a/js/app/packages/entity/src/composed/ListEntity.tsx
+++ b/js/app/packages/entity/src/composed/ListEntity.tsx
@@ -161,24 +161,41 @@ function NarrowLayout(props: LayoutProps) {
)}
</Match>
<Match when={isChannelEntity(props.entity) && props.entity}>
- {(entity) => (
- <Show when={entity().latestMessage}>
- {(msg) => (
- <div class="flex items-center gap-2 w-full truncate">
- <span class="font-semibold truncate min-w-min max-w-1/3">
- <DisplayName id={msg().senderId} format="firstName" />
- </span>
- <span class="text-ink/50 font-medium truncate inline-flex items-center shrink">
- <StaticMarkdown
- theme={unifiedListMarkdownTheme}
- markdown={msg().content}
- singleLine
- />
- </span>
- </div>
- )}
- </Show>
- )}
+ {(entity) => {
+ return (
+ <Show when={entity().latestMessage}>
+ {(msg) => {
+ console.log({ message: msg() });
+ const hasContent = () => Boolean(msg().content?.trim());
+
+ return (
+ <div class="flex items-center gap-2 w-full truncate">
+ <span class="font-semibold truncate min-w-min max-w-1/3">
+ <DisplayName
+ id={msg().senderId}
+ format="firstName"
+ />
+ </span>
+ <span class="text-ink/50 font-medium truncate inline-flex items-center shrink">
+ <Show
+ when={hasContent()}
+ fallback={
+ <span class="italic">Attached Items</span>
+ }
+ >
+ <StaticMarkdown
+ theme={unifiedListMarkdownTheme}
+ markdown={msg().content}
+ singleLine
+ />
+ </Show>
+ </span>
+ </div>
+ );
+ }}
+ </Show>
+ );
+ }}
</Match>
</Switch>
</Entity.Slot>
@@ -268,18 +285,28 @@ function WideLayout(props: LayoutProps) {
<Entity.Title entity={entity()} />
</span>
<Show when={!props.hasNotifications && entity().latestMessage}>
- {(msg) => (
- <>
- <DisplayName id={msg().senderId} format="firstName" />
- <span class="text-ink/50 font-medium truncate inline-flex shrink items-center">
- <StaticMarkdown
- theme={unifiedListMarkdownTheme}
- markdown={msg().content}
- singleLine
- />
- </span>
- </>
- )}
+ {(msg) => {
+ const hasContent = () => Boolean(msg().content?.trim());
+ return (
+ <>
+ <DisplayName id={msg().senderId} format="firstName" />
+ <span class="text-ink/50 font-medium truncate inline-flex shrink items-center">
+ <Show
+ when={hasContent()}
+ fallback={
+ <span class="italic">Attached Items</span>
+ }
+ >
+ <StaticMarkdown
+ theme={unifiedListMarkdownTheme}
+ markdown={msg().content}
+ singleLine
+ />
+ </Show>
+ </span>
+ </>
+ );
+ }}
</Show>
</>
)}