import { useState } from 'react' import { ChevronRight, ChevronDown, Folder, Image, Calendar, Star, Flag, Trash2, Plus, MoreHorizontal, HardDrive } from 'lucide-react' import clsx from 'clsx' interface TreeItem { id: string label: string icon?: React.ReactNode count?: number children?: TreeItem[] type?: 'folder' | 'heap' | 'special' } export function LeftSidebar() { const [expandedItems, setExpandedItems] = useState>(new Set(['library', 'folders', 'heaps'])) const [selectedItem, setSelectedItem] = useState('all-photos') const toggleExpanded = (id: string) => { const newExpanded = new Set(expandedItems) if (newExpanded.has(id)) { newExpanded.delete(id) } else { newExpanded.add(id) } setExpandedItems(newExpanded) } const libraryTree: TreeItem[] = [ { id: 'library', label: 'Library', icon: , children: [ { id: 'all-photos', label: 'All Photos', icon: , count: 0 }, { id: 'by-date', label: 'By Date', icon: }, { id: 'rated', label: 'Rated', icon: , count: 0 }, { id: 'flagged', label: 'Flagged', icon: , count: 0 }, { id: 'trash', label: 'Trash', icon: , count: 0 }, ], }, { id: 'folders', label: 'Folders', icon: , children: [], // Will be populated from API }, { id: 'heaps', label: 'Heaps', icon: , children: [], // Will be populated from API }, ] const renderTreeItem = (item: TreeItem, depth: number = 0) => { const hasChildren = item.children && item.children.length > 0 const isExpanded = expandedItems.has(item.id) const isSelected = selectedItem === item.id return (
0 && 'text-[13px]' )} style={{ paddingLeft: `${8 + depth * 16}px` }} onClick={() => { setSelectedItem(item.id) if (hasChildren) { toggleExpanded(item.id) } }} > {/* Expand/Collapse Icon */} {hasChildren ? ( ) : (
)} {/* Item Icon */} {item.icon && ( {item.icon} )} {/* Label */} {item.label} {/* Count Badge */} {item.count !== undefined && item.count > 0 && ( {item.count} )} {/* Actions (shown on hover) */} {(item.id === 'folders' || item.id === 'heaps') && ( )}
{/* Render Children */} {hasChildren && isExpanded && (
{item.children!.map((child) => renderTreeItem(child, depth + 1))}
)}
) } return (
{/* Sidebar Header */}

Library

{/* Tree View */}
{libraryTree.map((item) => renderTreeItem(item))}
{/* Bottom Actions */}
) }