mail page ui correction maj compose 2
This commit is contained in:
parent
2fc6b6bb60
commit
6d97a4ee34
@ -404,6 +404,11 @@ const decodeEmailContent = (content: string, charset: string = 'utf-8') => {
|
||||
return convertCharset(content, charset);
|
||||
};
|
||||
|
||||
// Add this with your other functions
|
||||
const getSelectedEmail = () => {
|
||||
return emails.find(email => email.id === selectedEmail?.id);
|
||||
};
|
||||
|
||||
export default function MailPage() {
|
||||
const router = useRouter();
|
||||
const [loading, setLoading] = useState(true);
|
||||
@ -1051,7 +1056,6 @@ export default function MailPage() {
|
||||
{showCompose && (
|
||||
<div className="fixed inset-0 bg-black/50 z-50">
|
||||
<div className="absolute inset-4 sm:inset-6 md:inset-8 bg-white rounded-lg shadow-xl flex flex-col">
|
||||
{/* Modal Header */}
|
||||
<div className="flex items-center justify-between p-4 border-b">
|
||||
<h2 className="text-lg font-semibold">
|
||||
{composeSubject.startsWith('Re:') ? 'Reply' :
|
||||
@ -1075,10 +1079,8 @@ export default function MailPage() {
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* Modal Body */}
|
||||
<div className="p-4 flex-1 overflow-y-auto">
|
||||
<div className="space-y-4">
|
||||
{/* Recipients */}
|
||||
<div>
|
||||
<Label htmlFor="to">To</Label>
|
||||
<Input
|
||||
@ -1090,7 +1092,6 @@ export default function MailPage() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* CC/BCC Controls */}
|
||||
<div className="flex items-center gap-2">
|
||||
<Button
|
||||
type="button"
|
||||
@ -1128,7 +1129,6 @@ export default function MailPage() {
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Subject */}
|
||||
<div>
|
||||
<Label htmlFor="subject">Subject</Label>
|
||||
<Input
|
||||
@ -1139,7 +1139,6 @@ export default function MailPage() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Message Body */}
|
||||
<div>
|
||||
<Label htmlFor="body">Message</Label>
|
||||
<Textarea
|
||||
@ -1151,7 +1150,6 @@ export default function MailPage() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Attachments */}
|
||||
<div>
|
||||
<Label>Attachments</Label>
|
||||
<div className="mt-2 flex items-center gap-2">
|
||||
@ -1181,7 +1179,6 @@ export default function MailPage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Modal Footer */}
|
||||
<div className="p-4 border-t flex justify-end gap-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
@ -1200,7 +1197,6 @@ export default function MailPage() {
|
||||
<Button
|
||||
onClick={async () => {
|
||||
try {
|
||||
// Send email
|
||||
const response = await fetch('/api/mail/send', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@ -1219,7 +1215,6 @@ export default function MailPage() {
|
||||
throw new Error('Failed to send email');
|
||||
}
|
||||
|
||||
// Clear form and close modal
|
||||
setShowCompose(false);
|
||||
setComposeTo('');
|
||||
setComposeSubject('');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user