import { FileText, ChevronLeft, ChevronRight, Eye, Download, Loader2, } from 'lucide-react' import type { AbiturDokument } from '@/lib/education/abitur-docs-types' import { formatFileSize, FAECHER } from '@/lib/education/abitur-docs-types' import { DokumentCard } from '../components/DokumentCard' interface DocumentDisplayProps { documents: AbiturDokument[] loading: boolean error: string | null viewMode: 'grid' | 'list' hasActiveFilters: boolean onClearFilters: () => void onSelectDocument: (doc: AbiturDokument) => void onDownload: (doc: AbiturDokument) => void onAddToKlausur: (doc: AbiturDokument) => void onRetry: () => void // Pagination page: number totalPages: number total: number limit: number onPageChange: (page: number) => void } export function DocumentDisplay({ documents, loading, error, viewMode, hasActiveFilters, onClearFilters, onSelectDocument, onDownload, onAddToKlausur, onRetry, page, totalPages, total, limit, onPageChange, }: DocumentDisplayProps) { return (
{loading ? (
) : error ? (

{error}

) : documents.length === 0 ? (

Keine Dokumente gefunden

{hasActiveFilters && ( )}
) : viewMode === 'grid' ? (
{documents.map((doc) => ( ))}
) : ( )} {/* Pagination */} {documents.length > 0 && (
Zeige {(page - 1) * limit + 1}-{Math.min(page * limit, total)} von {total} Dokumenten
Seite {page} von {totalPages}
)}
) } function ListView({ documents, onSelectDocument, onDownload, }: { documents: AbiturDokument[] onSelectDocument: (doc: AbiturDokument) => void onDownload: (doc: AbiturDokument) => void }) { return ( {documents.map((doc) => { const fachLabel = FAECHER.find(f => f.id === doc.fach)?.label || doc.fach return ( onSelectDocument(doc)} > ) })}
Dokument Fach Jahr Niveau Typ Groesse Status Aktion
{doc.dateiname}
{fachLabel} {doc.jahr} {doc.niveau} {doc.typ === 'erwartungshorizont' ? 'EWH' : 'Aufgabe'} {formatFileSize(doc.file_size)} {doc.status === 'indexed' ? 'Indexiert' : doc.status === 'error' ? 'Fehler' : 'Ausstehend'}
e.stopPropagation()}>
) }