'use client'; import React, { useState } from 'react'; import { Inbox, Send, Trash, Archive, Star, File, RefreshCw, Plus, MailOpen, Settings, ChevronDown, ChevronRight, Mail } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; import { ScrollArea } from '@/components/ui/scroll-area'; import { Badge } from '@/components/ui/badge'; interface EmailSidebarProps { currentFolder: string; currentAccount: string; accounts: Array<{ id: string; email: string; folders: string[]; }>; onFolderChange: (folder: string, accountId: string) => void; onRefresh: () => void; onCompose: () => void; isLoading: boolean; } export default function EmailSidebar({ currentFolder, currentAccount, accounts, onFolderChange, onRefresh, onCompose, isLoading }: EmailSidebarProps) { const [showAccounts, setShowAccounts] = useState(true); const [expandedAccount, setExpandedAccount] = useState(currentAccount); // Get the appropriate icon for a folder const getFolderIcon = (folder: string) => { const folderLower = folder.toLowerCase(); switch (folderLower) { case 'inbox': return ; case 'sent': case 'sent items': return ; case 'drafts': return ; case 'trash': case 'deleted': case 'bin': return ; case 'archive': case 'archived': return ; case 'starred': case 'important': return ; default: return ; } }; // Group folders into standard and custom const getStandardFolders = (folders: string[]) => { const standardFolders = ['INBOX', 'Sent', 'Drafts', 'Trash', 'Archive', 'Junk']; return standardFolders.filter(f => folders.includes(f) || folders.some(folder => folder.toLowerCase() === f.toLowerCase()) ); }; const getCustomFolders = (folders: string[]) => { const standardFolders = ['INBOX', 'Sent', 'Drafts', 'Trash', 'Archive', 'Junk']; return folders.filter(f => !standardFolders.some(sf => sf.toLowerCase() === f.toLowerCase()) ); }; const handleAccountClick = (accountId: string) => { setExpandedAccount(expandedAccount === accountId ? null : accountId); }; return ( ); }