From 8a6df706628073c848300946bdcfc35b753bbb9a Mon Sep 17 00:00:00 2001 From: alma Date: Mon, 21 Apr 2025 21:03:26 +0200 Subject: [PATCH] mail page fix design --- app/courrier/page.tsx | 26 +++++++++++--------------- components/ComposeEmail.tsx | 33 ++------------------------------- 2 files changed, 13 insertions(+), 46 deletions(-) diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx index d7341a89..f05d85d7 100644 --- a/app/courrier/page.tsx +++ b/app/courrier/page.tsx @@ -514,10 +514,6 @@ export default function CourrierPage() { const [isMarkingUnread, setIsMarkingUnread] = useState(false); const [isRefreshing, setIsRefreshing] = useState(false); const composeBodyRef = useRef(null); - const [originalEmail, setOriginalEmail] = useState<{ - content: string; - type: 'reply' | 'reply-all' | 'forward'; - } | null>(null); // Debug logging for email distribution useEffect(() => { @@ -1411,14 +1407,19 @@ export default function CourrierPage() { return subject.startsWith('Re:') ? subject : `Re: ${subject}`; }; - // Get the formatted original email content - const originalContent = getReplyBody(selectedEmail, type); + // Prepare the reply email + const replyEmail = { + to: getReplyTo(), + cc: getReplyCc(), + subject: getReplySubject(), + body: getReplyBody(selectedEmail, type) + }; // Update the compose form with the reply content - setComposeTo(getReplyTo()); - setComposeCc(getReplyCc()); - setComposeSubject(getReplySubject()); - setComposeBody(''); + setComposeTo(replyEmail.to); + setComposeCc(replyEmail.cc); + setComposeSubject(replyEmail.subject); + setComposeBody(replyEmail.body); setComposeBcc(''); // Show the compose form and CC field for Reply All @@ -1426,11 +1427,6 @@ export default function CourrierPage() { setShowCc(type === 'reply-all'); setShowBcc(false); setAttachments([]); - - // Pass the original email content to the compose modal - setOriginalEmail({ - content: originalContent, - type }; // Add the confirmation dialog component diff --git a/components/ComposeEmail.tsx b/components/ComposeEmail.tsx index 1be593ce..418dfc0c 100644 --- a/components/ComposeEmail.tsx +++ b/components/ComposeEmail.tsx @@ -1,6 +1,6 @@ 'use client'; -import { useRef, useEffect, useState } from 'react'; +import { useRef, useEffect } from 'react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; @@ -28,10 +28,6 @@ interface ComposeEmailProps { attachments: any[]; setAttachments: (attachments: any[]) => void; handleSend: () => Promise; - originalEmail?: { - content: string; - type: 'reply' | 'reply-all' | 'forward'; - }; } export default function ComposeEmail({ @@ -53,11 +49,9 @@ export default function ComposeEmail({ setShowBcc, attachments, setAttachments, - handleSend, - originalEmail + handleSend }: ComposeEmailProps) { const composeBodyRef = useRef(null); - const [showOriginalContent, setShowOriginalContent] = useState(true); useEffect(() => { if (composeBodyRef.current) { @@ -220,29 +214,6 @@ export default function ComposeEmail({ /> - {/* Original Email Content Preview */} - {originalEmail && showOriginalContent && ( -
-
-

- {originalEmail.type === 'forward' ? 'Forwarded Message' : 'Original Message'} -

- -
-
-
- )} - {/* Message Body */}