'use client' /** * DokumentCard - Card component for Abitur document grid view * Features: Preview, Download, Add to Klausur actions */ import { useState } from 'react' import { FileText, Eye, Download, Plus, Calendar, Layers, BookOpen, ExternalLink } from 'lucide-react' import type { AbiturDokument } from '@/lib/education/abitur-docs-types' import { formatFileSize, FAECHER, NIVEAUS } from '@/lib/education/abitur-docs-types' interface DokumentCardProps { document: AbiturDokument onPreview: (doc: AbiturDokument) => void onDownload: (doc: AbiturDokument) => void onAddToKlausur?: (doc: AbiturDokument) => void } export function DokumentCard({ document, onPreview, onDownload, onAddToKlausur }: DokumentCardProps) { const [isHovered, setIsHovered] = useState(false) const fachLabel = FAECHER.find(f => f.id === document.fach)?.label || document.fach const niveauLabel = document.niveau === 'eA' ? 'Erhoehtes Niveau' : 'Grundlegendes Niveau' const handleDownload = (e: React.MouseEvent) => { e.stopPropagation() onDownload(document) } const handleAddToKlausur = (e: React.MouseEvent) => { e.stopPropagation() onAddToKlausur?.(document) } return (
setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} onClick={() => onPreview(document)} > {/* Header with Type Badge */}
{/* Type Badge */}
{document.typ === 'erwartungshorizont' ? 'Erwartungshorizont' : 'Aufgabe'}
{/* Year Badge */}
{document.jahr}
{/* Status Badge */}
{document.status === 'indexed' ? 'Indexiert' : document.status === 'error' ? 'Fehler' : 'Ausstehend'}
{/* Hover Overlay with Preview */} {isHovered && (
)}
{/* Content */}
{/* Title */}

{fachLabel} {document.niveau} - Aufgabe {document.aufgaben_nummer}

{/* Metadata */}
{fachLabel}
{niveauLabel}
{document.bundesland}
{formatFileSize(document.file_size)} | {document.dateiname}
{/* Action Buttons */}
{onAddToKlausur && ( )}
) } /** * Compact card variant for list view or similar documents */ export function DokumentCardCompact({ document, onPreview, similarity_score }: { document: AbiturDokument onPreview: (doc: AbiturDokument) => void similarity_score?: number }) { const fachLabel = FAECHER.find(f => f.id === document.fach)?.label || document.fach return ( ) }