mail page ui correction maj compose 20 bis 4

This commit is contained in:
alma 2025-04-16 14:00:08 +02:00
parent 7d3ab924fb
commit 1712924bcf

View File

@ -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() {
<div className="p-4 border-b border-gray-100">
<div className="flex items-center justify-between">
<div className="flex items-center gap-4">
{emails.length > 0 && (
<Checkbox
checked={selectedEmails.length === emails.length}
onCheckedChange={toggleSelectAll}
/>
)}
<h2 className="text-lg font-semibold text-gray-800 capitalize">
{currentView}
</h2>
@ -1151,6 +1122,10 @@ export default function MailPage() {
{currentView === 'sent' && 'No sent emails'}
{currentView === 'trash' && 'No emails in trash'}
</p>
{/* Add debug info */}
<p className="text-xs text-gray-400 mt-2">
Total emails: {emails.length}
</p>
</div>
) : (
<div className="divide-y divide-gray-100">