- {emails.map((email) => renderEmailListItem(email))}
- {isLoadingMore && (
-
-
+ {/* 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
)}
@@ -1220,47 +1372,47 @@ export default function MailPage() {
return (
<>
{/* Main layout */}
-
- {/* Sidebar */}
+
+ {/* Sidebar */}
- {/* Courrier Title */}
-
-
- {/* Compose button and refresh button */}
-
-
+
+ {/* Compose button and refresh button */}
+
+
{
+ setShowCompose(true);
+ setComposeTo('');
+ setComposeCc('');
+ setComposeBcc('');
+ setComposeSubject('');
+ setComposeBody('');
+ setShowCc(false);
+ setShowBcc(false);
+ }}
+ >
+
+
+
loadEmails()}
+ className="text-gray-600 hover:text-gray-900 hover:bg-gray-100"
+ >
+
+
+
{/* Accounts Section */}
@@ -1289,7 +1441,7 @@ export default function MailPage() {
{account.email}
-
+
))}
@@ -1298,153 +1450,14 @@ export default function MailPage() {
{/* Navigation */}
{renderSidebarNav()}
-