courrier correct panel 2 scroll up
This commit is contained in:
parent
41559a4d66
commit
d5ce9d5be1
@ -112,10 +112,10 @@ export default function CourrierPage() {
|
||||
const [prefetchStarted, setPrefetchStarted] = useState(false);
|
||||
const [showFolders, setShowFolders] = useState(true);
|
||||
|
||||
// Mock accounts for the sidebar
|
||||
// Email accounts for the sidebar
|
||||
const [accounts, setAccounts] = useState<Account[]>([
|
||||
{ id: 0, name: 'All', email: '', color: 'bg-gray-500' },
|
||||
{ id: 1, name: 'Mail', email: 'user@example.com', color: 'bg-blue-500', folders: mailboxes }
|
||||
{ id: 1, name: 'Loading...', email: '', color: 'bg-blue-500', folders: mailboxes }
|
||||
]);
|
||||
const [selectedAccount, setSelectedAccount] = useState<Account | null>(null);
|
||||
|
||||
@ -168,6 +168,20 @@ export default function CourrierPage() {
|
||||
console.log('Session initialized, prefetch status:', data.prefetchStarted ? 'running' : 'not started');
|
||||
setPrefetchStarted(Boolean(data.prefetchStarted));
|
||||
|
||||
// Update the accounts with the actual email address
|
||||
if (data.email) {
|
||||
setAccounts(prev => {
|
||||
const updated = [...prev];
|
||||
updated[1] = {
|
||||
...updated[1],
|
||||
name: data.email.split('@')[0] || 'Email',
|
||||
email: data.email,
|
||||
folders: mailboxes
|
||||
};
|
||||
return updated;
|
||||
});
|
||||
}
|
||||
|
||||
// Preload first page of emails for faster initial rendering
|
||||
if (session?.user?.id) {
|
||||
await loadEmails();
|
||||
@ -208,7 +222,7 @@ export default function CourrierPage() {
|
||||
return () => {
|
||||
isMounted = false;
|
||||
};
|
||||
}, [session?.user?.id, loadEmails, currentFolder]);
|
||||
}, [session?.user?.id, loadEmails, currentFolder, mailboxes]);
|
||||
|
||||
// Helper to get folder icons
|
||||
const getFolderIcon = (folder: string) => {
|
||||
@ -439,9 +453,17 @@ export default function CourrierPage() {
|
||||
<span className="font-medium text-gray-700">{account.name}</span>
|
||||
</div>
|
||||
{account.id !== 0 && (
|
||||
showFolders ?
|
||||
<ChevronDown className="h-3.5 w-3.5 text-gray-500" /> :
|
||||
<ChevronRight className="h-3.5 w-3.5 text-gray-500" />
|
||||
<div className="flex items-center">
|
||||
{account.email && (
|
||||
<span className="text-xs text-gray-400 mr-1 truncate max-w-[80px]">
|
||||
{account.email}
|
||||
</span>
|
||||
)}
|
||||
{showFolders ?
|
||||
<ChevronDown className="h-3.5 w-3.5 text-gray-500" /> :
|
||||
<ChevronRight className="h-3.5 w-3.5 text-gray-500" />
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
</Button>
|
||||
|
||||
@ -464,7 +486,7 @@ export default function CourrierPage() {
|
||||
<div className="flex items-center justify-between w-full gap-1.5">
|
||||
<div className="flex items-center gap-1.5">
|
||||
{React.createElement(getFolderIcon(folder), { className: "h-3.5 w-3.5" })}
|
||||
<span className="truncate">{folder}</span>
|
||||
<span className="truncate">{formatFolderName(folder)}</span>
|
||||
</div>
|
||||
{folder === 'INBOX' && unreadCount > 0 && (
|
||||
<span className="ml-auto bg-blue-600 text-white text-xs px-1.5 py-0.5 rounded-full text-[10px]">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user