'use client' /** * Document Viewer with annotation overlay and page navigation. * Left panel (2/3 width) in the Korrektur-Workspace. */ import type { Annotation, AnnotationType, AnnotationPosition, StudentWork } from '../../app/admin/klausur-korrektur/types' // Re-use existing annotation components from the klausur-korrektur route interface DocumentViewerProps { student: StudentWork | null documentUrl: string | null zoom: number currentPage: number totalPages: number annotations: Annotation[] selectedTool: AnnotationType | null selectedAnnotation: Annotation | null annotationCounts: Record onZoomChange: (zoom: number) => void onPageChange: (page: number) => void onSelectTool: (tool: AnnotationType | null) => void onCreateAnnotation: (position: AnnotationPosition, type: AnnotationType) => void onSelectAnnotation: (ann: Annotation) => void // Render props for toolbar and annotation layer since they are imported from route-local components AnnotationToolbarComponent: React.ComponentType<{ selectedTool: AnnotationType | null onSelectTool: (tool: AnnotationType | null) => void zoom: number onZoomChange: (zoom: number) => void annotationCounts: Record }> AnnotationLayerComponent: React.ComponentType<{ annotations: Annotation[] selectedTool: AnnotationType | null onCreateAnnotation: (position: AnnotationPosition, type: AnnotationType) => void onSelectAnnotation: (ann: Annotation) => void selectedAnnotationId?: string }> } export default function DocumentViewer({ student, documentUrl, zoom, currentPage, totalPages, annotations, selectedTool, selectedAnnotation, annotationCounts, onZoomChange, onPageChange, onSelectTool, onCreateAnnotation, onSelectAnnotation, AnnotationToolbarComponent, AnnotationLayerComponent, }: DocumentViewerProps) { return (
{/* Toolbar */} {/* Document display with annotation overlay */}
{documentUrl ? (
{student?.file_path?.endsWith('.pdf') ? (