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
const initialSidebarItems = [
{
view: 'INBOX' as MailFolder,
label: 'Inbox',
icon: Inbox,
folder: 'INBOX'
}
];
// Update the initialSidebarItems to be empty since we're using folders under Accounts now
const initialSidebarItems: any[] = []; // Remove the default Inbox item
function formatDate(date: Date | null): string {
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 = () => (
<nav className="p-3">
<ul className="space-y-0.5 px-2">
{sidebarItems.map((item) => (
<li key={item.view}>
<Button
variant={currentView === item.view ? 'secondary' : 'ghost'}
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);
setSelectedEmail(null);
}}
>
<div className="flex items-center justify-between w-full">
<div className="flex items-center">
<item.icon className="h-4 w-4 mr-2" />
<span>{item.label}</span>
{sidebarItems.length > 0 ? (
<ul className="space-y-0.5 px-2">
{sidebarItems.map((item) => (
<li key={item.view}>
<Button
variant={currentView === item.view ? 'secondary' : 'ghost'}
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);
setSelectedEmail(null);
}}
>
<div className="flex items-center justify-between w-full">
<div className="flex items-center">
<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>
{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>
</Button>
</li>
))}
</ul>
</Button>
</li>
))}
</ul>
) : (
// If needed, you can add other navigation items here that aren't folders
<div className="px-2 py-2">
{/* This section is empty since we're now using folders under accounts */}
</div>
)}
</nav>
);
@ -1634,9 +1634,9 @@ export default function CourrierPage() {
</div>
</Button>
<Button
variant="outline"
variant="ghost"
size="icon"
className="h-9 w-9 flex-none"
className="h-9 w-9 text-gray-400 hover:text-gray-600"
onClick={() => {
setLoading(true);
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="px-2 py-1 text-xs text-gray-500 font-medium flex justify-between items-center">
<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>
{account.folders && account.folders.length > 0 ? (
account.folders.map((folder) => (