import { useLibrary } from './useLibrary'
import { useAuth } from '../auth/useAuth'
export const LibraryHeader = ({ currentTab, onTabChange }: { currentTab: 'library' | 'trash', onTabChange: (tab: 'library' | 'trash') => void }) => {
const { logout } = useAuth()
const {
searchQuery, setSearchQuery, fetchDocuments, fetchTrash,
selectedIds, clearSelection, selectAll, bulkDelete, bulkRestore, emptyTrash, documents
} = useLibrary()
const handleSearch = (e: React.FormEvent) => {
e.preventDefault()
if (currentTab === 'library') {
fetchDocuments(searchQuery)
}
}
const handleTabChange = (tab: 'library' | 'trash') => {
onTabChange(tab)
if (tab === 'library') {
fetchDocuments()
} else {
fetchTrash()
}
}
const isSelectionMode = selectedIds.size > 0
const allSelected = documents.length > 0 && selectedIds.size === documents.length
return (
{/* Left: Branding & Tabs */}
{/* Right: Search & Actions */}
{isSelectionMode ? (
{selectedIds.size} selected
{currentTab === 'library' ? (
) : (
<>
>
)}
) : (
<>
{currentTab === 'library' && (
)}
{currentTab === 'trash' && (
)}
{currentTab === 'library' && (
)}
>
)}
)
}