courrier clean 2

This commit is contained in:
alma 2025-04-26 14:31:55 +02:00
parent f4112f3160
commit 9fba1ac1c3

View File

@ -1638,25 +1638,56 @@ export default function CourrierPage() {
folder: email.folder
};
// Rest of the function stays the same
// Format appropriate content with headers for reply/forward
let formattedContent = '';
const formattedDate = formatDate(new Date(email.date));
if (type === 'reply' || type === 'reply-all') {
// Create reply quote header
formattedContent = `
<div class="reply-body">
<br/>
<div class="quote-header" style="color: #555; font-size: 13px; margin: 20px 0 10px 0;">
<div style="font-weight: 500;">On ${formattedDate}, ${email.fromName ? `${email.fromName} <${email.from}>` : email.from} wrote:</div>
</div>
<blockquote style="margin: 0; padding: 10px 0 10px 15px; border-left: 3px solid #ddd; color: #555; background-color: #f8f8f8; border-radius: 4px;">
<div class="quoted-content" style="font-size: 13px;">
${email.content || '<p>No content available</p>'}
</div>
</blockquote>
</div>
`;
} else if (type === 'forward') {
// Create forward header
formattedContent = `
<div class="forwarded-message" style="margin-top: 20px;">
<div style="background-color: #f5f5f5; border-left: 3px solid #ddd; padding: 12px; margin-bottom: 15px; border-radius: 4px;">
<p style="margin: 0 0 8px 0; font-weight: 500; color: #555; font-size: 14px;">---------- Forwarded message ---------</p>
<p style="margin: 0 0 6px 0; font-size: 13px;"><span style="font-weight: 600; color: #444;">From:</span> ${email.fromName ? `${email.fromName} <${email.from}>` : email.from}</p>
<p style="margin: 0 0 6px 0; font-size: 13px;"><span style="font-weight: 600; color: #444;">Date:</span> ${formattedDate}</p>
<p style="margin: 0 0 6px 0; font-size: 13px;"><span style="font-weight: 600; color: #444;">Subject:</span> ${email.subject || ''}</p>
<p style="margin: 0 0 6px 0; font-size: 13px;"><span style="font-weight: 600; color: #444;">To:</span> ${email.to || ''}</p>
</div>
<div class="forwarded-content" style="border-left: 2px solid #ddd; padding-left: 15px; color: #333;">
${email.content || '<p>No content available</p>'}
</div>
</div>
`;
}
// Set state for compose form
setIsReplying(true);
setIsForwarding(type === 'forward');
setShowCompose(true);
const originalEmailContent = `
<div style="margin-top: 20px; border-top: 1px solid #e1e1e1; padding-top: 10px;">
${email.content}
</div>
`;
if (type === 'reply' || type === 'reply-all') {
setComposeTo(type === 'reply' ? email.from : `${email.from}; ${email.to}`);
setComposeSubject(email.subject.startsWith('Re:') ? email.subject : `Re: ${email.subject}`);
setComposeBody(originalEmailContent);
setComposeBody(formattedContent);
} else if (type === 'forward') {
setComposeTo('');
setComposeSubject(email.subject.startsWith('Fwd:') ? email.subject : `Fwd: ${email.subject}`);
setComposeBody(originalEmailContent);
setComposeBody(formattedContent);
}
};