'use client'; import React from 'react'; import { EmailContent } from '@/types/email'; interface EmailContentDisplayProps { content: EmailContent | null | undefined; className?: string; showQuotedText?: boolean; type?: 'html' | 'text' | 'auto'; debug?: boolean; } /** * Unified component for displaying email content in a consistent way * This handles both HTML and plain text content with proper styling */ const EmailContentDisplay: React.FC = ({ content, className = '', showQuotedText = true, type = 'auto', debug = false }) => { if (!content) { return
No content available
; } let htmlContent = ''; // Simple content rendering if (content.isHtml && content.html) { // Use HTML content htmlContent = content.html; } else if (content.text) { // Format text content with line breaks htmlContent = content.text .replace(/&/g, '&') .replace(//g, '>') .replace(/\n/g, '
'); } else { // No content available htmlContent = 'No content available'; } return (
{/* Debug output if enabled */} {debug && (

Content Type: {content.isHtml ? 'HTML' : 'Text'}

Direction: {content.direction}

HTML Length: {content.html?.length || 0}

Text Length: {content.text?.length || 0}

)}
); }; export default EmailContentDisplay;