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