diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx index ce09e6ba..d8e3426d 100644 --- a/app/courrier/page.tsx +++ b/app/courrier/page.tsx @@ -164,7 +164,6 @@ export default function CourrierPage() { // Email accounts for the sidebar const [accounts, setAccounts] = useState([ - { id: 'all-accounts', name: 'All', email: '', color: 'bg-gray-500', folders: [] }, { id: 'loading-account', name: 'Loading...', email: '', color: 'bg-blue-500', folders: [] } ]); const [selectedAccount, setSelectedAccount] = useState(null); @@ -222,7 +221,7 @@ export default function CourrierPage() { // Initialize counts for all accounts and folders accounts.forEach(account => { - if (account.id !== 'all-accounts' && account.id !== 'loading-account') { + if (account.id !== 'loading-account') { const folderCounts = new Map(); account.folders.forEach(folder => { folderCounts.set(folder, 0); @@ -247,7 +246,7 @@ export default function CourrierPage() { }); // Update the unread count for the selected account and folder - if (selectedAccount && selectedAccount.id !== 'all-accounts') { + if (selectedAccount && selectedAccount.id !== 'loading-account') { const folderCounts = accountFolderUnreadCounts.get(selectedAccount.id); if (folderCounts) { setUnreadCount(folderCounts.get(currentFolder) || 0); @@ -255,7 +254,7 @@ export default function CourrierPage() { setUnreadCount(0); } } else { - // For 'all-accounts', sum up all unread counts for the current folder + // For 'loading-account', sum up all unread counts for the current folder let totalUnread = 0; accountFolderUnreadCounts.forEach((folderCounts: Map) => { totalUnread += folderCounts.get(currentFolder) || 0; @@ -280,7 +279,6 @@ export default function CourrierPage() { if (!accounts || accounts.length === 0) { console.warn('Accounts array is empty, restoring defaults'); setAccounts([ - { id: 'all-accounts', name: 'All', email: '', color: 'bg-gray-500', folders: mailboxes }, { id: 'loading-account', name: 'Loading...', email: '', color: 'bg-blue-500', folders: mailboxes } ]); } @@ -363,7 +361,7 @@ export default function CourrierPage() { console.log('Session initialized, prefetch status:', data.prefetchStarted ? 'running' : 'not started'); setPrefetchStarted(Boolean(data.prefetchStarted)); - let updatedAccounts: Account[] = [{ id: 'all-accounts', name: 'All', email: '', color: 'bg-gray-500', folders: [] }]; + let updatedAccounts: Account[] = []; // Check if we have multiple accounts returned if (data.allAccounts && Array.isArray(data.allAccounts) && data.allAccounts.length > 0) { @@ -595,7 +593,7 @@ export default function CourrierPage() { // Update handleMailboxChange to properly handle per-account folders const handleMailboxChange = (folder: string, accountId?: string) => { - if (accountId && accountId !== 'all-accounts') { + if (accountId && accountId !== 'loading-account') { const account = accounts.find(a => a.id === accountId); if (!account) { @@ -728,7 +726,7 @@ export default function CourrierPage() { const handleAccountSelect = (account: Account) => { setSelectedAccount(account); setShowFolders(true); - if (account.id !== 'all-accounts') { + if (account.id !== 'loading-account') { setExpandedAccounts(prev => ({ ...prev, [account.id]: true @@ -1049,7 +1047,7 @@ export default function CourrierPage() {
{account.name} {/* More options button */} - {account.id !== 'all-accounts' && ( + {account.id !== 'loading-account' && (