panel 2 courier api restore

This commit is contained in:
alma 2025-04-25 19:18:26 +02:00
parent 84713f4630
commit 7ca22e9de8

View File

@ -271,15 +271,8 @@ const getFolderIcon = (folder: string) => {
} }
}; };
// Initial sidebar items - only INBOX // Update the initialSidebarItems to be empty since we're using folders under Accounts now
const initialSidebarItems = [ const initialSidebarItems: any[] = []; // Remove the default Inbox item
{
view: 'INBOX' as MailFolder,
label: 'Inbox',
icon: Inbox,
folder: 'INBOX'
}
];
function formatDate(date: Date | null): string { function formatDate(date: Date | null): string {
if (!date) return ''; if (!date) return '';
@ -1241,37 +1234,44 @@ export default function CourrierPage() {
} }
}; };
// Fix the sidebar navigation without the folders section and divider // Update the renderSidebarNav function to handle empty items or display other navigation options
const renderSidebarNav = () => ( const renderSidebarNav = () => (
<nav className="p-3"> <nav className="p-3">
<ul className="space-y-0.5 px-2"> {sidebarItems.length > 0 ? (
{sidebarItems.map((item) => ( <ul className="space-y-0.5 px-2">
<li key={item.view}> {sidebarItems.map((item) => (
<Button <li key={item.view}>
variant={currentView === item.view ? 'secondary' : 'ghost'} <Button
className={`w-full justify-start py-2 ${ variant={currentView === item.view ? 'secondary' : 'ghost'}
currentView === item.view ? 'bg-gray-100 text-gray-900' : 'text-gray-600 hover:text-gray-900' className={`w-full justify-start py-2 ${
}`} currentView === item.view ? 'bg-gray-100 text-gray-900' : 'text-gray-600 hover:text-gray-900'
onClick={() => { }`}
setCurrentView(item.view); onClick={() => {
setSelectedEmail(null); setCurrentView(item.view);
}} setSelectedEmail(null);
> }}
<div className="flex items-center justify-between w-full"> >
<div className="flex items-center"> <div className="flex items-center justify-between w-full">
<item.icon className="h-4 w-4 mr-2" /> <div className="flex items-center">
<span>{item.label}</span> <item.icon className="h-4 w-4 mr-2" />
<span>{item.label}</span>
</div>
{item.view === 'INBOX' && unreadCount > 0 && (
<span className="ml-auto bg-blue-600 text-white text-xs px-2 py-0.5 rounded-full">
{unreadCount}
</span>
)}
</div> </div>
{item.view === 'INBOX' && unreadCount > 0 && ( </Button>
<span className="ml-auto bg-blue-600 text-white text-xs px-2 py-0.5 rounded-full"> </li>
{unreadCount} ))}
</span> </ul>
)} ) : (
</div> // If needed, you can add other navigation items here that aren't folders
</Button> <div className="px-2 py-2">
</li> {/* This section is empty since we're now using folders under accounts */}
))} </div>
</ul> )}
</nav> </nav>
); );
@ -1634,9 +1634,9 @@ export default function CourrierPage() {
</div> </div>
</Button> </Button>
<Button <Button
variant="outline" variant="ghost"
size="icon" size="icon"
className="h-9 w-9 flex-none" className="h-9 w-9 text-gray-400 hover:text-gray-600"
onClick={() => { onClick={() => {
setLoading(true); setLoading(true);
loadEmails(); loadEmails();
@ -1680,18 +1680,6 @@ export default function CourrierPage() {
<div className="pl-4 mt-1 mb-2 space-y-0.5 border-l border-gray-200"> <div className="pl-4 mt-1 mb-2 space-y-0.5 border-l border-gray-200">
<div className="px-2 py-1 text-xs text-gray-500 font-medium flex justify-between items-center"> <div className="px-2 py-1 text-xs text-gray-500 font-medium flex justify-between items-center">
<span>Folders</span> <span>Folders</span>
<Button
variant="ghost"
size="icon"
className="h-5 w-5 text-gray-400 hover:text-gray-600"
onClick={(e) => {
e.stopPropagation();
setLoading(true);
loadEmails();
}}
>
<RefreshCw className="h-3 w-3" />
</Button>
</div> </div>
{account.folders && account.folders.length > 0 ? ( {account.folders && account.folders.length > 0 ? (
account.folders.map((folder) => ( account.folders.map((folder) => (