mail page fix design

This commit is contained in:
alma 2025-04-21 21:03:26 +02:00
parent 384a6da21e
commit 8a6df70662
2 changed files with 13 additions and 46 deletions

View File

@ -514,10 +514,6 @@ export default function CourrierPage() {
const [isMarkingUnread, setIsMarkingUnread] = useState(false);
const [isRefreshing, setIsRefreshing] = useState(false);
const composeBodyRef = useRef<HTMLDivElement>(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

View File

@ -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<void>;
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<HTMLDivElement>(null);
const [showOriginalContent, setShowOriginalContent] = useState(true);
useEffect(() => {
if (composeBodyRef.current) {
@ -220,29 +214,6 @@ export default function ComposeEmail({
/>
</div>
{/* Original Email Content Preview */}
{originalEmail && showOriginalContent && (
<div className="border rounded-md p-4 bg-gray-50">
<div className="flex items-center justify-between mb-2">
<h4 className="text-sm font-medium text-gray-700">
{originalEmail.type === 'forward' ? 'Forwarded Message' : 'Original Message'}
</h4>
<Button
variant="ghost"
size="sm"
onClick={() => setShowOriginalContent(false)}
className="text-gray-500 hover:text-gray-700"
>
<X className="h-4 w-4" />
</Button>
</div>
<div
className="prose max-w-none text-sm text-gray-600"
dangerouslySetInnerHTML={{ __html: originalEmail.content }}
/>
</div>
)}
{/* Message Body */}
<div className="flex-1">
<Label htmlFor="message" className="block text-sm font-medium text-gray-700">Message</Label>