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
feat(email): show only Back in the thread header and pin the subject (#8869)
Peter Chinman0702efc5751c
diff --git a/apps/web/src/features/block-email/EmailThreadHostView.tsx b/apps/web/src/features/block-email/EmailThreadHostView.tsxindex 2441434b27..553a988dbd 100644--- a/apps/web/src/features/block-email/EmailThreadHostView.tsx+++ b/apps/web/src/features/block-email/EmailThreadHostView.tsx@@ -26,6 +26,8 @@ export type EmailThreadHostViewContext = {export type EmailThreadHostViewProps = {title: string;+ /** Host control after the subject's last word, in place of Copy subject. */+ titleTrailing?: JSX.Element;threadId: Accessor<string>;source: EmailThreadSource;threadTransport: EmailThreadProps['threadTransport'];@@ -60,6 +62,7 @@ export function EmailThreadHostView(props: EmailThreadHostViewProps) {return (<EmailThreadtitle={props.title}+ titleTrailing={props.titleTrailing}threadId={props.threadId}source={props.source}threadTransport={props.threadTransport}diff --git a/apps/web/src/features/email-message/components/email-user-tooltip.tsx b/apps/web/src/features/email-message/components/email-user-tooltip.tsxindex 04d3d278d4..23b2470358 100644--- a/apps/web/src/features/email-message/components/email-user-tooltip.tsx+++ b/apps/web/src/features/email-message/components/email-user-tooltip.tsx@@ -14,6 +14,8 @@ interface EmailUserTooltipProps {bold?: boolean;/** Fallback photo (e.g. a synced contact photo) when there's no Macro profile picture. */photoUrl?: string;+ /** Class for the trigger wrapping `children`. */+ triggerClass?: string;}export function EmailUserTooltip(props: EmailUserTooltipProps) {@@ -25,6 +27,7 @@ export function EmailUserTooltip(props: EmailUserTooltipProps) {open={open()}onOpenChange={setOpen}triggerAs="span"+ triggerClass={props.triggerClass}trigger={props.children}content={<UserTooltipdiff --git a/apps/web/src/features/email-thread/components/email-thread-title.tsx b/apps/web/src/features/email-thread/components/email-thread-title.tsxindex 952e17c208..3bba2cc832 100644--- a/apps/web/src/features/email-thread/components/email-thread-title.tsx+++ b/apps/web/src/features/email-thread/components/email-thread-title.tsx@@ -1,5 +1,5 @@import { cn } from '@ui/utils/classname';-import { createSignal } from 'solid-js';+import { createSignal, type JSX, Show } from 'solid-js';import { CopySubjectButton } from './copy-subject-button';function lastWordCluster(title: string): { lead: string; last: string } {@@ -12,6 +12,8 @@ export function EmailThreadTitle(props: {title: string;onCopy?: (subject: string) => void | boolean | Promise<void | boolean>;copyReveal?: 'hover' | 'always';+ /** Replaces the Copy subject button after the last word. */+ trailing?: JSX.Element;class?: string;}) {const [titleHovered, setTitleHovered] = createSignal(false);@@ -30,14 +32,21 @@ export function EmailThreadTitle(props: {{cluster().lead}<span class={cluster().lead ? 'whitespace-nowrap' : undefined}>{cluster().last}- <CopySubjectButton- subject={props.title}- onCopy={props.onCopy}- class={cn(- 'ml-1.5 select-none text-inherit transition-opacity duration-150 ease',- copyHidden() ? 'opacity-0' : 'opacity-100'- )}- />+ <Show+ when={props.trailing}+ fallback={+ <CopySubjectButton+ subject={props.title}+ onCopy={props.onCopy}+ class={cn(+ 'ml-1.5 select-none text-inherit transition-opacity duration-150 ease',+ copyHidden() ? 'opacity-0' : 'opacity-100'+ )}+ />+ }+ >+ {props.trailing}+ </Show></span></h1>);diff --git a/apps/web/src/features/email-thread/views/email-participants.tsx b/apps/web/src/features/email-thread/views/email-participants.tsxindex b3e62a0c7c..54b5826c8b 100644--- a/apps/web/src/features/email-thread/views/email-participants.tsx+++ b/apps/web/src/features/email-thread/views/email-participants.tsx@@ -92,6 +92,9 @@ export function EmailParticipants() {<EmailUserTooltiprecipient={{ email: participant().email, name: participant().name }}photoUrl={participant().photoUrl}+ // A flex trigger keeps the pill off the text baseline, which an+ // initials avatar would otherwise lower.+ triggerClass="flex"><Badgerole="listitem"diff --git a/apps/web/src/features/email-thread/views/email-thread.tsx b/apps/web/src/features/email-thread/views/email-thread.tsxindex f1b2e955f0..727a0e90b5 100644--- a/apps/web/src/features/email-thread/views/email-thread.tsx+++ b/apps/web/src/features/email-thread/views/email-thread.tsx@@ -5,16 +5,20 @@ import { CustomScrollbar } from '@core/component/CustomScrollbar';import { createScrollTopFade } from '@core/util/createScrollTopFade';import type { JSX } from 'solid-js';import { type Accessor, Match, Show, Switch } from 'solid-js';+import { EmailThreadTitle } from '../components/email-thread-title';import type { EmailThreadHost } from '../context/email-thread-context';import { useEmailThreadState } from '../context/email-thread-state-context';import { useEmailThreadViewContext } from '../context/email-thread-view-context';import { createThreadNavigation } from '../primitives/thread-navigation';import { createThreadReplyArea } from '../primitives/thread-reply-area';import { BottomReplyButtons } from './bottom-reply-buttons';+import { EmailParticipants } from './email-participants';import { MessageList } from './message-list';import { MobileEmailCompose } from './mobile-email-compose';export type EmailThreadViewProps = {title: string;+ /** Host control after the subject's last word, in place of Copy subject. */+ titleTrailing?: JSX.Element;threadId: Accessor<string>;host?: EmailThreadHost;header?: JSX.Element;@@ -132,6 +136,30 @@ export function EmailThreadView(props: EmailThreadViewProps) {class="@container w-full flex-1 flex flex-col items-center overflow-hidden"ref={context.registerMessagesContainer}>+ {/* Desktop keeps the subject, tags and participants still+ while the messages scroll up under them. */}+ <Show when={!isTouchDevice() && props.title}>+ {(title) => (+ <div class="shrink-0 w-full flex justify-center">+ <div class="macro-message-width macro-message-padding w-full pt-2 pb-3.5">+ <EmailThreadTitle+ onCopy={viewContext.copySubject}+ title={title()}+ copyReveal="hover"+ trailing={props.titleTrailing}+ class="text-2xl"+ />+ <div class="h-2" aria-hidden="true" />+ {/* Bounded so a long expanded list scrolls instead of+ crowding out the messages; the padding keeps focus+ rings unclipped. */}+ <div class="-m-1 max-h-34 overflow-y-auto p-1">+ <EmailParticipants />+ </div>+ </div>+ </div>+ )}+ </Show><MessageListinitialLoadComplete={context.initialLoadComplete()}markdownDomRef={(el) => {diff --git a/apps/web/src/features/email-thread/views/message-list.tsx b/apps/web/src/features/email-thread/views/message-list.tsxindex 3d707a36a4..6498b53cb4 100644--- a/apps/web/src/features/email-thread/views/message-list.tsx+++ b/apps/web/src/features/email-thread/views/message-list.tsx@@ -21,7 +21,6 @@ import {threadMessageIsExpanded,truncatedMiddleCount,} from '../primitives/scroll-to-message';-import { EmailParticipants } from './email-participants';import { MessageContainer } from './message-container';interface MessageListProps {@@ -94,7 +93,7 @@ export function MessageList(props: MessageListProps) {return (<divclass={cn(- 'pt-1 pb-6 w-full flex flex-col items-center gap-2 overflow-y-scroll overflow-x-hidden [overflow-anchor:none] scrollbar-hidden text-sm scroll-pt-4 scroll-pb-4 scroll-smooth motion-reduce:scroll-auto',+ 'pt-4 pb-6 w-full flex flex-col items-center gap-2 overflow-y-scroll overflow-x-hidden [overflow-anchor:none] scrollbar-hidden text-sm scroll-pt-4 scroll-pb-4 scroll-smooth motion-reduce:scroll-auto','touch:pt-[calc(var(--mobile-content-inset-top,0)+0.5rem)] mobile:gap-0',// The in-scroll insets only clear the floating chrome at the ends of// the list. Every alignment in between — focusing a card, revealing one@@ -126,28 +125,21 @@ export function MessageList(props: MessageListProps) {}}}>- <Show when={props.title}>- <div class="shrink-0 w-full flex justify-center">- <div- class={cn(- 'macro-message-width macro-message-padding w-full',- viewContext.thread.isTouch() ? 'pt-6 pb-3' : 'pt-12 pb-2.5'- )}- >- <EmailThreadTitle- onCopy={viewContext.copySubject}- title={props.title ?? ''}- copyReveal={viewContext.thread.isTouch() ? 'always' : 'hover'}- class={- viewContext.thread.isTouch() ? 'text-xl pt-1 pb-0' : 'text-2xl'- }- />- <Show when={!viewContext.thread.isTouch()}>- <div class="h-4.5" aria-hidden="true" />- <EmailParticipants />- </Show>+ {/* Desktop pins the subject and participants above this list; touch+ scrolls the subject with the messages. */}+ <Show when={viewContext.thread.isTouch() && props.title}>+ {(title) => (+ <div class="shrink-0 w-full flex justify-center">+ <div class="macro-message-width macro-message-padding w-full pt-6 pb-3">+ <EmailThreadTitle+ onCopy={viewContext.copySubject}+ title={title()}+ copyReveal="always"+ class="text-xl pt-1 pb-0"+ />+ </div></div>- </div>+ )}</Show><Layer depth={1}><StaticMarkdownContext>diff --git a/apps/web/src/features/email-view/components/EmailDetailView.tsx b/apps/web/src/features/email-view/components/EmailDetailView.tsxindex c5b9292c96..479701b1c3 100644--- a/apps/web/src/features/email-view/components/EmailDetailView.tsx+++ b/apps/web/src/features/email-view/components/EmailDetailView.tsx@@ -1,6 +1,5 @@-import { EntityDetailBreadcrumbSkeleton } from '@app/components/entity-detail/EntityDetailBreadcrumbSkeleton';import { useListNavigationHotkeys } from '@app/components/entity-detail/use-list-navigation-hotkeys';-import { ViewBreadcrumbs, ViewShell } from '@app/components/view-shell';+import { ViewShell } from '@app/components/view-shell';import { displaySubject } from '@app/features/email-compose/core/subject-text';import type { EmailThreadHost } from '@app/features/email-thread/context/email-thread-context';import { createEmailThreadSource } from '@app/features/email-thread/queries/thread-source';@@ -27,7 +26,6 @@ import {useSplitPanelOrThrow,} from '@components/app/split-layout/layoutUtils';import { createSplitAutofocus } from '@components/app/split-layout/utils/createSplitAutofocus';-import { EntityIcon } from '@core/component/EntityIcon';import { toEntityLoadError } from '@core/component/EntityLoadGate';import { getPermissions } from '@core/component/SharePermissions';import { ShareTrigger } from '@core/component/TopBar/ShareButton';@@ -38,9 +36,17 @@ import { registerScopeSignalHotkey } from '@core/hotkey/utils';import { isTouchDevice } from '@core/mobile/isTouchDevice';import { fireAndForget } from '@core/util/fireAndForget';import { buildEntityData } from '@entity';+import ArrowLeftIcon from '@phosphor/arrow-left.svg';import { useThreadQuery } from '@queries/email/thread';import { representativeThreadMessage } from '@queries/email/thread-subject';-import { createEffect, createMemo, createSignal, Show } from 'solid-js';+import { Button } from '@ui';+import {+ createEffect,+ createMemo,+ createSignal,+ onCleanup,+ Show,+} from 'solid-js';import { Portal } from 'solid-js/web';import { emailDetailSearch } from '../email-route';import { useEmailView } from '../email-view-context';@@ -48,10 +54,22 @@ import { useEmailReaderPane } from '../reader-pane';import type { EmailThreadTarget } from '../types';import { useEmailDetailListNavigation } from '../use-email-detail-list-navigation';+/**+ * Where the title menu sits after the subject's last word. It unsets itself on+ * unmount so a standalone draft, which has no subject line, gets the menu in+ * the header instead.+ */+function TitleMenuMount(props: {+ ref: (element: HTMLElement | undefined) => void;+}) {+ onCleanup(() => props.ref(undefined));+ return <span ref={props.ref} class="ml-1.5 inline-flex align-middle" />;+}++/** The thread's title menu and header controls, which need the loaded thread. */function EmailDetailHeader(props: EmailThreadToolsOptions & {- value: string;- focusThread: () => void;+ titleMenuMount: HTMLElement | undefined;controlsMount: HTMLDivElement | undefined;onEmailReminderSaved: () => void | Promise<void>;}@@ -60,41 +78,23 @@ function EmailDetailHeader(useEmailThreadTools(props);return (<>- <ViewBreadcrumbs.Item- value={props.value}- metadata={{ type: 'email', id: props.id }}- order={1}- >- {(item) => (- <div class="flex min-w-0 items-center gap-0.5">- <ViewBreadcrumbs.Button- class="gap-1.5"- isActive={item.isActive()}- onClick={() => {- item.onSelect();- props.focusThread();- }}- tooltip={props.title}- >- <EntityIcon targetType="email" size="xs" class="shrink-0" />- <span class="truncate">{props.title}</span>- </ViewBreadcrumbs.Button>- <div class="shrink-0">- <SplitFileMenu- id={props.id}- itemType="email"- entityKind="email"- name={props.title}- entity={emailEntity()}- permissions={permissions()}- ops={[]}- tools={menuTools}- onEmailReminderSaved={props.onEmailReminderSaved}- />- </div>- </div>+ <Show when={props.titleMenuMount} keyed>+ {(mount) => (+ <Portal mount={mount} ref={(div) => (div.style.display = 'contents')}>+ <SplitFileMenu+ id={props.id}+ itemType="email"+ entityKind="email"+ name={props.title}+ entity={emailEntity()}+ permissions={permissions()}+ ops={[]}+ tools={menuTools}+ onEmailReminderSaved={props.onEmailReminderSaved}+ />+ </Portal>)}- </ViewBreadcrumbs.Item>+ </Show><Show when={props.controlsMount}>{(mount) => (<Portal mount={mount()}>@@ -123,6 +123,8 @@ export function EmailDetailView(props: {const notificationSource = useGlobalNotificationSource();const canAutofocus = useCanAutofocusSplitContent();const [controlsMount, setControlsMount] = createSignal<HTMLDivElement>();+ const [subjectMenuMount, setSubjectMenuMount] = createSignal<HTMLElement>();+ const [headerMenuMount, setHeaderMenuMount] = createSignal<HTMLElement>();const threadId = () => props.thread.id;const threadQuery = useThreadQuery(threadId, () => ({enabled: !!threadId(),@@ -212,8 +214,8 @@ export function EmailDetailView(props: {hotkey: 'escape',description: 'Collapse message or back to list',// Escape unwinds thread state first (reply, expanded body, focused- // message). Once nothing is left to unwind it follows the breadcrumb- // back to the list this thread was opened from.+ // message). Once nothing is left to unwind it goes back to the list+ // this thread was opened from.keyDownHandler: () => {if (handlers.cancel()) return true;(pane?.focusList ?? closeThread)();@@ -224,7 +226,6 @@ export function EmailDetailView(props: {});},};- const breadcrumbValue = () => `email-thread:${props.thread.id}`;useListNavigationHotkeys({scopeId: keyScope,enabled: () =>@@ -243,11 +244,14 @@ export function EmailDetailView(props: {<SidePanel.Root floating defaultOpen={false}><div class="flex size-full min-h-0 min-w-0 flex-col overflow-hidden"><ViewShell.TopBar class="touch:flex">- <ViewBreadcrumbs.Outlet- class="flex-1"- aria-label="Email location"- fallback={<EntityDetailBreadcrumbSkeleton />}- />+ {/* The subject sits atop the thread, so the header only goes+ back; the reading pane already shows the list beside it. */}+ <Show when={!pane}>+ <Button size="icon-md" label="Back" onClick={closeThread}>+ <ArrowLeftIcon />+ </Button>+ </Show>+ <div ref={setHeaderMenuMount} class="flex items-center" /><EmailThreadHeaderActionscontrols={<div ref={setControlsMount} class="flex items-center" />}share={@@ -277,6 +281,7 @@ export function EmailDetailView(props: {><EmailThreadHostViewtitle={title()}+ titleTrailing={<TitleMenuMount ref={setSubjectMenuMount} />}threadId={threadId}source={source}threadTransport={() => threadQuery.transport}@@ -292,8 +297,7 @@ export function EmailDetailView(props: {onMarkedUnread={closeThread}onDeleted={closeThread}listNavigation={listNavigation}- value={breadcrumbValue()}- focusThread={focusContainer}+ titleMenuMount={subjectMenuMount() ?? headerMenuMount()}controlsMount={controlsMount()}/>)}diff --git a/docs/agent-guide/email.md b/docs/agent-guide/email.mdindex 26ae7c541f..fc23173188 100644--- a/docs/agent-guide/email.md+++ b/docs/agent-guide/email.md@@ -375,13 +375,15 @@ not replace it), and that after j/k the grid still has focus: the next Entermoves into the reader without opening a reply.In the new Email view, ordinary row activation opens the thread inside-`/app/component/mail`; the view breadcrumb (for example Inbox) has a hover-background and returns to the filtered list. Pressing `Escape` in the open thread+`/app/component/mail`. On desktop the thread's header has a Back arrow instead+of breadcrumbs; it returns to the filtered list (hidden in the reading pane,+where the list is already beside the thread). The subject, tags and+participants stay put while only the messages scroll. Pressing `Escape` in the open threadwith focus outside any input does the same once there is nothing left to unwind(an open reply, an expanded body, or a focused message each take one `Escape`-first); the list keeps the row you came from focused. The inline header uses the existing-email title menu: open the menu button beside the subject for **Ask AI**, **Create a-Task**, and the other thread actions. On desktop, **Mark as unread**, **Mark done**,+first); the list keeps the row you came from focused. The `⋯` email title menu+right after the subject's last word, in place of Copy subject, holds **Ask AI**,+**Create a Task**, and the other thread actions. On desktop, **Mark as unread**, **Mark done**,and reminders share one outlined group at the right of that header. Separategroups contain **Previous item** / **Next item**, icon-only **Ask Macro** / **Createtask**, and the **Share** icon and label / copy-link icon. Mobile keeps its existing@@ -394,8 +396,9 @@ press: a held key auto-repeats, and those repeats are ignored. Mark as unread (ithe header or title menu) returns to the originating list with its tab, inbox, andfilters preserved. Mark as not done and Mark as readstay on the current thread.-Opening a saved draft from **Drafts** keeps the subject breadcrumb, title menu,-and applicable header controls visible above the composer. Verify these remain+Opening a saved draft from **Drafts** shows the title menu beside Back, since+the composer has no subject line above it, and keeps the applicable header+controls. Verify these remainavailable when returning to Drafts and reopening the draft.**Delete** in the title menu moves the thread to Trash and returns to the samefiltered list. Its toast offers **Undo** to restore the email.