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.

style(email): Constrain inline image, shrink attached images (#1214)

Evan Hutnikfaefcde680d2
diff --git a/js/app/packages/block-email/component/EmailMessageBody.tsx b/js/app/packages/block-email/component/EmailMessageBody.tsx
index b6666b51d8..78a8b1de90 100644
--- a/js/app/packages/block-email/component/EmailMessageBody.tsx
+++ b/js/app/packages/block-email/component/EmailMessageBody.tsx
@@ -117,7 +117,7 @@ export function EmailMessageBody(props: EmailMessageBodyProps) {
const shadow = hostContainer.attachShadow({ mode: 'open' });
// Style that uses a CSS variable to control image visibility
const styleEl = document.createElement('style');
- styleEl.textContent = `img{display: var(--macro-email-img-display, initial);}`;
+ styleEl.textContent = `img{display: var(--macro-email-img-display, initial); max-width: 100% !important; height: auto !important;}`;
shadow.appendChild(styleEl);
const messageDiv = document.createElement('div');
messageDiv.innerHTML = source()?.mainContent ?? '';
diff --git a/js/app/packages/block-email/component/MessageContainer.tsx b/js/app/packages/block-email/component/MessageContainer.tsx
index 2e344d1833..5bc5affe54 100644
--- a/js/app/packages/block-email/component/MessageContainer.tsx
+++ b/js/app/packages/block-email/component/MessageContainer.tsx
@@ -7,7 +7,6 @@ import { EmailMessageBody } from '@block-email/component/EmailMessageBody';
import { EmailMessageTopBar } from '@block-email/component/EmailMessageTopBar';
import { isMessageFromCurrentUser } from '@block-email/util/emailUser';
import { ImageGalleryPreview } from '@core/component/ImageGalleryPreview';
-import { ImagePreview } from '@core/component/ImagePreview';
import { Message } from '@core/component/Message';
import { toast } from '@core/component/Toast/Toast';
import { VideoPreview } from '@core/component/VideoPreview';
@@ -24,7 +23,7 @@ import type {
import { useEmail, useUserId } from '@core/context/user';
import { storageServiceClient } from '@service-storage/client';
import type { FileType } from '@service-storage/generated/schemas/fileType';
-import { createMemo, createSignal, For, Match, Show, Switch } from 'solid-js';
+import { createMemo, createSignal, For, Show } from 'solid-js';
import { Portal } from 'solid-js/web';
interface MessageContainerProps {
@@ -248,31 +247,15 @@ export function MessageContainer(props: MessageContainerProps) {
</Message.Body>
{/* Image attachments */}
<Show when={imageAttachmentsWithSfs().length > 0}>
- <Switch>
- <Match when={imageAttachmentsWithSfs().length === 1}>
- <div class="max-w-[400px] w-fit mt-2">
- <ImagePreview
- image={{
- id: imageAttachmentsWithSfs()[0].sfs_id!,
- }}
- variant="dynamic"
- />
- </div>
- </Match>
- <Match when={imageAttachmentsWithSfs().length > 1}>
- <div class="flex flex-wrap gap-2 mt-2">
- <ImageGalleryPreview
- images={imageAttachmentsWithSfs().map((a) => ({
- id: a.sfs_id!,
- }))}
- variant="dynamic"
- attachmentIds={imageAttachmentsWithSfs().map(
- (a) => a.db_id!
- )}
- />
- </div>
- </Match>
- </Switch>
+ <div class="flex flex-wrap gap-2 mt-2">
+ <ImageGalleryPreview
+ images={imageAttachmentsWithSfs().map((a) => ({
+ id: a.sfs_id!,
+ }))}
+ variant="small"
+ attachmentIds={imageAttachmentsWithSfs().map((a) => a.db_id!)}
+ />
+ </div>
</Show>
{/* Video attachments */}
diff --git a/js/app/packages/core/component/ImageGalleryPreview.tsx b/js/app/packages/core/component/ImageGalleryPreview.tsx
index 54be86ac42..39427c5ddc 100644
--- a/js/app/packages/core/component/ImageGalleryPreview.tsx
+++ b/js/app/packages/core/component/ImageGalleryPreview.tsx
@@ -45,7 +45,7 @@ export type ImageGalleryPreviewProps = {
const THEMES = {
small:
- 'size-15 object-cover rounded-2xl border border-edge hover:opacity-80 select-none',
+ 'size-23 object-cover rounded-2xl border border-edge hover:opacity-80 select-none',
dynamic:
'min-w-[100px] max-h-[200px] object-contain w-full rounded-2xl select-none border border-edge hover:border-accent hover-transition-border',
expanded: