import { ArrowBigLeft, ArrowBigLeftDash, ArrowBigRight, ArrowBigRightDash } from "lucide-react"; import Button from "../../../components/Button"; export type MessagePreviewAttachment = { filename?: string | null; label?: string | null; detail?: string | null; contentType?: string | null; sizeBytes?: number | null; archiveGroup?: string | null; archiveLabel?: string | null; }; export type MessagePreviewMetaItem = { label: string; value: React.ReactNode; }; export type MessagePreviewNavigation = { index: number; total: number; onFirst: () => void; onPrevious: () => void; onNext: () => void; onLast: () => void; }; export type MessagePreviewOverlayProps = { title?: string; subject?: string | null; bodyMode?: "text" | "html"; text?: string | null; html?: string | null; recipientLabel?: React.ReactNode; recipientNote?: React.ReactNode; metaItems?: MessagePreviewMetaItem[]; attachments?: MessagePreviewAttachment[]; raw?: string | null; rawLabel?: string; navigation?: MessagePreviewNavigation; closeLabel?: string; onClose: () => void; }; export default function MessagePreviewOverlay({ title = "Message preview", subject, bodyMode = "text", text, html, recipientLabel, recipientNote, metaItems = [], attachments = [], raw, rawLabel = "Raw MIME", navigation, closeLabel = "Close", onClose }: MessagePreviewOverlayProps) { const shownSubject = subject?.trim() || "No subject"; const shownText = text?.trim() || "No plain-text body to preview."; const shownHtml = html?.trim() || "

No HTML body to preview.

"; return (

{title}

{(recipientLabel || recipientNote || navigation) && (
{recipientLabel && {recipientLabel}} {recipientNote &&

{recipientNote}

}
{navigation && (
{navigation.index + 1} / {navigation.total}
)}
)} {metaItems.length > 0 && (
{metaItems.map((item) => (
{item.label}{item.value || "—"}
))}
)}

{shownSubject}

{bodyMode === "html" ? (