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
Refactor compose layout and remove navigation targeting (#6559)
Jacob Beckerman1a4a90fcf5af
diff --git a/apps/web/src/features/email-compose/context/email-form-inputs.ts b/apps/web/src/features/email-compose/context/email-form-inputs.tsindex bcad84d245..81283f916d 100644--- a/apps/web/src/features/email-compose/context/email-form-inputs.ts+++ b/apps/web/src/features/email-compose/context/email-form-inputs.ts@@ -26,5 +26,4 @@ export interface EmailReplySession {replyType: Accessor<ReplyType | undefined>;clear(): void;};- getMarkDoneNavigationTargetId(): string | undefined;}diff --git a/apps/web/src/features/email-compose/primitives/reply-composer.ts b/apps/web/src/features/email-compose/primitives/reply-composer.tsindex b467114eb0..9ecf4fdd89 100644--- a/apps/web/src/features/email-compose/primitives/reply-composer.ts+++ b/apps/web/src/features/email-compose/primitives/reply-composer.ts@@ -104,7 +104,8 @@ export type ReplyComposerOptions = {onMarkDone?: (opts?: {silent?: boolean;onUndoHandle?: (handle: EmailUndoHandle) => void;- nextEntityId?: string;+ /** False keeps the view on this thread instead of opening the next one. */+ navigate?: boolean;}) => void;setShowReply?: Setter<boolean>;};@@ -593,9 +594,6 @@ export function createReplyComposer(// onMarkDone (archiveThread) toggles: an already-archived thread (e.g.// replying from search or the sent view) would be unarchived.const willMarkDone = markDone || currentThread.inbox_visible;- const nextEntityId = willMarkDone- ? ctx.getMarkDoneNavigationTargetId()- : undefined;setSendPhase('preparing');try {@@ -763,12 +761,14 @@ export function createReplyComposer(}if (willMarkDone) {try {+ // Stay on the sent thread: the explicit Mark done action is what+ // advances to the next email, not sending a reply.props.onMarkDone?.({silent: true,onUndoHandle: (handle) => {markDoneUndoHandle = handle;},- nextEntityId,+ navigate: false,});} catch (error) {props.notices.reportError(error);diff --git a/apps/web/src/features/email-compose/primitives/send-schedule.test.ts b/apps/web/src/features/email-compose/primitives/send-schedule.test.tsindex 10700bd28b..5d2fa6c51b 100644--- a/apps/web/src/features/email-compose/primitives/send-schedule.test.ts+++ b/apps/web/src/features/email-compose/primitives/send-schedule.test.ts@@ -49,7 +49,6 @@ function replyComposer(onDraftRemoved() {},exitToThread: () => false,replyRequest: { replyType: () => undefined, clear() {} },- getMarkDoneNavigationTargetId: () => undefined,},},() => editor,@@ -194,6 +193,11 @@ describe('send and schedule ordering', () => {.mocked(composeContext.notices.feedback.success).mock.calls.find(([text]) => text === 'Email sent');expect(onMarkDone).toHaveBeenCalledOnce();+ // Sending marks the thread done in place; only the explicit Mark done+ // action advances to the next email.+ expect(onMarkDone).toHaveBeenCalledWith(+ expect.objectContaining({ silent: true, navigate: false })+ );sentNotice?.[1]?.actions?.[0].onClick();await vi.advanceTimersByTimeAsync(0);expect(undo).toHaveBeenCalledOnce();diff --git a/apps/web/src/features/email-compose/views/compose-layout.tsx b/apps/web/src/features/email-compose/views/compose-layout.tsxindex 715fe53b46..6d8ccbac0e 100644--- a/apps/web/src/features/email-compose/views/compose-layout.tsx+++ b/apps/web/src/features/email-compose/views/compose-layout.tsx@@ -202,7 +202,7 @@ export function ComposeLayout(props: {><div class="pb-1 w-full h-max shrink-0"><div- class="mb-4 h-6 flex items-center justify-between gap-3"+ class="min-h-12 flex items-center justify-between gap-2 border-b border-edge-muted"classList={{ hidden: ctx.isMobile() && !props.header }}><Show@@ -210,25 +210,27 @@ export function ComposeLayout(props: {fallback={<Suspensefallback={- <div class="flex gap-1 items-center">+ <div class="flex gap-1 items-center py-3"><CircleSpinner class="size-4 animate-spin" />- <span class="text-ink-extra-muted/50 text-xs">+ <span class="text-ink-placeholder text-sm">Processing...</span></div>}><Show when={ctx.fromAddress?.()}>- <div class="text-xs text-ink-extra-muted/50 flex items-center gap-2 min-w-0 flex-1">- <span class="w-14 shrink-0">from</span>- <div class="min-w-0">- <FromInboxSelector- disabled={ctx.disabled()}- links={ctx.fromInboxes?.() ?? []}- activeInboxId={ctx.selectedInboxId?.()}- onSelect={(id) => ctx.onSelectInbox?.(id)}- />- </div>+ <div class="flex items-center gap-2 min-w-0 flex-1 py-3">+ <span class="w-14 shrink-0 text-sm text-ink-placeholder">+ From+ </span>+ <FromInboxSelector+ pill+ class="min-w-0"+ disabled={ctx.disabled()}+ links={ctx.fromInboxes?.() ?? []}+ activeInboxId={ctx.selectedInboxId?.()}+ onSelect={(id) => ctx.onSelectInbox?.(id)}+ /></div></Show></Suspense>diff --git a/apps/web/src/features/email-compose/views/compose-recipients.tsx b/apps/web/src/features/email-compose/views/compose-recipients.tsxindex ecb09d2702..23cb81fa57 100644--- a/apps/web/src/features/email-compose/views/compose-recipients.tsx+++ b/apps/web/src/features/email-compose/views/compose-recipients.tsx@@ -56,8 +56,8 @@ function ComposeFieldRow(props: {return (<divclass={cn(- 'flex gap-2 py-1 border-b border-edge-muted focus-within:border-accent',- ctx.isMobile() ? 'items-start' : 'items-center'+ 'flex gap-2 border-b border-edge-muted focus-within:border-ink/20',+ ctx.isMobile() ? 'items-start py-1' : 'items-center py-3')}classList={{ 'border-accent bg-accent/10': isDragOver() }}onDragOver={handleDragOver}@@ -320,7 +320,7 @@ export function ComposeRecipients(props: {<Showwhen={ctx.isMobile()}fallback={- <div class="flex flex-col gap-2">+ <div class="flex flex-col">{toRow()}<Show when={isCcVisible()}>{ccRow()}</Show><Show when={isBccVisible()}>{bccRow()}</Show>diff --git a/apps/web/src/features/email-compose/views/compose-subject.tsx b/apps/web/src/features/email-compose/views/compose-subject.tsxindex 0c38b03f71..81ab977fa2 100644--- a/apps/web/src/features/email-compose/views/compose-subject.tsx+++ b/apps/web/src/features/email-compose/views/compose-subject.tsx@@ -31,8 +31,8 @@ export function ComposeSubject(props: {return (<divclass={cn(- 'w-full flex gap-2 border-b border-edge-muted focus-within:border-accent py-2',- ctx.isMobile() ? 'items-start' : 'items-center'+ 'w-full flex gap-2 border-b border-edge-muted focus-within:border-ink/20',+ ctx.isMobile() ? 'items-start py-2' : 'items-center py-3')}><div@@ -52,7 +52,7 @@ export function ComposeSubject(props: {type="text"value={ctx.subject()}placeholder="Subject"- class="w-full resize-none text-base placeholder:text-ink-placeholder p-1"+ class="w-full resize-none bg-transparent text-base text-ink placeholder:text-ink-placeholder outline-none"onInput={(e) => ctx.setSubject(e.currentTarget.value)}onKeyDown={blurOnEscape}disabled={ctx.disabled()}diff --git a/apps/web/src/features/email-compose/views/email-compose.tsx b/apps/web/src/features/email-compose/views/email-compose.tsxindex 025f1fb24f..580b5a050b 100644--- a/apps/web/src/features/email-compose/views/email-compose.tsx+++ b/apps/web/src/features/email-compose/views/email-compose.tsx@@ -7,7 +7,7 @@ import {import { EmailPermissionsBanner } from '@core/component/EmailPermissionsBanner';import { WrapUnlessMobile } from '@core/mobile/WrapUnlessMobile';-import { Surface } from '@ui';+import { ComposerSurface } from '@ui';import { createSignal, Show } from 'solid-js';import { SignaturePreview } from '../components/signature-preview';@@ -129,18 +129,26 @@ export function EmailComposeView(props: EmailComposeViewProps) {</SplitHeaderLeft></Show><div class="relative flex flex-col size-full min-h-0 overflow-hidden text-sm">- <div class="macro-message-width sm:macro-message-padding mx-auto w-full min-h-120 max-h-full my-2 sm:my-12 touch:my-0 px-2 sm:px-4 touch:px-0 overflow-hidden touch:overflow-y-auto touch:scrollbar-hidden touch:min-h-full">+ {/* No overflow clipping on desktop: the card clips its own content, and+ clipping here would slice the composer shadow flat at the top and+ bottom while the side padding lets it show. */}+ <div class="macro-message-width sm:macro-message-padding mx-auto w-full min-h-120 max-h-full my-2 sm:my-12 touch:my-0 px-2 sm:px-4 touch:px-0 touch:overflow-y-auto touch:scrollbar-hidden touch:min-h-full"><WrapUnlessMobilewrapper={(children) => (- <Surface depth={2} class="rounded-xl border border-ink-muted/8">+ // The same card as the chat composer and the thread's message+ // cards, so a fresh draft reads as one of the app's composers.+ <ComposerSurface+ as="div"+ class="relative size-full min-h-0 overflow-clip touch:rounded-xl touch:border touch:border-edge-muted"+ >{children}- </Surface>+ </ComposerSurface>)}><ComposeLayouttoolbar={<EmailComposeToolbar editor={editor} />}notice={hasInboxError() ? <EmailPermissionsBanner /> : undefined}- class="size-full p-4 bg-surface max-h-full touch:max-h-none overflow-hidden flex flex-col min-h-0 touch:min-h-full"+ class="size-full p-4 touch:bg-surface max-h-full touch:max-h-none overflow-hidden flex flex-col min-h-0 touch:min-h-full"/></WrapUnlessMobile></div>diff --git a/apps/web/src/features/email-compose/views/reply-envelope.tsx b/apps/web/src/features/email-compose/views/reply-envelope.tsxindex d04b8b5469..af435b3cc4 100644--- a/apps/web/src/features/email-compose/views/reply-envelope.tsx+++ b/apps/web/src/features/email-compose/views/reply-envelope.tsx@@ -169,7 +169,7 @@ export function ReplyEnvelope(props: ReplyEnvelopeProps) {<RecipientDropRowfield="to"- class="w-full gap-2 py-3 border-b border-edge-muted focus-within:border-accent items-center"+ class="w-full gap-2 py-3 border-b border-edge-muted focus-within:border-ink/20 items-center"dragState={recipientDragState}onDrop={handleRecipientDrop}>@@ -182,7 +182,7 @@ export function ReplyEnvelope(props: ReplyEnvelopeProps) {<Show when={showCc() || props.values().cc.length > 0}><RecipientDropRowfield="cc"- class="w-full gap-2 py-3 border-b border-edge-muted focus-within:border-accent items-center"+ class="w-full gap-2 py-3 border-b border-edge-muted focus-within:border-ink/20 items-center"dragState={recipientDragState}onDrop={handleRecipientDrop}>@@ -196,7 +196,7 @@ export function ReplyEnvelope(props: ReplyEnvelopeProps) {<Show when={showBcc() || props.values().bcc.length > 0}><RecipientDropRowfield="bcc"- class="w-full gap-2 py-3 border-b border-edge-muted focus-within:border-accent items-center"+ class="w-full gap-2 py-3 border-b border-edge-muted focus-within:border-ink/20 items-center"dragState={recipientDragState}onDrop={handleRecipientDrop}>@@ -238,7 +238,7 @@ export function ReplyEnvelope(props: ReplyEnvelopeProps) {<RecipientDropRowfield="to"class={cn(- 'w-full gap-2 min-h-16 border-b border-edge-muted/70 focus-within:border-accent',+ 'w-full gap-2 min-h-16 border-b border-edge-muted/70 focus-within:border-ink/20','items-center py-2')}dragState={recipientDragState}@@ -267,7 +267,7 @@ export function ReplyEnvelope(props: ReplyEnvelopeProps) {<RecipientDropRowfield="cc"class={cn(- 'w-full gap-2 min-h-16 border-b border-edge-muted/70 focus-within:border-accent',+ 'w-full gap-2 min-h-16 border-b border-edge-muted/70 focus-within:border-ink/20','items-center py-2')}dragState={recipientDragState}@@ -282,7 +282,7 @@ export function ReplyEnvelope(props: ReplyEnvelopeProps) {<RecipientDropRowfield="bcc"class={cn(- 'w-full gap-2 min-h-16 border-b border-edge-muted/70 focus-within:border-accent',+ 'w-full gap-2 min-h-16 border-b border-edge-muted/70 focus-within:border-ink/20','items-center py-2')}dragState={recipientDragState}diff --git a/apps/web/src/features/email-thread/context/email-thread-context.ts b/apps/web/src/features/email-thread/context/email-thread-context.tsindex 938aeb3b00..2676a3e41f 100644--- a/apps/web/src/features/email-thread/context/email-thread-context.ts+++ b/apps/web/src/features/email-thread/context/email-thread-context.ts@@ -44,7 +44,6 @@ export interface EmailThreadCommands {isThreadMarkedUnread: Accessor<boolean>;markThreadUnread(): boolean;markThreadRead(): boolean;- getMarkDoneNavigationTargetId(): string | undefined;blockSender(): boolean;markSenderSignal(): boolean;markSenderNoise(): boolean;diff --git a/apps/web/src/features/email-thread/primitives/email-thread-state.ts b/apps/web/src/features/email-thread/primitives/email-thread-state.tsindex c3c2b98de1..cb03b35854 100644--- a/apps/web/src/features/email-thread/primitives/email-thread-state.ts+++ b/apps/web/src/features/email-thread/primitives/email-thread-state.ts@@ -94,7 +94,6 @@ export type EmailThreadState = {markThreadUnread: () => boolean;/** Re-marks the thread read after a mark-unread. */markThreadRead: () => boolean;- getMarkDoneNavigationTargetId: () => string | undefined;blockSender: () => boolean;markSenderSignal: () => boolean;markSenderNoise: () => boolean;diff --git a/apps/web/src/features/email-thread/tests/fixtures.ts b/apps/web/src/features/email-thread/tests/fixtures.tsindex 789e82f46f..890de0f4e5 100644--- a/apps/web/src/features/email-thread/tests/fixtures.ts+++ b/apps/web/src/features/email-thread/tests/fixtures.ts@@ -50,7 +50,6 @@ export function createThreadContext(isThreadMarkedUnread: () => false,markThreadUnread: () => false,markThreadRead: () => false,- getMarkDoneNavigationTargetId: () => undefined,blockSender: () => false,markSenderSignal: () => false,markSenderNoise: () => false,diff --git a/apps/web/src/features/email-thread/thread-completion-adapter.tsx b/apps/web/src/features/email-thread/thread-completion-adapter.tsxindex 8a26bf47b3..226ac34038 100644--- a/apps/web/src/features/email-thread/thread-completion-adapter.tsx+++ b/apps/web/src/features/email-thread/thread-completion-adapter.tsx@@ -46,7 +46,6 @@ export function createThreadCompletionAdapter(| 'isThreadDone'| 'canMarkThreadNotDone'| 'markThreadNotDone'- | 'getMarkDoneNavigationTargetId'> {const notificationSource = useGlobalNotificationSource();const soup = useMaybeSoup();@@ -133,22 +132,6 @@ export function createThreadCompletionAdapter(},});- const getMarkDoneNavigationTargetId = () => {- if (!soup) return;-- const focusedId = soup.focus.id();- const navigationOptions = {- wrapNavigation: false,- skipGroupHeaders: true,- skipLoadMore: true,- };- const candidates = [- soup.navigate.peekOffset(1, navigationOptions)?.row,- soup.navigate.peekOffset(-1, navigationOptions)?.row,- ];- return candidates.find((row) => row && row.id !== focusedId)?.id;- };-const isThreadDone = () => {const thread = threadSource();return thread ? !thread.inbox_visible : false;@@ -329,6 +312,5 @@ export function createThreadCompletionAdapter(isThreadDone,canMarkThreadNotDone,markThreadNotDone,- getMarkDoneNavigationTargetId,};}diff --git a/apps/web/src/features/email-thread/views/message-list.tsx b/apps/web/src/features/email-thread/views/message-list.tsxindex 61308c7d70..49b4403d58 100644--- a/apps/web/src/features/email-thread/views/message-list.tsx+++ b/apps/web/src/features/email-thread/views/message-list.tsx@@ -1,6 +1,6 @@import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';import { Key } from '@solid-primitives/keyed';-import { Button, cn, Layer } from '@ui';+import { cn, Layer } from '@ui';import {createEffect,createMemo,@@ -227,11 +227,14 @@ export function MessageList(props: MessageListProps) {aria-hidden="true"class="border-t border-edge-muted"/>- <Button- variant="outline"- size="sm"+ {/* Plain text, no chip: the same color as the+ collapsed previews around it, faded until+ hovered or focused. */}+ <button+ type="button"class={cn(- props.hiddenChipFocused && 'bg-active text-ink'+ 'shrink-0 px-2 py-1 text-sm text-ink-extra-muted/60 outline-none transition-colors not-touch:hover:text-ink-extra-muted focus-visible:text-ink-muted',+ props.hiddenChipFocused && 'text-ink-muted')}data-hidden-messagesonPointerEnter={() =>@@ -252,7 +255,7 @@ export function MessageList(props: MessageListProps) {>Show {hiddenCount()} hidden{' '}{hiddenCount() === 1 ? 'message' : 'messages'}- </Button>+ </button><spanaria-hidden="true"class="border-t border-edge-muted"diff --git a/apps/web/src/features/email-thread/views/thread-reply-input.tsx b/apps/web/src/features/email-thread/views/thread-reply-input.tsxindex 9d6c82fc70..ec0642dcb6 100644--- a/apps/web/src/features/email-thread/views/thread-reply-input.tsx+++ b/apps/web/src/features/email-thread/views/thread-reply-input.tsx@@ -114,8 +114,6 @@ function ThreadReplyInputSession(props: ThreadReplyInputProps) {: undefined,clear: ctx.replyRequest.clear,},- getMarkDoneNavigationTargetId:- ctx.getMarkDoneNavigationTargetId,exitToThread: (target) => {const id =target === 'last'diff --git a/apps/web/src/lib/core/component/RecipientSelector.tsx b/apps/web/src/lib/core/component/RecipientSelector.tsxindex c5f8212418..629915ded1 100644--- a/apps/web/src/lib/core/component/RecipientSelector.tsx+++ b/apps/web/src/lib/core/component/RecipientSelector.tsx@@ -187,8 +187,8 @@ function RecipientComboboxItem(props: RecipientComboboxItemProps): JSX.Element {<Combobox.Itemitem={props}class={cn(- 'flex flex-row h-9 px-2 rounded-lg justify-between items-center data-highlighted:bg-hover/50',- props.disabled && 'hover:bg-hover'+ 'flex flex-row h-9 px-2 rounded-lg justify-between items-center outline-none data-highlighted:bg-ink/5',+ props.disabled && 'hover:bg-ink/5')}onMouseEnter={props.disabled ? handleMouseEnter : undefined}onMouseLeave={props.disabled ? handleMouseLeave : undefined}@@ -214,7 +214,7 @@ function RecipientComboboxItem(props: RecipientComboboxItemProps): JSX.Element {const iconId = props.disabled ? '?' : option.id;return (- <Combobox.ItemLabel class="flex flex-row w-full items-center gap-1.5 text-ink-muted select-none text-sm">+ <Combobox.ItemLabel class="flex flex-row w-full items-center gap-1.5 text-ink select-none text-sm"><UserIcon id={iconId ?? ''} size="sm" isDeleted={false} /><pclass={cn(@@ -234,7 +234,7 @@ function RecipientComboboxItem(props: RecipientComboboxItemProps): JSX.Element {<Match when={matches(props.rawValue, (i) => i.kind === 'channel')}>{(item) => {return (- <Combobox.ItemLabel class="flex flex-row w-full gap-1.5 text-ink-muted select-none text-sm">+ <Combobox.ItemLabel class="flex flex-row w-full gap-1.5 text-ink select-none text-sm"><div class="flex flex-col items-center justify-center p-1"><EntityIcontargetType={item().data.channel_type || 'channel'}@@ -889,7 +889,7 @@ export function RecipientSelector<K extends CombinedRecipientKind>(inputRef()?.focus({ preventScroll: true });}}}- class="z-modal-content border border-edge bg-surface translate-y-1 p-2 rounded-xl shadow-lg shadow-drop-shadow"+ class="z-modal-content translate-y-1 rounded-xl p-1.5 glass bg-menu-glass menu-open-animation text-sm [--color-surface:var(--color-menu)]"><Combobox.Listboxref={setListboxRef}diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.mdindex b76f9101c0..a63c2a336c 100644--- a/docs/AGENT_GUIDE/surfaces.md+++ b/docs/AGENT_GUIDE/surfaces.md@@ -325,6 +325,8 @@ Macro Markdown messages retain document mentions. Ordinary HTML bodies use anopen shadow root: Playwright text locators can reach them, but a card's ordinary`innerText` or `querySelector` does not traverse that root.+Sending a reply from an inbox thread marks that thread done but stays on it;+only the explicit Mark done action opens the next email.After a successful send, the `Email sent` notice offers `Undo`. Undo restores thesent envelope and editable content, including when the reply used another inbox;a slow background refresh must not keep the restored editor disabled. A rejected