courrier multi account restore compose

This commit is contained in:
alma 2025-04-28 17:13:54 +02:00
parent 091f915f8f
commit 37aa5aded9

View File

@ -383,6 +383,12 @@ export default function CourrierPage() {
// Add all accounts from the API response // Add all accounts from the API response
data.allAccounts.forEach((account: any) => { data.allAccounts.forEach((account: any) => {
console.log('[DEBUG] Processing account:', {
id: account.id,
email: account.email,
folders: account.folders
});
const accountFolders = (account.folders && Array.isArray(account.folders)) const accountFolders = (account.folders && Array.isArray(account.folders))
? account.folders ? account.folders
: ['INBOX', 'Sent', 'Drafts', 'Trash', 'Junk']; : ['INBOX', 'Sent', 'Drafts', 'Trash', 'Junk'];
@ -394,7 +400,11 @@ export default function CourrierPage() {
color: account.color || 'bg-blue-500', color: account.color || 'bg-blue-500',
folders: accountFolders folders: accountFolders
}); });
console.log(`[DEBUG] Added account: ${account.email} with ID ${account.id}`); console.log(`[DEBUG] Added account with folders:`, {
id: account.id,
email: account.email,
folders: accountFolders
});
}); });
} else { } else {
// Fallback to single account if allAccounts is not available // Fallback to single account if allAccounts is not available
@ -1021,11 +1031,22 @@ export default function CourrierPage() {
</Button> </Button>
{/* Show folders for this account if expanded */} {/* Show folders for this account if expanded */}
{expandedAccounts[account.id] && account.id !== 'all-accounts' && account.folders && ( {(() => {
<div className="pl-4"> const isExpanded = expandedAccounts[account.id];
{account.folders.map((folder) => renderFolderButton(folder, account.id))} const hasFolders = account.folders && account.folders.length > 0;
</div> console.log('[DEBUG] Folder rendering check:', {
)} accountId: account.id,
isExpanded,
hasFolders,
folders: account.folders
});
return isExpanded && account.id !== 'all-accounts' && hasFolders && (
<div className="pl-4">
{account.folders.map((folder) => renderFolderButton(folder, account.id))}
</div>
);
})()}
</div> </div>
))} ))}
</div> </div>