From 945083b9ee3e393628658afdd501ab9a9141e2fc Mon Sep 17 00:00:00 2001 From: alma Date: Wed, 16 Apr 2025 13:35:49 +0200 Subject: [PATCH] mail page ui correction maj compose 18 --- app/mail/page.tsx | 974 +++++++++++++++++++++++++++------------------- 1 file changed, 569 insertions(+), 405 deletions(-) diff --git a/app/mail/page.tsx b/app/mail/page.tsx index 524e0c4..a9ca033 100644 --- a/app/mail/page.tsx +++ b/app/mail/page.tsx @@ -910,430 +910,594 @@ export default function MailPage() { } return ( -
- {/* Sidebar - make it narrower */} -
- {/* Courrier Title */} -
-
-
- - COURRIER -
- -
-
- - {/* Compose button */} -
- -
- - {/* Accounts Section */} -
- - - {accountsDropdownOpen && ( -
- {accounts.map(account => ( - - ))} -
- )} -
- - {/* Folder Management Section */} -
- - - {foldersDropdownOpen && ( -
- {folders.map((folder) => ( - - ))} - -
- )} -
- - {/* Navigation */} - -
- - {/* Main content area */} -
- {/* Email list panel */} -
- {/* Email list header */} -
+ <> + {/* Main layout */} +
+ {/* Sidebar - make it narrower */} +
+ {/* Courrier Title */} +
- {emails.length > 0 && ( - - )} - - {filteredEmails.length} emails - + + COURRIER
+
- {/* Email list with proper spacing and layout */} -
- {loading ? ( -
-
+ {/* Compose button */} +
+ -
-
+ +
- {/* Email subject and preview */} -
-

- {email.subject} -

-

- {email.body.replace(/<[^>]*>/g, '').substring(0, 100)}... -

+ {/* Accounts Section */} +
+ + + {accountsDropdownOpen && ( +
+ {accounts.map(account => ( +
+ ))}
)}
+ + {/* Folder Management Section */} +
+ + + {foldersDropdownOpen && ( +
+ {folders.map((folder) => ( + + ))} + +
+ )} +
+ + {/* Navigation */} +
- {/* Preview panel - will automatically take remaining space */} -
- {selectedEmail ? ( - <> - {/* Email actions header */} -
-
-
- -

- {selectedEmail.subject} -

-
-
- - - - - - -
+ {/* Main content area */} +
+ {/* Email list panel */} +
+ {/* Email list header */} +
+
+
+ {emails.length > 0 && ( + + )} + + {filteredEmails.length} emails +
- - {/* Scrollable content area */} - -
- - - {selectedEmail.fromName?.charAt(0) || selectedEmail.from.charAt(0)} - - -
-

- {selectedEmail.fromName || selectedEmail.from} -

-

- to {selectedEmail.to} -

-
-
- {formatDate(selectedEmail.date)} -
-
- -
- {(() => { - try { - const parsed = parseFullEmail(selectedEmail.body); - return ( -
- {/* Display HTML content if available, otherwise fallback to text */} -
- - {/* Display attachments if present */} - {parsed.attachments && parsed.attachments.length > 0 && ( -
-

Attachments

-
- {parsed.attachments.map((attachment, index) => ( -
- - - {attachment.filename} - -
- ))} -
-
- )} -
- ); - } catch (e) { - console.error('Error parsing email:', e); - return selectedEmail.body; - } - })()} -
- - - ) : ( -
- -

Select an email to view its contents

- )} + + {/* Email list with proper spacing and layout */} +
+ {loading ? ( +
+
+
+ ) : ( +
+ {filteredEmails.map((email) => ( +
handleEmailSelect(email.id)} + > + {/* Email header with checkbox and date */} +
+
+ e.stopPropagation()} + onCheckedChange={(checked) => { + if (checked) { + setSelectedEmails([...selectedEmails, email.id.toString()]); + } else { + setSelectedEmails(selectedEmails.filter(id => id !== email.id.toString())); + } + }} + /> + + {email.fromName || email.from} + +
+
+ + {formatDate(email.date)} + + +
+
+ + {/* Email subject and preview */} +
+

+ {email.subject} +

+

+ {email.body.replace(/<[^>]*>/g, '').substring(0, 100)}... +

+
+
+ ))} +
+ )} +
+
+ + {/* Preview panel - will automatically take remaining space */} +
+ {selectedEmail ? ( + <> + {/* Email actions header */} +
+
+
+ +

+ {selectedEmail.subject} +

+
+
+ + + + + + +
+
+
+ + {/* Scrollable content area */} + +
+ + + {selectedEmail.fromName?.charAt(0) || selectedEmail.from.charAt(0)} + + +
+

+ {selectedEmail.fromName || selectedEmail.from} +

+

+ to {selectedEmail.to} +

+
+
+ {formatDate(selectedEmail.date)} +
+
+ +
+ {(() => { + try { + const parsed = parseFullEmail(selectedEmail.body); + return ( +
+ {/* Display HTML content if available, otherwise fallback to text */} +
+ + {/* Display attachments if present */} + {parsed.attachments && parsed.attachments.length > 0 && ( +
+

Attachments

+
+ {parsed.attachments.map((attachment, index) => ( +
+ + + {attachment.filename} + +
+ ))} +
+
+ )} +
+ ); + } catch (e) { + console.error('Error parsing email:', e); + return selectedEmail.body; + } + })()} +
+ + + ) : ( +
+ +

Select an email to view its contents

+
+ )} +
-
+ + {/* Compose Email Modal */} + {showCompose && ( +
+
+ {/* Modal Header */} +
+

+ {composeSubject.startsWith('Re:') ? 'Reply' : + composeSubject.startsWith('Fwd:') ? 'Forward' : 'New Message'} +

+ +
+ + {/* Modal Body */} +
+
+ {/* To Field */} +
+ + setComposeTo(e.target.value)} + placeholder="recipient@example.com" + className="w-full mt-1 bg-white border-gray-300 text-gray-900" + /> +
+ + {/* CC/BCC Toggle Buttons */} +
+ + +
+ + {/* CC Field */} + {showCc && ( +
+ + setComposeCc(e.target.value)} + placeholder="cc@example.com" + className="w-full mt-1 bg-white border-gray-300 text-gray-900" + /> +
+ )} + + {/* BCC Field */} + {showBcc && ( +
+ + setComposeBcc(e.target.value)} + placeholder="bcc@example.com" + className="w-full mt-1 bg-white border-gray-300 text-gray-900" + /> +
+ )} + + {/* Subject Field */} +
+ + setComposeSubject(e.target.value)} + placeholder="Enter subject" + className="w-full mt-1 bg-white border-gray-300 text-gray-900" + /> +
+ + {/* Message Body */} +
+ +