'use client' /** * AnnotationToolbar * * Toolbar for selecting annotation tools and controlling the document viewer. */ import type { AnnotationType } from '../types' import { ANNOTATION_COLORS } from '../types' interface AnnotationToolbarProps { selectedTool: AnnotationType | null onSelectTool: (tool: AnnotationType | null) => void zoom: number onZoomChange: (zoom: number) => void annotationCounts: Record disabled?: boolean } const ANNOTATION_TOOLS: { type: AnnotationType; label: string; shortcut: string }[] = [ { type: 'rechtschreibung', label: 'Rechtschreibung', shortcut: 'R' }, { type: 'grammatik', label: 'Grammatik', shortcut: 'G' }, { type: 'inhalt', label: 'Inhalt', shortcut: 'I' }, { type: 'struktur', label: 'Struktur', shortcut: 'S' }, { type: 'stil', label: 'Stil', shortcut: 'T' }, { type: 'comment', label: 'Kommentar', shortcut: 'K' }, ] export default function AnnotationToolbar({ selectedTool, onSelectTool, zoom, onZoomChange, annotationCounts, disabled = false, }: AnnotationToolbarProps) { const handleToolClick = (type: AnnotationType) => { if (disabled) return onSelectTool(selectedTool === type ? null : type) } return (
{/* Annotation tools */}
Markieren: {ANNOTATION_TOOLS.map(({ type, label, shortcut }) => { const isSelected = selectedTool === type const count = annotationCounts[type] || 0 const color = ANNOTATION_COLORS[type] return ( ) })} {/* Clear selection button */} {selectedTool && ( )}
{/* Mode indicator */} {selectedTool && (
{ANNOTATION_TOOLS.find((t) => t.type === selectedTool)?.label || selectedTool}
)} {/* Zoom controls */}
{zoom}%
) }