diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx index 41d607d6..a744df28 100644 --- a/app/courrier/page.tsx +++ b/app/courrier/page.tsx @@ -133,6 +133,9 @@ export default function CourrierPage() { ]); const [selectedAccount, setSelectedAccount] = useState(null); + // Track expanded folders for each account + const [expandedAccounts, setExpandedAccounts] = useState>({}); + // Update account folders when mailboxes change - update this to maintain account IDs useEffect(() => { console.log('Mailboxes updated:', mailboxes); @@ -678,57 +681,74 @@ export default function CourrierPage() { {/* Display all accounts */}
{accounts.map((account) => ( - - ))} -
- - - {/* Folders Section - Always Display */} -
- {/* Display folders if available */} - {selectedAccount?.folders?.map((folder) => ( - + )} +
+ + + {/* Show folders for this account if expanded */} + {expandedAccounts[account.id] && account.id !== 'all-accounts' && account.folders && ( +
+ {account.folders.map((folder) => ( + + ))} +
)} - - ))} - - {/* Fallback if no folders */} - {(!selectedAccount?.folders || selectedAccount.folders.length === 0) && ( -
- No folders available for this account. -
- )} + ))} +