From 0455ff7f7d6891d21d25c8ee14e4231b0265236d Mon Sep 17 00:00:00 2001 From: alma Date: Sun, 27 Apr 2025 14:05:14 +0200 Subject: [PATCH] courrier redis login --- app/courrier/page.tsx | 16 ++++- components/email/EmailSidebar.tsx | 97 +++++++++++++++++++++---------- 2 files changed, 79 insertions(+), 34 deletions(-) diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx index 8f38ef57..384e17e3 100644 --- a/app/courrier/page.tsx +++ b/app/courrier/page.tsx @@ -107,6 +107,7 @@ export default function CourrierPage() { const [unreadCount, setUnreadCount] = useState(0); const [loading, setLoading] = useState(false); const [prefetchStarted, setPrefetchStarted] = useState(false); + const [showFolders, setShowFolders] = useState(true); // Mock accounts for the sidebar const [accounts, setAccounts] = useState([ @@ -347,16 +348,27 @@ export default function CourrierPage() { {/* Show folders for email accounts (not for "All" account) without the "Folders" header */} - {account.id !== 0 && ( + {account.id !== 0 && showFolders && (
{account.folders && account.folders.length > 0 ? ( account.folders.map((folder) => ( diff --git a/components/email/EmailSidebar.tsx b/components/email/EmailSidebar.tsx index 86cdc41b..028a194b 100644 --- a/components/email/EmailSidebar.tsx +++ b/components/email/EmailSidebar.tsx @@ -1,9 +1,10 @@ 'use client'; -import React from 'react'; +import React, { useState } from 'react'; import { Inbox, Send, Trash, Archive, Star, - File, RefreshCw, Plus, MailOpen, Settings + File, RefreshCw, Plus, MailOpen, Settings, + ChevronDown, ChevronRight, Mail } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; @@ -27,6 +28,8 @@ export default function EmailSidebar({ onCompose, isLoading }: EmailSidebarProps) { + const [showFolders, setShowFolders] = useState(true); + // Get the appropriate icon for a folder const getFolderIcon = (folder: string) => { const folderLower = folder.toLowerCase(); @@ -80,33 +83,35 @@ export default function EmailSidebar({ {/* Folder navigation */}
- {visibleStandardFolders.map((folder) => ( - - ))} + {/* Accounts header with toggle */} +
+ Accounts + {isLoading && } +
- {/* Custom folders section */} - {customFolders.length > 0 && ( - <> - {customFolders.map(folder => ( + {/* Mail account with toggle arrow */} +
+ +
+ + {/* Folders list - shown only when showFolders is true */} + {showFolders && ( +
+ {visibleStandardFolders.map((folder) => ( ))} - + + {/* Custom folders section */} + {customFolders.length > 0 && ( + <> + {customFolders.map(folder => ( + + ))} + + )} +
)}