courrier multi account restore compose

This commit is contained in:
alma 2025-04-29 10:13:44 +02:00
parent 7b4876b669
commit 42d2acdaf2

View File

@ -405,17 +405,20 @@ export default function CourrierPage() {
setAccounts(updatedAccounts); setAccounts(updatedAccounts);
console.log('[DEBUG] Updated accounts:', updatedAccounts); console.log('[DEBUG] Updated accounts:', updatedAccounts);
// Auto-select the first non-All account if available // Auto-select the first account if available
if (updatedAccounts.length > 1) { if (updatedAccounts.length > 0) {
console.log('Auto-selecting account:', updatedAccounts[1]); // Get first real account (not "All Accounts")
setSelectedAccount(updatedAccounts[1]); const firstAccount = updatedAccounts.length > 1 ? updatedAccounts[1] : updatedAccounts[0];
setShowFolders(true); console.log('Auto-selecting first account:', firstAccount);
// Set initial selected folder // Trigger account selection
setSelectedFolders(prev => ({ setTimeout(() => {
...prev, // Use the same account selection flow we use when user clicks
[updatedAccounts[1].id]: 'INBOX' if (firstAccount) {
})); // This will handle showing folders and loading emails
handleAccountSelect(firstAccount);
}
}, 200);
} }
} else { } else {
// User is authenticated but doesn't have email credentials // User is authenticated but doesn't have email credentials
@ -1053,7 +1056,7 @@ export default function CourrierPage() {
</DialogTitle> </DialogTitle>
<ComposeEmail <ComposeEmail
type={composeType} type={composeType}
initialEmail={composeType !== 'new' ? selectedEmail : undefined} initialEmail={composeType !== 'new' ? (selectedEmail as any) : undefined}
onSend={async (emailData) => { onSend={async (emailData) => {
try { try {
const result = await sendEmail(emailData); const result = await sendEmail(emailData);