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
style(email): restyle the compose email component (#43)
Seamusefd7292b3e1e
diff --git a/js/app/packages/app/component/Layout.tsx b/js/app/packages/app/component/Layout.tsxindex 91ad38ff86..c47b6db29f 100644--- a/js/app/packages/app/component/Layout.tsx+++ b/js/app/packages/app/component/Layout.tsx@@ -97,7 +97,7 @@ export function Layout(props: RouteSectionProps) {return currentAuth;}, isAuthenticated());- mountGlobalFocusListener(true);+ mountGlobalFocusListener();useABTest();diff --git a/js/app/packages/app/component/rightbar/Rightbar.tsx b/js/app/packages/app/component/rightbar/Rightbar.tsxindex 646c5dbf6b..6b3f3694a0 100644--- a/js/app/packages/app/component/rightbar/Rightbar.tsx+++ b/js/app/packages/app/component/rightbar/Rightbar.tsx@@ -1,4 +1,3 @@-import { activeElement } from '@app/signal/focus';import { globalSplitManager } from '@app/signal/splitLayout';import { useIsAuthenticated } from '@core/auth';import { DragDropWrapper } from '@core/component/AI/component/DragDrop';@@ -51,7 +50,7 @@ import { createCognitionWebsocketEffect } from '@service-cognition/websocket';import { useUserId } from '@service-gql/client';import { refetchHistory, useHistory } from '@service-storage/history';import { useOpenInstructionsMd } from 'core/component/AI/util/instructions';-import { LexicalEditor } from 'lexical';+import type { LexicalEditor } from 'lexical';import {type Accessor,createEffect,diff --git a/js/app/packages/block-channel/component/FormatRibbon.tsx b/js/app/packages/block-channel/component/FormatRibbon.tsxindex 7293c19318..4f8d538e24 100644--- a/js/app/packages/block-channel/component/FormatRibbon.tsx+++ b/js/app/packages/block-channel/component/FormatRibbon.tsx@@ -20,7 +20,7 @@ export type FormatRibbonProps = {export function FormatRibbon(props: FormatRibbonProps) {return (- <div class="flex flex-row w-full gap-2 items-center bg-input rounded-t-md p-2">+ <div class="flex flex-row w-full gap-2 items-center p-2"><ActionButtontooltip="Bold"shortcut="meta+b"diff --git a/js/app/packages/block-email/component/Compose.tsx b/js/app/packages/block-email/component/Compose.tsxindex d60a5a0d42..3bd01c632b 100644--- a/js/app/packages/block-email/component/Compose.tsx+++ b/js/app/packages/block-email/component/Compose.tsx@@ -3,7 +3,6 @@ import {SplitHeaderBadge,StaticSplitLabel,} from '@app/component/split-layout/components/SplitLabel';-import { SplitToolbarLeft } from '@app/component/split-layout/components/SplitToolbar';import { connectEmail } from '@app/signal/emailAuth';import { useHasPaidAccess } from '@core/auth';import { RecipientSelector } from '@core/component/RecipientSelector';@@ -111,9 +110,6 @@ export function EmailCompose() {]}/></SplitHeaderLeft>- <SplitToolbarLeft>- <div class="h-full items-center flex" p-1></div>- </SplitToolbarLeft><div class="relative flex flex-col w-full h-full panel"><Switch><Match when={linkError()}>@@ -150,12 +146,12 @@ export function EmailCompose() {</Match></Switch><div- class="pt-2 h-full grow w-full overflow-y-auto px-4"+ class="pt-2 h-full w-full overflow-y-auto px-4 flex flex-col"classList={{'pointer-events-none opacity-50': Boolean(linkError()),}}>- <div class="macro-message-width mx-auto pb-1 h-full">+ <div class="macro-message-width mx-auto pb-1 w-full"><div class="mb-4 mt-12 h-6 flex items-center justify-between"><Show when={link()}>{(link) => (@@ -254,26 +250,26 @@ export function EmailCompose() {disabled={!!linkError()}/></div>- </div>- <div- class="shrink-0 w-full px-4 pb-2 {linkError()"- classList={{- 'pointer-events-none opacity-50': Boolean(linkError()),- }}- >- <div class="mx-auto w-full macro-message-width">- <ComposeEmailInput- selectedRecipients={selectedRecipients}- ccRecipients={ccRecipients}- bccRecipients={bccRecipients}- subject={subject}- link={link()}- inputAttachments={{- store: emailInputAttachmentsStore,- setStore: setEmailInputAttachmentsStore,- key: 'draft',- }}- />+ <div+ class="shrink-0 w-full pb-2 grow"+ classList={{+ 'pointer-events-none opacity-50': Boolean(linkError()),+ }}+ >+ <div class="mx-auto w-full h-full macro-message-width">+ <ComposeEmailInput+ selectedRecipients={selectedRecipients}+ ccRecipients={ccRecipients}+ bccRecipients={bccRecipients}+ subject={subject}+ link={link()}+ inputAttachments={{+ store: emailInputAttachmentsStore,+ setStore: setEmailInputAttachmentsStore,+ key: 'draft',+ }}+ />+ </div></div></div></div>diff --git a/js/app/packages/block-email/component/ComposeEmailInput.tsx b/js/app/packages/block-email/component/ComposeEmailInput.tsxindex b1ae750f0b..037d1c5752 100644--- a/js/app/packages/block-email/component/ComposeEmailInput.tsx+++ b/js/app/packages/block-email/component/ComposeEmailInput.tsx@@ -1,4 +1,5 @@import { useSplitLayout } from '@app/component/split-layout/layout';+import { useSplitPanel } from '@app/component/split-layout/layoutUtils';import { globalSplitManager } from '@app/signal/splitLayout';import { FormatRibbon } from '@block-channel/component/FormatRibbon';import { FileDropOverlay } from '@core/component/FileDropOverlay';@@ -36,6 +37,7 @@ import {} from 'lexical';import { createSignal, onMount, Show } from 'solid-js';import { createStore } from 'solid-js/store';+import { type FocusableElement, tabbable } from 'tabbable';import { sendEmail } from '../signal/email';import { handleFileUpload } from '../util/handleFileUpload';import { makeAttachmentPublic } from '../util/makeAttachmentPublic';@@ -72,6 +74,27 @@ export function ComposeEmailInput(props: {const [errorMsg, setErrorMsg] = createSignal('');const [sending, setSending] = createSignal(false);+ const panel = useSplitPanel();++ const focusSibling = (direction: 'next' | 'prev') => {+ const panelRef = panel?.panelRef();+ if (!panelRef) return;+ const tabbableEls = tabbable(panelRef);+ const activeEl = document.activeElement;+ const activeElIndex = tabbableEls.indexOf(activeEl as FocusableElement);+ if (activeElIndex > -1) {+ const ndx = activeElIndex + (direction === 'next' ? 1 : -1);+ if (ndx < 0 || ndx >= tabbableEls.length) return false;+ const prevEl = tabbableEls[ndx];+ if (!prevEl) return false;+ prevEl.focus();+ return true;+ } else {+ tabbableEls.at(-1)?.focus();+ return true;+ }+ };+useUserId();let bodyDiv!: HTMLDivElement;@@ -225,25 +248,14 @@ export function ComposeEmailInput(props: {ref={(el) => {composeContainerRef = el;}}- class={`macro-message-width relative flex-1 flex flex-col border border-edge px-3 py-2 bg-input`}+ class="w-full h-full relative flex-1 flex flex-col py-2"><Show when={error()}><div class="text-failure-ink text-sm mt-1">{errorMsg()}</div></Show><div class="w-full h-full flex flex-col">- <Show when={showFormatRibbon()}>- <FormatRibbon- state={formatState}- inlineFormat={(format: TextFormatType) => {- editor()?.dispatchCommand(FORMAT_TEXT_COMMAND, format);- }}- nodeFormat={(transform: NodeTransformType) => {- editor()?.dispatchCommand(NODE_TRANSFORM, transform);- }}- />- </Show><div- class="min-h-20 max-h-80 overflow-y-scroll w-full flex flex-col cursor-text"+ class="min-h-20 grow w-full h-full flex flex-col cursor-text"ref={bodyDiv}onclick={() => {editor()?.focus();@@ -263,17 +275,23 @@ export function ComposeEmailInput(props: {},}}>- <div- class={`${!isDragging() && 'hidden'} absolute size-full inset-0`}- >+ <div class={`${!isDragging() && 'hidden'} absolute inset-0`}><FileDropOverlay>Drop file(s) to attach</FileDropOverlay></div><MarkdownTextareacaptureEditor={setEditor}- class={`text-sm break-words text-ink ${isDragging() && 'blur'}`}+ class="text-sm break-words text-ink"editable={() => true}- placeholder="Send an Email"+ placeholder="Use `@` to reference files"onChange={setContent}+ onFocusLeaveStart={(e) => {+ e.preventDefault();+ focusSibling('prev');+ }}+ onFocusLeaveEnd={(e) => {+ e.preventDefault();+ focusSibling('next');+ }}// onDocumentMention={(item) => {// makeAttachmentPublic(item.id);// }}@@ -283,7 +301,18 @@ export function ComposeEmailInput(props: {// setFormatState={setFormatState}/></div>- <div class="flex flex-row items-center space-x-2">+ <Show when={showFormatRibbon()}>+ <FormatRibbon+ state={formatState}+ inlineFormat={(format: TextFormatType) => {+ editor()?.dispatchCommand(FORMAT_TEXT_COMMAND, format);+ }}+ nodeFormat={(transform: NodeTransformType) => {+ editor()?.dispatchCommand(NODE_TRANSFORM, transform);+ }}+ />+ </Show>+ <div class="flex flex-row items-center space-x-2 p-1 border-edge-muted border-t"><div class="relative" ref={attachButtonRef}><IconButtontheme="clear"diff --git a/js/app/packages/core/component/LexicalMarkdown/component/core/MarkdownTextarea.tsx b/js/app/packages/core/component/LexicalMarkdown/component/core/MarkdownTextarea.tsxindex dbd61333fb..4a0078ac6d 100644--- a/js/app/packages/core/component/LexicalMarkdown/component/core/MarkdownTextarea.tsx+++ b/js/app/packages/core/component/LexicalMarkdown/component/core/MarkdownTextarea.tsx@@ -272,11 +272,7 @@ export function MarkdownTextarea(props: MarkdownTextareaProps) {e.stopPropagation();}}>- <div- class="h-full"- ref={mountRef}- contentEditable={props.editable()}- ></div>+ <div ref={mountRef} contentEditable={props.editable()} /><DecoratorRenderer editor={editor} /><NodeAccessoryRenderer editor={editor} store={accessoryStore} /><Show when={showPlaceholder()}>