Finish MessageDisplayPanel consolidation for mail and campaign previews #229

Closed
opened 2026-07-09 18:42:12 +02:00 by zemion · 1 comment
Owner

Context

MessageDisplayPanel is already the right shared primitive for rendered mail/message content, but campaign still needs wrapper behavior and the core panel still has a few hard-rendered internals that should move onto shared controls.

Current call sites found by scan

  • govoplan-core/webui/src/components/MessageDisplayPanel.tsx
    • Shared content panel with title, fields, bodyText, bodyHtml, bodyPreview, preferredBodyMode, deriveTextFromHtml, headers, attachments, and emptyText.
    • Still hand-renders the HTML/text body switch instead of using the shared SegmentedControl.
  • govoplan-mail/webui/src/features/mail/MailboxPage.tsx
    • Uses MessageDisplayPanel inline for mailbox reading.
    • Passes sender/recipient/date fields, body text/html/preview, headers, attachments, and empty-state text.
  • govoplan-campaign/webui/src/features/campaigns/components/MessagePreviewOverlay.tsx
    • Wraps MessageDisplayPanel with modal shell, recipient note, message navigation, keyboard navigation, raw MIME details, and close button.
  • govoplan-campaign/webui/src/features/campaigns/TemplateDataPage.tsx
    • Uses campaign overlay for template preview with recipient pagination and resolved attachment preview.
  • govoplan-campaign/webui/src/features/campaigns/ReviewSendPage.tsx
    • Uses campaign overlay for mock mailbox preview and built-message preview.

Proposed component direction

Keep MessageDisplayPanel as the content primitive and add a reusable higher-level wrapper only if the campaign overlay behavior is useful outside campaign.

Potential API additions:

  • Replace internal body-mode buttons in MessageDisplayPanel with SegmentedControl.
  • Add optional props to MessageDisplayPanel if needed:
    • bodySwitchSize / bodySwitchWidth or fixed defaults matching the shared segmented control.
    • attachmentsTitle, headersTitle, bodyTitle if modules need module-specific labels.
    • renderAttachmentActions for future open/download/send actions.
  • Consider a new MessagePreviewDialog wrapper:
    • Props: open, title, onClose, recipientLabel, recipientNote, navigation, raw, rawLabel, closeLabel, children or message props forwarded to MessageDisplayPanel.
    • Navigation props: index, total, onFirst, onPrevious, onNext, onLast, enableKeyboardNavigation.
    • Should not force campaign semantics; campaign can keep a thin feature-specific adapter.

Acceptance criteria

  • MessageDisplayPanel uses SegmentedControl for the HTML/text switch.
  • Campaign overlay is either made clearly feature-specific and thin, or replaced by a generic core MessagePreviewDialog plus campaign adapter.
  • Mailbox preview and campaign template/review previews stay visually consistent.
  • Attachment grouping, ZIP protection hints, header display, and empty states are preserved.
  • Build and module permutation tests pass.
## Context `MessageDisplayPanel` is already the right shared primitive for rendered mail/message content, but campaign still needs wrapper behavior and the core panel still has a few hard-rendered internals that should move onto shared controls. ## Current call sites found by scan - `govoplan-core/webui/src/components/MessageDisplayPanel.tsx` - Shared content panel with `title`, `fields`, `bodyText`, `bodyHtml`, `bodyPreview`, `preferredBodyMode`, `deriveTextFromHtml`, `headers`, `attachments`, and `emptyText`. - Still hand-renders the HTML/text body switch instead of using the shared `SegmentedControl`. - `govoplan-mail/webui/src/features/mail/MailboxPage.tsx` - Uses `MessageDisplayPanel` inline for mailbox reading. - Passes sender/recipient/date fields, body text/html/preview, headers, attachments, and empty-state text. - `govoplan-campaign/webui/src/features/campaigns/components/MessagePreviewOverlay.tsx` - Wraps `MessageDisplayPanel` with modal shell, recipient note, message navigation, keyboard navigation, raw MIME details, and close button. - `govoplan-campaign/webui/src/features/campaigns/TemplateDataPage.tsx` - Uses campaign overlay for template preview with recipient pagination and resolved attachment preview. - `govoplan-campaign/webui/src/features/campaigns/ReviewSendPage.tsx` - Uses campaign overlay for mock mailbox preview and built-message preview. ## Proposed component direction Keep `MessageDisplayPanel` as the content primitive and add a reusable higher-level wrapper only if the campaign overlay behavior is useful outside campaign. Potential API additions: - Replace internal body-mode buttons in `MessageDisplayPanel` with `SegmentedControl`. - Add optional props to `MessageDisplayPanel` if needed: - `bodySwitchSize` / `bodySwitchWidth` or fixed defaults matching the shared segmented control. - `attachmentsTitle`, `headersTitle`, `bodyTitle` if modules need module-specific labels. - `renderAttachmentActions` for future open/download/send actions. - Consider a new `MessagePreviewDialog` wrapper: - Props: `open`, `title`, `onClose`, `recipientLabel`, `recipientNote`, `navigation`, `raw`, `rawLabel`, `closeLabel`, `children` or `message` props forwarded to `MessageDisplayPanel`. - Navigation props: `index`, `total`, `onFirst`, `onPrevious`, `onNext`, `onLast`, `enableKeyboardNavigation`. - Should not force campaign semantics; campaign can keep a thin feature-specific adapter. ## Acceptance criteria - `MessageDisplayPanel` uses `SegmentedControl` for the HTML/text switch. - Campaign overlay is either made clearly feature-specific and thin, or replaced by a generic core `MessagePreviewDialog` plus campaign adapter. - Mailbox preview and campaign template/review previews stay visually consistent. - Attachment grouping, ZIP protection hints, header display, and empty states are preserved. - Build and module permutation tests pass. <!-- codex-fingerprint: shared-message-display-panel-followup-2026-07-09 -->
Author
Owner

Codex State: done

Summary

  • MessageDisplayPanel now uses the shared SegmentedControl instead of hand-rendered body-mode buttons.
  • Campaign MessagePreviewOverlay remains as a campaign-specific wrapper for pagination, attachments, and review/send context, while delegating message rendering to core MessageDisplayPanel.

Changed Files

  • webui/src/components/MessageDisplayPanel.tsx
  • /mnt/DATA/git/govoplan-campaign/webui/src/features/campaigns/components/MessagePreviewOverlay.tsx

Verification

  • npm run build passed in govoplan-core/webui
  • bash scripts/check-focused.sh passed
## Codex State: done ### Summary - MessageDisplayPanel now uses the shared SegmentedControl instead of hand-rendered body-mode buttons. - Campaign MessagePreviewOverlay remains as a campaign-specific wrapper for pagination, attachments, and review/send context, while delegating message rendering to core MessageDisplayPanel. ### Changed Files - `webui/src/components/MessageDisplayPanel.tsx` - `/mnt/DATA/git/govoplan-campaign/webui/src/features/campaigns/components/MessagePreviewOverlay.tsx` ### Verification - `npm run build passed in govoplan-core/webui` - `bash scripts/check-focused.sh passed`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: add-ideas/govoplan-core#229
No description provided.