courrier refactor rebuild 2
This commit is contained in:
parent
de728b9139
commit
c92f593caa
@ -16,7 +16,6 @@ import ComposeEmailHeader from './ComposeEmailHeader';
|
|||||||
import ComposeEmailForm from './ComposeEmailForm';
|
import ComposeEmailForm from './ComposeEmailForm';
|
||||||
import ComposeEmailFooter from './ComposeEmailFooter';
|
import ComposeEmailFooter from './ComposeEmailFooter';
|
||||||
import RichEmailEditor from './RichEmailEditor';
|
import RichEmailEditor from './RichEmailEditor';
|
||||||
import QuotedEmailContent from './QuotedEmailContent';
|
|
||||||
|
|
||||||
// Import ONLY from the centralized formatter
|
// Import ONLY from the centralized formatter
|
||||||
import {
|
import {
|
||||||
@ -100,38 +99,6 @@ function isLegacyProps(
|
|||||||
return 'showCompose' in props;
|
return 'showCompose' in props;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function to adapt EmailMessage to QuotedEmailContent props format
|
|
||||||
function EmailMessageToQuotedContentAdapter({
|
|
||||||
email,
|
|
||||||
type
|
|
||||||
}: {
|
|
||||||
email: EmailMessage,
|
|
||||||
type: 'reply' | 'reply-all' | 'forward'
|
|
||||||
}) {
|
|
||||||
// Get the email content
|
|
||||||
const content = email.content || email.html || email.text || '';
|
|
||||||
|
|
||||||
// Get the sender
|
|
||||||
const sender = email.from && email.from.length > 0
|
|
||||||
? {
|
|
||||||
name: email.from[0].name,
|
|
||||||
email: email.from[0].address
|
|
||||||
}
|
|
||||||
: { email: 'unknown@example.com' };
|
|
||||||
|
|
||||||
// Map the type to what QuotedEmailContent expects
|
|
||||||
const mappedType = type === 'reply-all' ? 'reply' : type;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<QuotedEmailContent
|
|
||||||
content={content}
|
|
||||||
sender={sender}
|
|
||||||
date={email.date}
|
|
||||||
type={mappedType}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function ComposeEmail(props: ComposeEmailAllProps) {
|
export default function ComposeEmail(props: ComposeEmailAllProps) {
|
||||||
// Handle legacy props by adapting them to new component
|
// Handle legacy props by adapting them to new component
|
||||||
if (isLegacyProps(props)) {
|
if (isLegacyProps(props)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user