feat: show the booking, parcel and order cards above the message body

This commit is contained in:
Linus Rath
2026-10-31 05:03:28 +01:00
parent f643df8164
commit 90e4e230af
2 changed files with 24 additions and 0 deletions
+2
View File
@@ -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({
)}
<CalendarInvitationBanner email={email} jmapAccountId={jmapAccountId} />
<StructuredMailBanner email={email} jmapAccountId={jmapAccountId} />
<View style={[styles.body, fill && styles.fill]}>
{deferBody ? (
@@ -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('<CalendarInvitationBanner email={email} jmapAccountId={jmapAccountId} />');
const cards = src.indexOf('<StructuredMailBanner email={email} jmapAccountId={jmapAccountId} />');
expect(invitation).toBeGreaterThan(-1);
expect(cards).toBeGreaterThan(invitation);
});
});