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
fix(channels): fix thread styling for StandaloneThreads (#6019)
Seamus25c8094a173d
diff --git a/apps/web/src/features/channel/StandaloneThread/EditableThread.tsx b/apps/web/src/features/channel/StandaloneThread/EditableThread.tsxindex 9939bfd842..2630c973f4 100644--- a/apps/web/src/features/channel/StandaloneThread/EditableThread.tsx+++ b/apps/web/src/features/channel/StandaloneThread/EditableThread.tsx@@ -11,6 +11,7 @@ import { createDeleteMessageConfirmation } from '../Channel/create-delete-messagimport type { InputHandle, InputSnapshot } from '../Input';import { Thread } from '../Thread';import { buildQuoteReplyValue } from '../Thread/utils/message-actions';+import { channelReplyInputOffsetX } from '../Thread/utils/thread-rail-geometry';import { useStandaloneThread } from './context';import { StandaloneThread } from './StandaloneThread';@@ -81,18 +82,21 @@ function EditableThreadInner() {<StandaloneThread.RepliesgetMessageActions={getMessageActions}showReplyButton- />- <Show when={ctx.isReplying()}>- <Thread.ReplyInput- channelId={ctx.channelId()}- messageId={ctx.messageId()}- replyInputState={replyInputState}- setReplyInputState={setReplyInputState}- setIsReplying={ctx.setIsReplying}- setReplyInputHandle={setReplyInputHandle}- focusRequest={ctx.replyInputFocusRequest}- />- </Show>+ >+ <Show when={ctx.isReplying()}>+ <Thread.ReplyInput+ connectorRail="thread"+ offsetX={channelReplyInputOffsetX}+ channelId={ctx.channelId()}+ messageId={ctx.messageId()}+ replyInputState={replyInputState}+ setReplyInputState={setReplyInputState}+ setIsReplying={ctx.setIsReplying}+ setReplyInputHandle={setReplyInputHandle}+ focusRequest={ctx.replyInputFocusRequest}+ />+ </Show>+ </StandaloneThread.Replies></>);}diff --git a/apps/web/src/features/channel/StandaloneThread/ParentMessage.tsx b/apps/web/src/features/channel/StandaloneThread/ParentMessage.tsxindex 0c33ad3591..137471938e 100644--- a/apps/web/src/features/channel/StandaloneThread/ParentMessage.tsx+++ b/apps/web/src/features/channel/StandaloneThread/ParentMessage.tsx@@ -1,5 +1,6 @@import { Show } from 'solid-js';import { Message, type MessageActions } from '../Message';+import { Thread } from '../Thread';import { useStandaloneThread } from './context';type ParentMessageProps = {@@ -14,44 +15,47 @@ export function ParentMessage(props: ParentMessageProps) {return (<Show when={ctx.parent()}>{(parentMsg) => (- <Message.Root- message={parentMsg()}- actions={props.actions}- onClick={- props.onClickMessage- ? (e: MouseEvent) => props.onClickMessage!(parentMsg().id, e)- : undefined- }- class={props.class}- >- <Message.Layout class="pt-(--regular-message-padding-t)">- <Message.Slot placement="icon">- <Message.SenderIcon />- </Message.Slot>- <Message.Slot- placement="header"- class="flex flex-col gap-0.5 min-w-0"- >- <div class="flex items-baseline gap-1.5 min-w-0">- <Message.SenderName />- <Message.AgentBadge />- <Message.Timestamp class="shrink-0" format="dateAndTime" />- <Message.EditedIndicator class="shrink-0" />- </div>- <Message.FromPill />- </Message.Slot>- <Message.Slot placement="content">- <Message.Content />- </Message.Slot>- <Message.Slot placement="footer" class="flex flex-col min-w-0">- <Message.Attachments />- <Message.Reactions />- </Message.Slot>- </Message.Layout>- <Show when={props.actions}>- <Message.ActionMenu />- </Show>- </Message.Root>+ <div class="relative">+ <Thread.RootRail visible={ctx.hasReplies() || ctx.isReplying()} />+ <Message.Root+ message={parentMsg()}+ actions={props.actions}+ onClick={+ props.onClickMessage+ ? (e: MouseEvent) => props.onClickMessage!(parentMsg().id, e)+ : undefined+ }+ class={props.class}+ >+ <Message.Layout class="pt-(--regular-message-padding-t)">+ <Message.Slot placement="icon">+ <Message.SenderIcon />+ </Message.Slot>+ <Message.Slot+ placement="header"+ class="flex flex-col gap-0.5 min-w-0"+ >+ <div class="flex items-baseline gap-1.5 min-w-0">+ <Message.SenderName />+ <Message.AgentBadge />+ <Message.Timestamp class="shrink-0" format="dateAndTime" />+ <Message.EditedIndicator class="shrink-0" />+ </div>+ <Message.FromPill />+ </Message.Slot>+ <Message.Slot placement="content">+ <Message.Content />+ </Message.Slot>+ <Message.Slot placement="footer" class="flex flex-col min-w-0">+ <Message.Attachments />+ <Message.Reactions />+ </Message.Slot>+ </Message.Layout>+ <Show when={props.actions}>+ <Message.ActionMenu />+ </Show>+ </Message.Root>+ </div>)}</Show>);diff --git a/apps/web/src/features/channel/StandaloneThread/Replies.tsx b/apps/web/src/features/channel/StandaloneThread/Replies.tsxindex 0422a377dc..19359ebd3a 100644--- a/apps/web/src/features/channel/StandaloneThread/Replies.tsx+++ b/apps/web/src/features/channel/StandaloneThread/Replies.tsx@@ -1,4 +1,4 @@-import { createMemo, For, Show } from 'solid-js';+import { createMemo, For, type ParentProps, Show } from 'solid-js';import { Message, type MessageActions, type MessageData } from '../Message';import { Thread } from '../Thread';import { buildThreadReplyListMeta } from '../Thread/reply-list-meta';@@ -11,12 +11,12 @@ import {} from '../Thread/utils/thread-reply-indicator-helpers';import { useStandaloneThread } from './context';-type RepliesProps = {+type RepliesProps = ParentProps<{getMessageActions?: (message: MessageData) => MessageActions | undefined;onClickMessage?: (messageId: string, e: MouseEvent) => void;class?: string;showReplyButton?: boolean;-};+}>;export function Replies(props: RepliesProps) {const ctx = useStandaloneThread();@@ -53,13 +53,28 @@ export function Replies(props: RepliesProps) {!ctx.isReplying() &&!shouldShowCollapsedIndicator();+ const hasTrailingRailTarget = () =>+ props.children !== undefined ||+ shouldShowCollapsedIndicator() ||+ shouldShowReplyButton();++ const finalReplyBranchIndex = createMemo(() => {+ const replies = ctx.displayReplies();+ for (let index = replies.length - 1; index >= 0; index -= 1) {+ if (!listMetaByReplyId()[replies[index].id]?.isGroupedWithPrevious) {+ return index;+ }+ }+ return -1;+ });+return (<Show when={ctx.hasReplies() || ctx.isReplying()}><div class="relative w-full">- <Thread.ReplyRailDecorations />+ <Thread.RepliesBridgeRail /><Thread.RepliesContainer><For each={ctx.displayReplies()}>- {(reply) => {+ {(reply, index) => {const replyMessage = () =>({ ...reply, thread_id: ctx.messageId() }) as MessageData;const meta = () => listMetaByReplyId()[reply.id];@@ -67,7 +82,13 @@ export function Replies(props: RepliesProps) {props.getMessageActions?.(replyMessage());return (<div class="relative">- <ThreadReplyRail grouped={meta()?.isGroupedWithPrevious} />+ <ThreadReplyRail+ grouped={meta()?.isGroupedWithPrevious}+ terminal={+ !hasTrailingRailTarget() &&+ index() >= finalReplyBranchIndex()+ }+ /><Message.Rootmessage={replyMessage()}actions={replyActions()}@@ -126,6 +147,7 @@ export function Replies(props: RepliesProps) {);}}</For>+ {props.children}<Showwhen={shouldShowCollapsedIndicator() || shouldShowReplyButton()}>@@ -152,6 +174,9 @@ export function Replies(props: RepliesProps) {</Thread.ActionsFooter></Show></Thread.RepliesContainer>+ <Show when={shouldShowCollapsedIndicator() || shouldShowReplyButton()}>+ <Thread.TerminalRail />+ </Show></div></Show>);diff --git a/apps/web/src/features/channel/StandaloneThread/Root.tsx b/apps/web/src/features/channel/StandaloneThread/Root.tsxindex 42597f6c81..40ae0df99f 100644--- a/apps/web/src/features/channel/StandaloneThread/Root.tsx+++ b/apps/web/src/features/channel/StandaloneThread/Root.tsx@@ -3,9 +3,8 @@ import { useChannelMessagesByIdsQuery } from '@queries/channel/channel-messages'import { useThreadRepliesQuery } from '@queries/channel/thread-replies';import type { ApiChannelMessage } from '@service-storage/generated/schemas/apiChannelMessage';import type { ApiThreadReply } from '@service-storage/generated/schemas/apiThreadReply';-import { createSignal, type ParentProps, Show } from 'solid-js';+import { createSignal, type ParentProps } from 'solid-js';import { createFocusRequest } from '../Thread/focus-request';-import { ThreadRail } from '../Thread/ThreadRail';import { DEFAULT_VISIBLE_REPLY_COUNT } from '../Thread/utils/thread-reply-indicator-helpers';import { StandaloneThreadContext } from './context';@@ -69,12 +68,7 @@ function RootInner(props: RootProps) {replyInputFocusRequest,}}>- <div class="relative">- <Show when={hasReplies() || isReplying()}>- <ThreadRail />- </Show>- {props.children}- </div>+ <div class="relative isolate z-0">{props.children}</div></StandaloneThreadContext.Provider>);}diff --git a/apps/web/src/features/channel/Thread/ChannelThread.tsx b/apps/web/src/features/channel/Thread/ChannelThread.tsxindex 367fee99cf..d2d09746b3 100644--- a/apps/web/src/features/channel/Thread/ChannelThread.tsx+++ b/apps/web/src/features/channel/Thread/ChannelThread.tsx@@ -329,24 +329,14 @@ export function ChannelThread(props: ThreadProps) {when={hasReplies() || (props.isReplying() && !isUnifiedInputMode())}><div class="relative w-full">- {/* Spine bridge: spans the replies container's top padding,- connecting the root segment to the reply rows' own spine- segments below. */}- <div class="pointer-events-none absolute top-0 -z-1 channel-rail-left border-thread-rail left-(--left-of-channel-rail) h-(--thread-padding-y)" />+ <Thread.RepliesBridgeRail />{/* Terminal branch: the spine's final curve into the footerbutton's left edge. Its vertical part starts exactly at thelast reply row's bottom (button h-8 + mb-2 + container pb). */}<Showwhen={shouldShowCollapsedIndicator() || shouldShowReplyButton()}>- <div- class="pointer-events-none absolute -z-1 channel-rail-left channel-rail-bottom border-thread-rail rounded-bl-[14px] left-(--left-of-channel-rail) h-8"- style={{- bottom: 'calc(var(--thread-padding-y) + 1.5rem)',- width:- 'calc(var(--thread-shift) - var(--user-icon-width) / 2 - var(--channel-rail-clearance))',- }}- />+ <Thread.TerminalRail /></Show><DebugSuspense name="ChannelThread.replies"><Thread.RepliesContainer>diff --git a/apps/web/src/features/channel/Thread/Thread.ts b/apps/web/src/features/channel/Thread/Thread.tsindex 61ef153741..460277b049 100644--- a/apps/web/src/features/channel/Thread/Thread.ts+++ b/apps/web/src/features/channel/Thread/Thread.ts@@ -1,5 +1,6 @@import { ThreadActionsFooter } from './ThreadActionsFooter';import { ThreadCollapsedIndicator } from './ThreadCollapsedIndicator';+import { ThreadRepliesBridgeRail } from './ThreadRepliesBridgeRail';import { ThreadRepliesContainer } from './ThreadRepliesContainer';import { ThreadReplyAuthor } from './ThreadReplyAuthor';import { ThreadReplyButton } from './ThreadReplyButton';@@ -19,6 +20,7 @@ export const Thread = {ReplyButton: ThreadReplyButton,ReplyList: ThreadReplyList,ReplyRail: ThreadReplyRail,+ RepliesBridgeRail: ThreadRepliesBridgeRail,RootRail: ThreadRootRail,TerminalRail: ThreadTerminalRail,CollapsedIndicator: ThreadCollapsedIndicator,diff --git a/apps/web/src/features/channel/Thread/ThreadRepliesBridgeRail.tsx b/apps/web/src/features/channel/Thread/ThreadRepliesBridgeRail.tsxnew file mode 100644index 0000000000..85c49a9199--- /dev/null+++ b/apps/web/src/features/channel/Thread/ThreadRepliesBridgeRail.tsx@@ -0,0 +1,6 @@+/** Connects the root-message rail to the first reply across the reply padding. */+export function ThreadRepliesBridgeRail() {+ return (+ <div class="pointer-events-none absolute top-0 -z-1 channel-rail-left border-thread-rail left-(--left-of-channel-rail) h-(--thread-padding-y)" />+ );+}diff --git a/apps/web/src/features/channel/Thread/ThreadReplyInput.tsx b/apps/web/src/features/channel/Thread/ThreadReplyInput.tsxindex a0f62d6446..4fdea5c176 100644--- a/apps/web/src/features/channel/Thread/ThreadReplyInput.tsx+++ b/apps/web/src/features/channel/Thread/ThreadReplyInput.tsx@@ -27,6 +27,8 @@ type ThreadReplyInputProps = {* (standalone threads, discussions); channels have no inner rail.*/connector?: boolean;+ /** Rail column from which the optional connector should originate. */+ connectorRail?: 'inner' | 'thread';/** Optional layout-specific horizontal anchor for the composer. */offsetX?: string;};@@ -61,7 +63,7 @@ export function ThreadReplyInput(props: ThreadReplyInputProps) {data-reply-input><Show when={props.connector !== false}>- <ThreadReplyInputConnector />+ <ThreadReplyInputConnector rail={props.connectorRail} /></Show>{(() => {const droppable = entityDropZone.droppable;diff --git a/apps/web/src/features/channel/Thread/ThreadReplyRail.tsx b/apps/web/src/features/channel/Thread/ThreadReplyRail.tsxindex 1c87728009..42d2f8462d 100644--- a/apps/web/src/features/channel/Thread/ThreadReplyRail.tsx+++ b/apps/web/src/features/channel/Thread/ThreadReplyRail.tsx@@ -4,6 +4,8 @@ import { Show } from 'solid-js';type ThreadReplyRailProps = {/** Grouped replies continue the spine without another avatar branch. */grouped?: boolean;+ /** Stop at this row's avatar branch instead of continuing through the row. */+ terminal?: boolean;};/**@@ -19,7 +21,9 @@ export function ThreadReplyRail(props: ThreadReplyRailProps) {return (<>- <div class={cn(railClass, 'inset-y-0')} style={{ left: railLeft }} />+ <Show when={!props.terminal}>+ <div class={cn(railClass, 'inset-y-0')} style={{ left: railLeft }} />+ </Show><Show when={!props.grouped}><divclass={cn(railClass, 'top-0 channel-rail-bottom rounded-bl-[14px]')}diff --git a/apps/web/src/features/channel/Thread/tests/thread-reply-rail.test.tsx b/apps/web/src/features/channel/Thread/tests/thread-reply-rail.test.tsxnew file mode 100644index 0000000000..24e5d05b84--- /dev/null+++ b/apps/web/src/features/channel/Thread/tests/thread-reply-rail.test.tsx@@ -0,0 +1,27 @@+import { cleanup, render } from '@solidjs/testing-library';+import { afterEach, describe, expect, it } from 'vitest';+import { ThreadReplyRail } from '../ThreadReplyRail';++afterEach(cleanup);++describe('ThreadReplyRail', () => {+ it('renders a continuing spine and avatar branch by default', () => {+ const { container } = render(() => <ThreadReplyRail />);++ expect(container.querySelectorAll('.channel-rail-left')).toHaveLength(2);+ expect(container.querySelector('.channel-rail-bottom')).not.toBeNull();+ });++ it('stops at the avatar branch when terminal', () => {+ const { container } = render(() => <ThreadReplyRail terminal />);++ expect(container.querySelectorAll('.channel-rail-left')).toHaveLength(1);+ expect(container.querySelector('.channel-rail-bottom')).not.toBeNull();+ });++ it('renders no rail after a terminal grouped reply branch', () => {+ const { container } = render(() => <ThreadReplyRail grouped terminal />);++ expect(container.querySelector('.channel-rail-left')).toBeNull();+ });+});