courrier clean 2
This commit is contained in:
parent
9fba1ac1c3
commit
34d2aed721
@ -1678,6 +1678,14 @@ export default function CourrierPage() {
|
||||
// Set state for compose form
|
||||
setIsReplying(true);
|
||||
setIsForwarding(type === 'forward');
|
||||
|
||||
// Set original email content for LegacyAdapter
|
||||
setOriginalEmail({
|
||||
content: formattedContent,
|
||||
type: type
|
||||
});
|
||||
|
||||
// Show compose form with formatted content
|
||||
setShowCompose(true);
|
||||
|
||||
if (type === 'reply' || type === 'reply-all') {
|
||||
|
||||
@ -777,17 +777,45 @@ function LegacyAdapter({
|
||||
}));
|
||||
};
|
||||
|
||||
// Create an EmailMessage compatible object from composeBody
|
||||
// This is crucial for displaying original content in replies/forwards
|
||||
const createEmailMessageFromContent = (): EmailMessage | null => {
|
||||
const type = determineType();
|
||||
|
||||
// Only create an email object if we're replying or forwarding
|
||||
if (type === 'new' || !composeBody) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Create a minimal EmailMessage object with the necessary fields
|
||||
return {
|
||||
id: 'temp-id',
|
||||
messageId: '',
|
||||
subject: composeSubject,
|
||||
from: [{ name: '', address: '' }],
|
||||
to: [{ name: '', address: '' }],
|
||||
date: new Date(),
|
||||
content: composeBody,
|
||||
html: composeBody,
|
||||
hasAttachments: false
|
||||
};
|
||||
};
|
||||
|
||||
// If not showing compose, return null
|
||||
if (!showCompose) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Create email message from content if available
|
||||
const emailForCompose = createEmailMessageFromContent();
|
||||
const type = determineType();
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 bg-gray-600/30 backdrop-blur-sm z-50 flex items-center justify-center">
|
||||
<div className="w-full max-w-2xl max-h-[90vh] bg-white rounded-xl shadow-xl overflow-auto mx-4">
|
||||
<ComposeEmail
|
||||
initialEmail={null} // Not using initialEmail directly
|
||||
type={determineType()}
|
||||
initialEmail={emailForCompose}
|
||||
type={type}
|
||||
onClose={() => {
|
||||
onCancel?.();
|
||||
setShowCompose(false);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user