From 90e4e230afa4a343e19082277dddd0360b11b2f5 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Sat, 31 Oct 2026 05:03:28 +0100 Subject: [PATCH] feat: show the booking, parcel and order cards above the message body --- src/components/email/MessageContent.tsx | 2 ++ .../__tests__/structured-mail-mount.test.ts | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/components/email/structured-mail/__tests__/structured-mail-mount.test.ts diff --git a/src/components/email/MessageContent.tsx b/src/components/email/MessageContent.tsx index e974306b..5b17d377 100644 --- a/src/components/email/MessageContent.tsx +++ b/src/components/email/MessageContent.tsx @@ -6,6 +6,7 @@ import { useColors } from '../../theme/colors'; import { useSettingsStore } from '../../stores/settings-store'; import EmailBodyView from '../EmailBodyView'; import { CalendarInvitationBanner } from './CalendarInvitationBanner'; +import { StructuredMailBanner } from './structured-mail/StructuredMailBanner'; import { MessageHeader } from './MessageHeader'; import { AttachmentChips } from './AttachmentChips'; import { UnsubscribeBanner } from './UnsubscribeBanner'; @@ -114,6 +115,7 @@ export function MessageContent({ )} + {deferBody ? ( diff --git a/src/components/email/structured-mail/__tests__/structured-mail-mount.test.ts b/src/components/email/structured-mail/__tests__/structured-mail-mount.test.ts new file mode 100644 index 00000000..81f54f28 --- /dev/null +++ b/src/components/email/structured-mail/__tests__/structured-mail-mount.test.ts @@ -0,0 +1,22 @@ +import { describe, expect, it } from 'vitest'; +import fs from 'node:fs'; +import path from 'node:path'; + +// The booking, parcel and order cards only show if the reader renders the +// banner. The webmail draws them above the body, after the invitation banner +// (components/email/email-viewer.tsx:2695). The banner itself is tested in +// structured-mail-banner.test.ts; this checks the reader mounts it. + +const messageContent = () => + fs.readFileSync(path.resolve(__dirname, '..', '..', 'MessageContent.tsx'), 'utf8'); + +describe('structured mail mount', () => { + it('renders the cards banner after the invitation banner, for the same account', () => { + const src = messageContent(); + expect(src).toMatch(/import \{ StructuredMailBanner \} from '\.\/structured-mail\/StructuredMailBanner';/); + const invitation = src.indexOf(''); + const cards = src.indexOf(''); + expect(invitation).toBeGreaterThan(-1); + expect(cards).toBeGreaterThan(invitation); + }); +});