From ca93e4bc26e3decaf66ab7ae0f9d86178118091e Mon Sep 17 00:00:00 2001 From: alma Date: Fri, 25 Apr 2025 19:28:40 +0200 Subject: [PATCH] panel 2 courier api restore --- app/courrier/page.tsx | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx index 9ea17908..6b216e3d 100644 --- a/app/courrier/page.tsx +++ b/app/courrier/page.tsx @@ -425,8 +425,8 @@ export default function CourrierPage() { const { data: session } = useSession(); const [loading, setLoading] = useState(true); const [accounts, setAccounts] = useState([ - { id: 0, name: 'All', email: '', color: 'bg-gray-500' }, - { id: 1, name: 'Mail', email: 'alma@governance-labs.org', color: 'bg-blue-500' } + { id: 0, name: 'All', email: '', color: 'bg-gray-400' }, + { id: 1, name: '', email: '', color: 'bg-blue-500' } ]); const [selectedAccount, setSelectedAccount] = useState(null); const [currentView, setCurrentView] = useState('INBOX'); @@ -648,6 +648,17 @@ export default function CourrierPage() { loadInitialData(); }, [router, currentView, page, emailsPerPage]); + // At the initialization, update the account with the email from session + useEffect(() => { + if (session?.user?.email) { + setAccounts(prev => prev.map(account => + account.id === 1 + ? { ...account, name: session.user.email, email: session.user.email } + : account + )); + } + }, [session?.user?.email]); + // Get account color const getAccountColor = (accountId: number) => { const account = accounts.find(acc => acc.id === accountId); @@ -1751,18 +1762,17 @@ export default function CourrierPage() {
- {account.name} + {account.name || 'Mail Account'}
- {account.email} + {account.id !== 0 && account.email && ( + {account.email} + )}
- {/* Show folders for email accounts (not for "All" account) */} + {/* Show folders for email accounts (not for "All" account) without the "Folders" header */} {account.id !== 0 && (
-
- Folders -
{account.folders && account.folders.length > 0 ? ( account.folders.map((folder) => (