From 1712924bcff58ae65ea6e8f777bc692eae4ca623 Mon Sep 17 00:00:00 2001 From: alma Date: Wed, 16 Apr 2025 14:00:08 +0200 Subject: [PATCH] mail page ui correction maj compose 20 bis 4 --- app/mail/page.tsx | 67 +++++++++++++++-------------------------------- 1 file changed, 21 insertions(+), 46 deletions(-) diff --git a/app/mail/page.tsx b/app/mail/page.tsx index ce4629f..9608ef1 100644 --- a/app/mail/page.tsx +++ b/app/mail/page.tsx @@ -477,58 +477,35 @@ export default function MailPage() { const filteredEmails = useMemo(() => { console.log('Current view:', currentView); console.log('Total emails:', emails.length); + console.log('Selected account:', selectedAccount); - // Initialize counters for debugging - let starredCount = 0; - let sentCount = 0; - let deletedCount = 0; - - const filtered = emails.filter(email => { - // Log each email for debugging - console.log('Processing email:', { - id: email.id, - category: email.category, - from: email.from, - starred: email.starred, - deleted: email.deleted - }); - + return emails.filter(email => { switch (currentView) { case 'inbox': - return true; // Show all emails in inbox since it's working - - case 'starred': - if (email.starred) starredCount++; - // Consider an email starred if it has the starred property set to true - return Boolean(email.starred); + return true; // Keep inbox as is since it's working case 'sent': - // Check if the email is from the current account - const isSent = selectedAccount && email.from.includes(selectedAccount.email); - if (isSent) sentCount++; - return isSent; + // Check if the email is from our email address + const userEmail = 'a.tmiri@governance-labs.org'; // This should match your email + console.log('Checking sent email:', { + from: email.from, + userEmail: userEmail, + isSent: email.from.includes(userEmail) + }); + return email.from.toLowerCase().includes(userEmail.toLowerCase()); + + case 'starred': + // For starred emails, check if starred property exists and is true + return email.starred === true; case 'trash': - if (email.deleted) deletedCount++; - // Consider an email deleted if it has the deleted property set to true - return Boolean(email.deleted); + // For trash, check if deleted property exists and is true + return email.deleted === true; default: return true; } }); - - // Log the results for debugging - console.log('Filter results:', { - view: currentView, - total: emails.length, - filtered: filtered.length, - starredCount, - sentCount, - deletedCount - }); - - return filtered; }, [emails, currentView, selectedAccount]); // Move getSelectedEmail inside the component @@ -1120,12 +1097,6 @@ export default function MailPage() {
- {emails.length > 0 && ( - - )}

{currentView}

@@ -1151,6 +1122,10 @@ export default function MailPage() { {currentView === 'sent' && 'No sent emails'} {currentView === 'trash' && 'No emails in trash'}

+ {/* Add debug info */} +

+ Total emails: {emails.length} +

) : (