diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx index 89531ae5..25d5576b 100644 --- a/app/courrier/page.tsx +++ b/app/courrier/page.tsx @@ -64,8 +64,8 @@ function SimplifiedLoadingFix() { ); } -interface Account { - id: number; +interface SidebarAccount { + id: number | string; name: string; email: string; color: string; @@ -119,11 +119,11 @@ export default function CourrierPage() { const [showAddAccountForm, setShowAddAccountForm] = useState(false); // Email accounts for the sidebar - const [accounts, setAccounts] = useState([ + const [accounts, setAccounts] = useState([ { id: 0, name: 'All', email: '', color: 'bg-gray-500' }, { id: 1, name: 'Loading...', email: '', color: 'bg-blue-500', folders: mailboxes } ]); - const [selectedAccount, setSelectedAccount] = useState(null); + const [selectedAccount, setSelectedAccount] = useState(null); // Update account folders when mailboxes change useEffect(() => { @@ -148,8 +148,10 @@ export default function CourrierPage() { // Example: counting unread emails in the inbox const unreadInInbox = (emails || []).filter(email => { // Access the 'read' property safely, handling both old and new email formats - return (!email.read && email.read !== undefined) || - (email.flags && !email.flags.seen) || + // Use type assertion to avoid TypeScript errors + const emailAny = email as any; + return (!emailAny.read && emailAny.read !== undefined) || + (emailAny.flags && !emailAny.flags.seen) || false; }).filter(email => currentFolder === 'INBOX').length; setUnreadCount(unreadInInbox); @@ -220,7 +222,7 @@ export default function CourrierPage() { console.log('Multiple accounts found:', data.allAccounts.length); // Add each account from the server - data.allAccounts.forEach((account, index) => { + data.allAccounts.forEach((account: { id?: string | number, email: string, display_name?: string, color?: string }, index: number) => { console.log(`[DEBUG] Processing account: ${account.email}, display_name: ${account.display_name}, has folders: ${!!data.mailboxes}`); const accountWithFolders = { @@ -789,98 +791,4 @@ export default function CourrierPage() { variant="ghost" className={`w-full justify-start text-sm py-1 px-2 ${ currentView === 'starred' ? 'bg-gray-100 text-gray-900' : 'text-gray-600 hover:text-gray-900' - }`} - onClick={() => handleMailboxChange('starred')} - > -
- - Starred -
- - - - - - - {/* Email List and Content View */} -
- {/* Email List */} - - - {/* Email Content View */} -
- {selectedEmail ? ( - handleEmailSelect('')} - onReply={handleReply} - onReplyAll={handleReplyAll} - onForward={handleForward} - onToggleStar={() => toggleStarred(selectedEmail.id)} - /> - ) : ( -
- -

Select an email to read

-

- Choose an email from the list or compose a new message to get started. -

- -
- )} -
-
- - - - - {/* Login needed alert */} - setShowLoginNeeded(false)} - /> - - {/* Compose Modal */} - {showComposeModal && ( - setShowComposeModal(false)} - onSend={async (emailData: EmailData) => { - await sendEmail(emailData); - }} - /> - )} - - {/* Delete Confirmation Dialog */} - setShowDeleteConfirm(false)} - /> - - ); -} \ No newline at end of file + }` \ No newline at end of file