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[channels]: message spacing (#1566)

Peter Chinman34785d9f4d73
diff --git a/js/app/packages/block-channel/component/Message/MessageAttachments.tsx b/js/app/packages/block-channel/component/Message/MessageAttachments.tsx
index 357f126aff..0977600275 100644
--- a/js/app/packages/block-channel/component/Message/MessageAttachments.tsx
+++ b/js/app/packages/block-channel/component/Message/MessageAttachments.tsx
@@ -22,12 +22,13 @@ export function MessageAttachments(props: MessageAttachmentsProps) {
<div
class={cn(
'allow-css-brackets mb-2',
- !(
+ (!(
props.documentAttachments()?.length > 0 ||
props.imageAttachments()?.length > 0 ||
props.videoAttachments()?.length > 0
) ||
- (props.isDeleted() && 'hidden')
+ props.isDeleted()) &&
+ 'hidden'
)}
>
{/* Video attachments */}
diff --git a/js/app/packages/block-channel/component/Message/MessageContainer.tsx b/js/app/packages/block-channel/component/Message/MessageContainer.tsx
index 1b27c56f62..4238b6baac 100644
--- a/js/app/packages/block-channel/component/Message/MessageContainer.tsx
+++ b/js/app/packages/block-channel/component/Message/MessageContainer.tsx
@@ -185,15 +185,21 @@ export function MessageContainer(props: MessageProps) {
return !isSameDay(new Date(message.created_at), new Date(prev.created_at));
};
- // We consider a message consecutive if it's from the same user and the same day and has the same thread id.
+ // We consider a message consecutive if it's from the same user, within 10 minutes, and has the same thread id.
const isConsecutive = () => {
const prevMessage_ = previousMessage();
if (!prevMessage_) return false;
const prevSenderId = prevMessage_?.sender_id;
+ const withinTimeWindow =
+ Math.abs(
+ new Date(message.created_at).getTime() -
+ new Date(prevMessage_.created_at).getTime()
+ ) <
+ 10 * 60 * 1000;
return (
(prevMessage_.thread_id ?? '') === (message.thread_id ?? '') &&
prevSenderId === message.sender_id &&
- isSameDay(new Date(prevMessage_.created_at), new Date(message.created_at))
+ withinTimeWindow
);
};
@@ -495,6 +501,11 @@ export function MessageContainer(props: MessageProps) {
}}
data-message-id={message.id}
>
+ {/* New message indicator */}
+ <Show when={props.listContext.isFirstNewMessage}>
+ <NewMessageIndicator onClick={props.onDismissNewMessages} />
+ </Show>
+
{/* Date separator */}
<Show
when={
@@ -505,14 +516,13 @@ export function MessageContainer(props: MessageProps) {
newDayPreviousNonThreadMessage()))
}
>
- <MessageFlag text={formatRelativeDate(message.created_at)} />
- </Show>
- {/* New message indicator */}
- <Show when={props.listContext.isFirstNewMessage}>
- <NewMessageIndicator onClick={props.onDismissNewMessages} />
+ <MessageFlag
+ text={formatRelativeDate(message.created_at)}
+ highlight={isNewMessage()}
+ />
</Show>
- {/* Message item */}
+ {/* Message item */}
<ContextMenu
onOpenChange={(isOpen) => {
setContextMenuOpen(isOpen);
diff --git a/js/app/packages/core/component/Message.tsx b/js/app/packages/core/component/Message.tsx
index 3d14f654e2..b6e02cbfb0 100644
--- a/js/app/packages/core/component/Message.tsx
+++ b/js/app/packages/core/component/Message.tsx
@@ -255,19 +255,18 @@ const Root: Component<MessageRootProps> = (props) => {
data-message-body-id={props.id}
>
<div
- class="relative flex flex-col pl-[calc(var(--user-icon-width)/2+var(--body-padding))] ml-[var(--left-of-connector)]"
- classList={{
- 'border-l': !props.hideConnectors,
- 'border-accent': props.isNewMessage,
- 'border-edge-muted': !props.isNewMessage,
- 'pt-1.5': !(
+ class={cn(
+ 'relative flex flex-col pl-[calc(var(--user-icon-width)/2+var(--body-padding))] ml-[var(--left-of-connector)]',
+ !props.hideConnectors && 'border-l',
+ props.isNewMessage ? 'border-accent' : 'border-edge-muted',
+ !(
props.isConsecutive ||
props.isFirstMessage ||
props.isFirstInThread
- ),
- 'pb-2': !props.isLastMessage,
- 'pb-4': props.hasThreadChildren ?? false,
- }}
+ ) && 'pt-4',
+ props.isLastMessage && 'pb-4',
+ props.hasThreadChildren && 'pb-4'
+ )}
>
{/* User Icon */}
<div class="absolute left-0 -translate-x-1/2">
@@ -392,7 +391,7 @@ const Root: Component<MessageRootProps> = (props) => {
<Button
onClick={props.onThreadAppend}
tabIndex={0}
- class="text-ink-muted flex flex-row justify-center items-center relative px-0 py-0 mb-3 hover:bg-transparent active:border-transparent active:bg-transparent active:text-inherit hover:opacity-100"
+ class="text-ink-muted flex flex-row justify-center items-center relative px-0 py-0 hover:bg-transparent active:border-transparent active:bg-transparent active:text-inherit hover:opacity-100"
>
<div class="border border-edge-muted bg-menu hover:bg-hover hover-transition-bg flex flex-row justify-center items-center ml-2 mr-2 mb-2 size-[var(--user-icon-width)] touch:min-h-[var(--user-icon-width)] touch:min-w-[var(--user-icon-width)]">
<IconPlus class="size-1/2" />