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(email): show b on the composer's Create event and a quiet loading spinner (#9604)
gbirmanfab60cb0ff6a
diff --git a/apps/web/src/features/block-calendar/components/EventComposerSplit.test.tsx b/apps/web/src/features/block-calendar/components/EventComposerSplit.test.tsxindex d091a81fe3..0a994eeda0 100644--- a/apps/web/src/features/block-calendar/components/EventComposerSplit.test.tsx+++ b/apps/web/src/features/block-calendar/components/EventComposerSplit.test.tsx@@ -62,9 +62,11 @@ vi.mock('@app/features/calendar/components/composer/EventForm', () => ({EventForm: (props: {controller: CalendarEventFormController;guestsAction?: JSX.Element;+ status?: JSX.Element;}) => (<>{props.guestsAction}+ {props.status}<output aria-label="Conference">{props.controller.state().conference}</output>@@ -166,7 +168,7 @@ it('fills an untouched new event with values suggested after it opened', async (<EventComposerSplit initialValues={OPENED} suggestedValues={pending} />));expect(- screen.getByText('Reading the email for a time and place…')+ screen.getByText('Reading the email for a time and place')).toBeTruthy();resolve({@@ -184,7 +186,7 @@ it('fills an untouched new event with values suggested after it opened', async ();expect(screen.getByLabelText('Start').textContent).toBe('2030-01-08T14:00');expect(- screen.queryByText('Reading the email for a time and place…')+ screen.queryByText('Reading the email for a time and place')).toBeNull();});@@ -202,7 +204,7 @@ it('keeps what the user changed before suggestions arrived', async () => {await waitFor(() =>expect(- screen.queryByText('Reading the email for a time and place…')+ screen.queryByText('Reading the email for a time and place')).toBeNull());expect((screen.getByRole('textbox') as HTMLInputElement).value).toBe(diff --git a/apps/web/src/features/block-calendar/components/EventComposerSplit.tsx b/apps/web/src/features/block-calendar/components/EventComposerSplit.tsxindex 40f063f9c5..cedb7815df 100644--- a/apps/web/src/features/block-calendar/components/EventComposerSplit.tsx+++ b/apps/web/src/features/block-calendar/components/EventComposerSplit.tsx@@ -24,6 +24,7 @@ import { useQuickCallsFlag } from '@app/features/meetings/use-quick-calls-flag';import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';import { useHotkeyDOMScope } from '@core/hotkey/hotkeys';import { fireAndForget } from '@core/util/fireAndForget';+import { Spinner } from '@ui';import {type Accessor,createMemo,@@ -171,13 +172,17 @@ function EventComposerContent(return (<div ref={attachHotkeys} class="flex h-full min-h-0 flex-col p-4 text-ink">- <Show when={suggesting()}>- <p role="status" class="pb-2 text-xs text-ink-muted">- Reading the email for a time and place…- </p>- </Show><PanelEventFormcontroller={controller}+ status={+ <Show when={suggesting()}>+ <Spinner+ size="sm"+ label="Reading the email for a time and place"+ class="text-ink-extra-muted"+ />+ </Show>+ }macroCallsEnabled={macroCallsEnabled()}isEdit={isEdit()}saveError={editor.saveError()}diff --git a/apps/web/src/features/calendar/components/composer/EventForm.tsx b/apps/web/src/features/calendar/components/composer/EventForm.tsxindex 9bc234aa9a..25a0bd926a 100644--- a/apps/web/src/features/calendar/components/composer/EventForm.tsx+++ b/apps/web/src/features/calendar/components/composer/EventForm.tsx@@ -25,6 +25,7 @@ export function EventForm(props: EventFormProps) {<EventFormParts.SaveError /><div class="flex shrink-0 items-center justify-end gap-3"><EventFormParts.EditScope class="mr-auto" />+ <EventFormParts.Status /><EventFormParts.Cancel /><EventFormParts.Submit /></div>diff --git a/apps/web/src/features/calendar/components/composer/MobileEventForm.tsx b/apps/web/src/features/calendar/components/composer/MobileEventForm.tsxindex 33a643047c..f2776c42df 100644--- a/apps/web/src/features/calendar/components/composer/MobileEventForm.tsx+++ b/apps/web/src/features/calendar/components/composer/MobileEventForm.tsx@@ -35,7 +35,8 @@ export function MobileEventForm(// already separates the title from the handle.<EventFormParts.Root form={form} class={cn('-mt-4', props.class)}><Portal mount={props.headerMount}>- <div class="flex justify-end px-4 pb-1">+ <div class="flex items-center justify-end gap-3 px-4 pb-1">+ <EventFormParts.Status /><EventFormParts.Submit /></div>{/* Under the action that failed, so it shows however far the formdiff --git a/apps/web/src/features/calendar/components/composer/event-form-parts.tsx b/apps/web/src/features/calendar/components/composer/event-form-parts.tsxindex 4ec4b4f558..8acdc776ba 100644--- a/apps/web/src/features/calendar/components/composer/event-form-parts.tsx+++ b/apps/web/src/features/calendar/components/composer/event-form-parts.tsx@@ -599,6 +599,12 @@ function EditScope(props: { class?: string }) {);}+/** The host's status beside the actions, such as a loading indicator. */+function Status() {+ const form = useEventForm();+ return <>{form.props.status}</>;+}+function Cancel() {const form = useEventForm();return (@@ -663,6 +669,7 @@ export const EventFormParts = {CustomRecurrence,SaveError,EditScope,+ Status,Cancel,Submit,};diff --git a/apps/web/src/features/calendar/components/composer/event-form-state.ts b/apps/web/src/features/calendar/components/composer/event-form-state.tsindex e822def06f..8135531365 100644--- a/apps/web/src/features/calendar/components/composer/event-form-state.ts+++ b/apps/web/src/features/calendar/components/composer/event-form-state.ts@@ -24,6 +24,8 @@ export interface EventFormProps {guestsReadOnlyReason?: string;/** An action beside the guests, such as forwarding the invitation. */guestsAction?: JSX.Element;+ /** Shown left of the form's actions, such as a loading indicator. */+ status?: JSX.Element;/** The organizer hides the guest list, so the seeded guests are not all of them. */guestListHidden?: boolean;/** Whether the viewer may set what guests may do, as the organizer. */diff --git a/apps/web/src/features/email-compose/context/compose-hotkey-scope.ts b/apps/web/src/features/email-compose/context/compose-hotkey-scope.tsnew file mode 100644index 0000000000..3cb5e5684b--- /dev/null+++ b/apps/web/src/features/email-compose/context/compose-hotkey-scope.ts@@ -0,0 +1,8 @@+import { createContext, useContext } from 'solid-js';++/** The compose layout's hotkey scope, for keys its toolbar actions own. */+export const ComposeHotkeyScope = createContext<string>();++export function useComposeHotkeyScope(): string | undefined {+ return useContext(ComposeHotkeyScope);+}diff --git a/apps/web/src/features/email-compose/views/compose-layout.tsx b/apps/web/src/features/email-compose/views/compose-layout.tsxindex ba2a298bd1..d4e7cfa073 100644--- a/apps/web/src/features/email-compose/views/compose-layout.tsx+++ b/apps/web/src/features/email-compose/views/compose-layout.tsx@@ -14,6 +14,7 @@ import {import { Dynamic } from 'solid-js/web';import { FromInboxSelector } from '../components/from-inbox-selector';import { useCompose } from '../context/compose-context';+import { ComposeHotkeyScope } from '../context/compose-hotkey-scope';import {registerCcBccHotkeys,revealRecipientField,@@ -308,7 +309,9 @@ export function ComposeLayout(props: {mobileScrollRef={() => mobileScrollRef}onAddFiles={ctx.onAddAttachments}/>- {props.toolbar}+ <ComposeHotkeyScope.Provider value={composeHotkeyScope}>+ {props.toolbar}+ </ComposeHotkeyScope.Provider></div></Dynamic>);diff --git a/apps/web/src/features/email-compose/views/compose-toolbar.tsx b/apps/web/src/features/email-compose/views/compose-toolbar.tsxindex 33c77d3561..d3ff832c21 100644--- a/apps/web/src/features/email-compose/views/compose-toolbar.tsx+++ b/apps/web/src/features/email-compose/views/compose-toolbar.tsx@@ -1,3 +1,4 @@+import { t } from '@app/lib/i18n';import { FormatButtons } from '@channel/Input/FormatButtons';import { HeaderIsland } from '@components/app/split-layout/components/HeaderIsland';import {@@ -11,6 +12,8 @@ import {type NodeTransformType,} from '@core/component/LexicalMarkdown/plugins/node-transform/nodeTransformPlugin';import { fileSelector } from '@core/directive/fileSelector';+import { registerHotkey } from '@core/hotkey/hotkeys';+import { TOKENS } from '@core/hotkey/tokens';import ImageIcon from '@icon/system/regular/image.svg';import PaperclipIcon from '@icon/system/regular/paperclip.svg?component-solid';import TextAa from '@icon/system/regular/text-aa.svg';@@ -23,6 +26,7 @@ import { EmailDateSelector } from '../components/email-date-selector';import { EmailScheduleSummary } from '../components/email-schedule-summary';import { MobileComposeActions } from '../components/mobile-compose-actions';import { useCompose } from '../context/compose-context';+import { useComposeHotkeyScope } from '../context/compose-hotkey-scope';import { proposesMeeting } from '../core/meeting-intent';import { createWrittenText } from '../primitives/written-text';@@ -36,14 +40,27 @@ export function EmailComposeToolbar(props: {const writtenText = createWrittenText(() => props.editor?.());const createEvent = () => {const recipients = ctx.recipients();- ctx.calendarEvents?.open({- subject: ctx.subject(),- guests: [...recipients.to, ...recipients.cc].map(- (recipient) => recipient.data.email- ),- text: writtenText(),- });+ return (+ ctx.calendarEvents?.open({+ subject: ctx.subject(),+ guests: [...recipients.to, ...recipients.cc].map(+ (recipient) => recipient.data.email+ ),+ text: writtenText(),+ }) ?? false+ );};+ const hotkeyScope = useComposeHotkeyScope();+ if (hotkeyScope && ctx.calendarEvents) {+ registerHotkey({+ hotkey: 'b',+ scopeId: hotkeyScope,+ description: () => t('commands.createEventFromEmail'),+ keyDownHandler: createEvent,+ hotkeyToken: TOKENS.email.createEvent,+ condition: () => !!ctx.calendarEvents?.enabled() && !ctx.disabled(),+ });+ }return (<Show when={props.inline || !ctx.isMobile()} fallback={<MobileToolbar />}>@@ -121,6 +138,7 @@ export function EmailComposeToolbar(props: {<Show when={ctx.calendarEvents?.enabled()}><CreateEventButtonsuggested={proposesMeeting(writtenText())}+ shortcut={hotkeyScope ? 'b' : undefined}disabled={ctx.disabled()}onClick={createEvent}/>diff --git a/docs/agent-guide/email.md b/docs/agent-guide/email.mdindex 0673a3f27e..daa42e31e5 100644--- a/docs/agent-guide/email.md+++ b/docs/agent-guide/email.md@@ -71,11 +71,13 @@ From, To and Cc address except the viewer's as guests (Bcc and drafts are leftout); both are hidden while the calendar is off. With `enable-universal-input`on, the composer also sends the subject and latest message to`/universal_input/extract` (`intent: 'calendar'`, the Cmd+K event extractor)-and, while "Reading the email for a time and place…" shows, fills in the-suggested title, time, location and repeat rule. Suggestions that arrive after+and, while a small spinner shows left of Cancel (left of Create event on phones),+fills in+the suggested title, time, location and repeat rule. Suggestions that arrive afterany edit are dropped. The desktop reply and standalone composers have the sameaction as a calendar button between attach and the schedule clock (tooltip-`Create event`, plus `B` in a reply). It uses the draft instead: subject, To+`Create event` and `B`; in the standalone composer `B` works while focus is+outside the editor, as in a reply it works from the thread). It uses the draft instead: subject, Toand Cc as guests, and the written text (with the replied-to message in areply) for extraction. The button is accented while the written text, aboveany quoted thread, pairs a meeting word with a time (`proposesMeeting` in