@@ -288,7 +283,7 @@ function ReplyContent({ email, type }: { email: Email; type: 'reply' | 'reply-al
} else {
formattedContent = `
-
On ${formatDate(decoded.date)}, ${decoded.from || ''} wrote:
+
On ${formatDate(decoded.date ? new Date(decoded.date) : null)}, ${decoded.from || ''} wrote:
${decoded.html || `${decoded.text || ''}`}
@@ -313,7 +308,7 @@ function ReplyContent({ email, type }: { email: Email; type: 'reply' | 'reply-al
return () => {
mounted = false;
};
- }, [email.body, type]);
+ }, [email.content, type]);
if (error) {
return
{error}
;
@@ -336,14 +331,14 @@ function EmailPreview({ email }: { email: Email }) {
let mounted = true;
async function loadPreview() {
- if (!email?.body) {
+ if (!email?.content) {
if (mounted) setPreview('No content available');
return;
}
setIsLoading(true);
try {
- const decoded = await decodeEmail(email.body);
+ const decoded = await decodeEmail(email.content);
if (mounted) {
if (decoded.text) {
setPreview(decoded.text.substring(0, 150) + '...');
@@ -371,7 +366,7 @@ function EmailPreview({ email }: { email: Email }) {
return () => {
mounted = false;
};
- }, [email?.body]);
+ }, [email?.content]);
if (isLoading) {
return
Loading preview...;
@@ -1078,45 +1073,51 @@ export default function CourrierPage() {
}, [availableFolders]);
// Update the email list item to match header checkbox alignment
- const renderEmailListItem = (email: Email) => {
- return (
-
handleEmailSelect(email.id)}
- >
+ const renderEmailListItem = (email: Email) => (
+
handleEmailSelect(email.id)}
+ >
+
{
- const e = { target: { checked }, stopPropagation: () => {} } as React.ChangeEvent;
- handleEmailCheckbox(e, email.id);
- }}
+ checked={selectedEmails.includes(email.id)}
+ onCheckedChange={(checked) => toggleEmailSelection(email.id)}
onClick={(e) => e.stopPropagation()}
className="mt-0.5"
/>
-
-
-
-
- {email.fromName || email.from}
-
-
-
- {formatDate(new Date(email.date))}
-
-
-
- {email.subject || '(No subject)'}
-
-
- {generateEmailPreview(email)}
-
-
- );
- };
+
+
+
+
+ {email.fromName || email.from}
+
+ {!email.read && (
+
+ )}
+
+
+ {formatDate(new Date(email.date))}
+
+
+
+ {email.subject || '(No subject)'}
+
+
+
+
+ {email.starred && (
+
+ )}
+ {email.attachments && email.attachments.length > 0 && (
+
+ )}
+
+
+ );
const handleMailboxChange = async (newMailbox: string) => {
setCurrentView(newMailbox);
@@ -1355,6 +1356,14 @@ export default function CourrierPage() {
);
+ const toggleEmailSelection = (emailId: string) => {
+ setSelectedEmails((prev) =>
+ prev.includes(emailId)
+ ? prev.filter((id) => id !== emailId)
+ : [...prev, emailId]
+ );
+ };
+
if (error) {
return (