import { Star, Trash2 } from 'lucide-react' import type { FileManagerState } from './useFileManager' export function FileManagerToolbar(S: FileManagerState) { const { showTrash, t, files, filterType, setFilterType, toggleTrash } = S return (

{showTrash ? (t('files.trash') || 'Trash') : t('files.title')}

{!showTrash && ( <>
{[ { id: 'all', label: t('files.filterAll') }, ...(files.some(f => f.starred) ? [{ id: 'starred', icon: Star } as const] : []), { id: 'pdf', label: t('files.filterPdf') }, { id: 'image', label: t('files.filterImages') }, { id: 'doc', label: t('files.filterDocs') }, ...(files.some(f => f.note_id) ? [{ id: 'collab', label: t('files.filterCollab') || 'Collab' }] : []), ].map(tab => { const active = filterType === tab.id const TabIcon = 'icon' in tab ? tab.icon : null const count = tab.id === 'all' ? files.length : tab.id === 'starred' ? files.filter(f => f.starred).length : tab.id === 'pdf' ? files.filter(f => (f.mime_type || '').includes('pdf') || /\.pdf$/i.test(f.original_name)).length : tab.id === 'image' ? files.filter(f => (f.mime_type || '').startsWith('image/')).length : tab.id === 'doc' ? files.filter(f => /\.(docx?|xlsx?|txt|csv)$/i.test(f.original_name)).length : tab.id === 'collab' ? files.filter(f => f.note_id).length : 0 return ( ) })}
)}
) }