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