Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(ui): add scroll to emails (#3376)

Fake-User855eb829a977
diff --git a/js/app/packages/block-email/component/BaseInput.tsx b/js/app/packages/block-email/component/BaseInput.tsx
index 6afc7784bf..f91dbf0853 100644
--- a/js/app/packages/block-email/component/BaseInput.tsx
+++ b/js/app/packages/block-email/component/BaseInput.tsx
@@ -79,7 +79,7 @@ import type {
ApiDraftOutputDbId,
ApiMessage,
} from '@service-email/generated/schemas';
-import { Button, cn, HoverCard, Tooltip } from '@ui';
+import { Button, cn, HoverCard, Scroll, Tooltip } from '@ui';
import {
defaultSelectionData,
lazyRegister,
@@ -1535,7 +1535,7 @@ export function BaseInput(props: {
</div>
</Show>
<div
- class="max-h-80 overflow-y-scroll w-full flex flex-col placeholder:text-ink-placeholder placeholder:opacity-50 px-4 py-1 [&_.text-ink-placeholder]:left-0 [&_.text-ink-placeholder>p]:my-0"
+ class="relative h-18 overflow-hidden w-full flex flex-col placeholder:text-ink-placeholder placeholder:opacity-50 px-4 py-1 [&_.text-ink-placeholder]:left-0 [&_.text-ink-placeholder>p]:my-0"
onclick={() => {
editor()?.focus();
}}
@@ -1571,96 +1571,100 @@ export function BaseInput(props: {
>
<FileDropOverlay>Drop file(s) to attach</FileDropOverlay>
</div>
- <MarkdownTextarea
- captureEditor={(editor) => {
- setEditor(editor);
- form().setCapturedEditor(editor);
- }}
- class={cn(
- 'ph-no-capture cursor-text text-sm wrap-break-word text-ink',
- isDragging() && 'blur'
- )}
- editable={() => !sendMutation.isPending}
- initialValue={props.preloadedBody}
- initialHtml={restoredSnapshot?.bodyHtml ?? props.preloadedHtml}
- placeholder="Reply — @mention to share or cc people"
- watermark={!hasPaidAccess() ? <MacroSignatureButton /> : undefined}
- onChange={handleChange}
- onDocumentMention={(item) => {
- makeAttachmentPublic(item.id);
- scheduleDraftSave();
- }}
- onUserMention={handleUserMention}
- portalScope="split"
- formatState={formatState}
- setFormatState={setFormatState}
- domRef={props.markdownDomRef}
- onPasteFilesAndDirs={(files, directories) => {
- const editor_ = editor();
- if (!editor_) return;
- handleFileFolderDrop(
- files,
- directories,
- createFilesReadyHandler(
- editor_,
- blockId,
- 'email',
- undefined,
- (uploadedItemIds) => {
- uploadedItemIds.forEach((itemId) => {
- makeAttachmentPublic(itemId);
- });
- scheduleDraftSave();
- },
- { width: 542, height: 542 }
- )
- );
- }}
- />
- <div class="ph-no-capture flex gap-1 flex-wrap w-full py-2">
- <For each={form().attachments.list()}>
- {(attachment) => (
- <Switch>
- <Match when={attachment.type === 'local' && attachment}>
- {(attachment) => (
- <EmailAttachmentPill
- attachment={{
- fileName: attachment().file.name,
- mimeType: attachment().file.type,
- }}
- removable
- onRemove={() => handleRemoveAttachment(attachment())}
- />
- )}
- </Match>
- <Match when={attachment.type === 'remote' && attachment}>
- {(attachment) => (
- <EmailAttachmentPill
- attachment={{
- fileName: attachment().fileName,
- mimeType: attachment().contentType,
- }}
- removable
- onRemove={() => handleRemoveAttachment(attachment())}
- />
- )}
- </Match>
- <Match when={attachment.type === 'forwarded' && attachment}>
- {(attachment) => (
- <EmailAttachmentPill
- attachment={{
- fileName: attachment().fileName,
- mimeType: attachment().mimeType,
- }}
- removable
- onRemove={() => handleRemoveAttachment(attachment())}
- />
- )}
- </Match>
- </Switch>
+ <Scroll>
+ <MarkdownTextarea
+ captureEditor={(editor) => {
+ setEditor(editor);
+ form().setCapturedEditor(editor);
+ }}
+ class={cn(
+ 'ph-no-capture cursor-text text-sm wrap-break-word text-ink h-auto overflow-visible',
+ isDragging() && 'blur'
)}
- </For>
- </div>
+ editable={() => !sendMutation.isPending}
+ initialValue={props.preloadedBody}
+ initialHtml={restoredSnapshot?.bodyHtml ?? props.preloadedHtml}
+ placeholder="Reply — @mention to share or cc people"
+ watermark={
+ !hasPaidAccess() ? <MacroSignatureButton /> : undefined
+ }
+ onChange={handleChange}
+ onDocumentMention={(item) => {
+ makeAttachmentPublic(item.id);
+ scheduleDraftSave();
+ }}
+ onUserMention={handleUserMention}
+ portalScope="split"
+ formatState={formatState}
+ setFormatState={setFormatState}
+ domRef={props.markdownDomRef}
+ onPasteFilesAndDirs={(files, directories) => {
+ const editor_ = editor();
+ if (!editor_) return;
+ handleFileFolderDrop(
+ files,
+ directories,
+ createFilesReadyHandler(
+ editor_,
+ blockId,
+ 'email',
+ undefined,
+ (uploadedItemIds) => {
+ uploadedItemIds.forEach((itemId) => {
+ makeAttachmentPublic(itemId);
+ });
+ scheduleDraftSave();
+ },
+ { width: 542, height: 542 }
+ )
+ );
+ }}
+ />
+ <div class="ph-no-capture flex gap-1 flex-wrap w-full py-2">
+ <For each={form().attachments.list()}>
+ {(attachment) => (
+ <Switch>
+ <Match when={attachment.type === 'local' && attachment}>
+ {(attachment) => (
+ <EmailAttachmentPill
+ attachment={{
+ fileName: attachment().file.name,
+ mimeType: attachment().file.type,
+ }}
+ removable
+ onRemove={() => handleRemoveAttachment(attachment())}
+ />
+ )}
+ </Match>
+ <Match when={attachment.type === 'remote' && attachment}>
+ {(attachment) => (
+ <EmailAttachmentPill
+ attachment={{
+ fileName: attachment().fileName,
+ mimeType: attachment().contentType,
+ }}
+ removable
+ onRemove={() => handleRemoveAttachment(attachment())}
+ />
+ )}
+ </Match>
+ <Match when={attachment.type === 'forwarded' && attachment}>
+ {(attachment) => (
+ <EmailAttachmentPill
+ attachment={{
+ fileName: attachment().fileName,
+ mimeType: attachment().mimeType,
+ }}
+ removable
+ onRemove={() => handleRemoveAttachment(attachment())}
+ />
+ )}
+ </Match>
+ </Switch>
+ )}
+ </For>
+ </div>
+ </Scroll>
</div>
<div class="flex flex-row w-full h-9 justify-between items-center px-3 pb-2 pt-0.5 space-x-2">
<div class="flex flex-row items-center gap-1">
diff --git a/js/app/packages/block-email/component/compose/Compose.tsx b/js/app/packages/block-email/component/compose/Compose.tsx
index 1de8d279c5..c759a38796 100644
--- a/js/app/packages/block-email/component/compose/Compose.tsx
+++ b/js/app/packages/block-email/component/compose/Compose.tsx
@@ -659,7 +659,7 @@ export function EmailCompose(props: EmailComposeProps) {
>
<ComposeLayout
toolbar={<EmailComposeToolbar editor={editor} />}
- class="size-full p-4 bg-surface max-h-full mobile:max-h-none overflow-y-auto flex flex-col min-h-0 mobile:min-h-full"
+ class="size-full p-4 bg-surface max-h-full mobile:max-h-none overflow-hidden flex flex-col min-h-0 mobile:min-h-full"
/>
</WrapUnlessMobile>
</div>
diff --git a/js/app/packages/block-email/component/compose/ComposeBody.tsx b/js/app/packages/block-email/component/compose/ComposeBody.tsx
index 78b57a8877..8db2fb48d2 100644
--- a/js/app/packages/block-email/component/compose/ComposeBody.tsx
+++ b/js/app/packages/block-email/component/compose/ComposeBody.tsx
@@ -9,7 +9,7 @@ import { createFilesReadyHandler } from '@core/component/LexicalMarkdown/utils/f
import { fileFolderDrop } from '@core/directive/fileFolderDrop';
import { handleFileFolderDrop } from '@core/util/upload';
import { logger } from '@observability/logger';
-import { cn } from '@ui';
+import { cn, Scroll } from '@ui';
import type { LexicalEditor } from 'lexical';
import {
type Accessor,
@@ -139,7 +139,7 @@ export function ComposeBody(props: {
<>
<div class="size-full min-h-0 sm:max-h-full mobile:flex-1 flex flex-col flex-1">
<div
- class="grow size-full flex flex-col cursor-text placeholder:text-ink-placeholder placeholder:opacity-50 overflow-auto"
+ class="grow size-full flex flex-col cursor-text placeholder:text-ink-placeholder placeholder:opacity-50 overflow-hidden relative"
ref={bodyDiv}
onclick={() => {
editor()?.focus();
@@ -158,40 +158,42 @@ export function ComposeBody(props: {
<FileDropOverlay>Drop file(s) to attach</FileDropOverlay>
</div>
- <MarkdownTextarea
- domRef={props.inputRef}
- captureEditor={captureEditor}
- scrollRef={props.mobileScrollRef}
- initialHtml={ctx.initialHtml()}
- initialValue={ctx.initialMarkdown?.()}
- class="text-sm wrap-break-word text-ink mobile:overflow-auto h-auto"
- editable={() => !ctx.disabled()}
- placeholder="Use `@` to reference files"
- watermark={
- !ctx.hasPaidAccess() ? <MacroSignatureButton /> : undefined
- }
- onChange={ctx.onContentChange}
- onUserMention={(mention) => {
- addUserMentionToCc({
- mention,
- recipientOptions: ctx.recipientOptions(),
- toRecipients: ctx.recipients().to,
- ccRecipients: ctx.recipients().cc,
- bccRecipients: ctx.recipients().bcc,
- setCc: (next) => ctx.setRecipients('cc', next),
- });
- }}
- onFocusLeaveStart={(e) => {
- e.preventDefault();
- focusSibling('prev');
- }}
- onFocusLeaveEnd={(e) => {
- e.preventDefault();
- focusSibling('next');
- }}
- portalScope="local"
- onPasteFilesAndDirs={onAddFilesAndDirs}
- />
+ <Scroll>
+ <MarkdownTextarea
+ domRef={props.inputRef}
+ captureEditor={captureEditor}
+ scrollRef={props.mobileScrollRef}
+ initialHtml={ctx.initialHtml()}
+ initialValue={ctx.initialMarkdown?.()}
+ class="text-sm wrap-break-word text-ink h-auto overflow-visible"
+ editable={() => !ctx.disabled()}
+ placeholder="Use `@` to reference files"
+ watermark={
+ !ctx.hasPaidAccess() ? <MacroSignatureButton /> : undefined
+ }
+ onChange={ctx.onContentChange}
+ onUserMention={(mention) => {
+ addUserMentionToCc({
+ mention,
+ recipientOptions: ctx.recipientOptions(),
+ toRecipients: ctx.recipients().to,
+ ccRecipients: ctx.recipients().cc,
+ bccRecipients: ctx.recipients().bcc,
+ setCc: (next) => ctx.setRecipients('cc', next),
+ });
+ }}
+ onFocusLeaveStart={(e) => {
+ e.preventDefault();
+ focusSibling('prev');
+ }}
+ onFocusLeaveEnd={(e) => {
+ e.preventDefault();
+ focusSibling('next');
+ }}
+ portalScope="local"
+ onPasteFilesAndDirs={onAddFilesAndDirs}
+ />
+ </Scroll>
</div>
<div class="flex flex-wrap items-center gap-2">
<For each={ctx.attachments()}>
diff --git a/js/app/packages/block-email/component/compose/ComposeToolbar.tsx b/js/app/packages/block-email/component/compose/ComposeToolbar.tsx
index b2e31a127b..2f666b9067 100644
--- a/js/app/packages/block-email/component/compose/ComposeToolbar.tsx
+++ b/js/app/packages/block-email/component/compose/ComposeToolbar.tsx
@@ -141,33 +141,33 @@ export function EmailComposeToolbar(props: {
<div class="flex items-center gap-2">
<Show when={ctx.onSaveDraft}>
<Button
- variant="base"
- size="sm"
disabled={
ctx.isSending() || ctx.isSavingDraft?.() || ctx.disabled()
}
onClick={() => void ctx.onSaveDraft?.()}
+ variant="base"
+ size="sm"
>
{ctx.isSavingDraft?.() ? 'Saving…' : 'Save Draft'}
</Button>
</Show>
<Tooltip label={ctx.sendTime() ? 'Send time is scheduled' : ''}>
<Button
- tooltip="Send"
- size="icon-sm"
+ onClick={() => ctx.onSend()}
disabled={
- ctx.isSending() ||
ctx.isSavingDraft?.() ||
- ctx.disabled() ||
- !!ctx.sendTime()
+ !!ctx.sendTime() ||
+ ctx.isSending() ||
+ ctx.disabled()
}
- onClick={() => ctx.onSend()}
+ tooltip="Send"
+ size="icon-sm"
>
<Show
- when={!ctx.isSending()}
fallback={<Spinner class="animate-spin" />}
+ when={!ctx.isSending()}
>
- <PaperPlaneRight class="text-accent fill-accent" />
+ <PaperPlaneRight />
</Show>
</Button>
</Tooltip>