mail page ui correction maj compose 20 bis 4
This commit is contained in:
parent
7d3ab924fb
commit
1712924bcf
@ -477,58 +477,35 @@ export default function MailPage() {
|
|||||||
const filteredEmails = useMemo(() => {
|
const filteredEmails = useMemo(() => {
|
||||||
console.log('Current view:', currentView);
|
console.log('Current view:', currentView);
|
||||||
console.log('Total emails:', emails.length);
|
console.log('Total emails:', emails.length);
|
||||||
|
console.log('Selected account:', selectedAccount);
|
||||||
|
|
||||||
// Initialize counters for debugging
|
return emails.filter(email => {
|
||||||
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
|
|
||||||
});
|
|
||||||
|
|
||||||
switch (currentView) {
|
switch (currentView) {
|
||||||
case 'inbox':
|
case 'inbox':
|
||||||
return true; // Show all emails in inbox since it's working
|
return true; // Keep inbox as is 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);
|
|
||||||
|
|
||||||
case 'sent':
|
case 'sent':
|
||||||
// Check if the email is from the current account
|
// Check if the email is from our email address
|
||||||
const isSent = selectedAccount && email.from.includes(selectedAccount.email);
|
const userEmail = 'a.tmiri@governance-labs.org'; // This should match your email
|
||||||
if (isSent) sentCount++;
|
console.log('Checking sent email:', {
|
||||||
return isSent;
|
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':
|
case 'trash':
|
||||||
if (email.deleted) deletedCount++;
|
// For trash, check if deleted property exists and is true
|
||||||
// Consider an email deleted if it has the deleted property set to true
|
return email.deleted === true;
|
||||||
return Boolean(email.deleted);
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return true;
|
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]);
|
}, [emails, currentView, selectedAccount]);
|
||||||
|
|
||||||
// Move getSelectedEmail inside the component
|
// Move getSelectedEmail inside the component
|
||||||
@ -1120,12 +1097,6 @@ export default function MailPage() {
|
|||||||
<div className="p-4 border-b border-gray-100">
|
<div className="p-4 border-b border-gray-100">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex items-center gap-4">
|
<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">
|
<h2 className="text-lg font-semibold text-gray-800 capitalize">
|
||||||
{currentView}
|
{currentView}
|
||||||
</h2>
|
</h2>
|
||||||
@ -1151,6 +1122,10 @@ export default function MailPage() {
|
|||||||
{currentView === 'sent' && 'No sent emails'}
|
{currentView === 'sent' && 'No sent emails'}
|
||||||
{currentView === 'trash' && 'No emails in trash'}
|
{currentView === 'trash' && 'No emails in trash'}
|
||||||
</p>
|
</p>
|
||||||
|
{/* Add debug info */}
|
||||||
|
<p className="text-xs text-gray-400 mt-2">
|
||||||
|
Total emails: {emails.length}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="divide-y divide-gray-100">
|
<div className="divide-y divide-gray-100">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user