'use client' import type { PreviewResult, PipelineResult } from './CleanupPanel' // ============================================================================= // Step 1: Upload // ============================================================================= interface UploadStepProps { isDark: boolean labelStyle: string cardStyle: string file: File | null previewUrl: string | null handleDrop: (e: React.DragEvent) => void handleFileSelect: (f: File) => void removeHandwriting: boolean setRemoveHandwriting: (v: boolean) => void reconstructLayout: boolean setReconstructLayout: (v: boolean) => void inpaintingMethod: string setInpaintingMethod: (v: string) => void lamaAvailable: boolean } export function UploadStep({ isDark, labelStyle, cardStyle, file, previewUrl, handleDrop, handleFileSelect, removeHandwriting, setRemoveHandwriting, reconstructLayout, setReconstructLayout, inpaintingMethod, setInpaintingMethod, lamaAvailable, }: UploadStepProps) { return (
{/* Dropzone */}
e.preventDefault()} onClick={() => document.getElementById('file-input')?.click()} > e.target.files?.[0] && handleFileSelect(e.target.files[0])} className="hidden" /> {previewUrl ? (
Preview

{file?.name}

Klicke zum Ändern oder ziehe eine andere Datei hierher

) : ( <>

Bild hochladen

Ziehe ein Bild hierher oder klicke zum Auswählen

Unterstützt: PNG, JPG, JPEG

)}
{/* Options */} {file && (

Optionen

{removeHandwriting && (
)}
)}
) } // ============================================================================= // Step 2: Preview // ============================================================================= interface PreviewStepProps { isDark: boolean labelStyle: string cardStyle: string previewResult: PreviewResult previewUrl: string | null maskUrl: string | null removeHandwriting: boolean reconstructLayout: boolean handleGetMask: () => void } export function PreviewStep({ isDark, labelStyle, cardStyle, previewResult, previewUrl, maskUrl, removeHandwriting, reconstructLayout, handleGetMask, }: PreviewStepProps) { return (
{/* Detection Result */}

Erkennungsergebnis

Handschrift gefunden: {previewResult.has_handwriting ? 'Ja' : 'Nein'}
Konfidenz: {(previewResult.confidence * 100).toFixed(0)}%
Handschrift-Anteil: {(previewResult.handwriting_ratio * 100).toFixed(1)}%
Bildgröße: {previewResult.image_width} × {previewResult.image_height}
{/* Time Estimates */}

Geschätzte Zeit

Erkennung: ~{Math.round(previewResult.estimated_times_ms.detection / 1000)}s
{removeHandwriting && previewResult.has_handwriting && (
Bereinigung: ~{Math.round(previewResult.estimated_times_ms.inpainting / 1000)}s
)} {reconstructLayout && (
Layout: ~{Math.round(previewResult.estimated_times_ms.reconstruction / 1000)}s
)}
Gesamt: ~{Math.round(previewResult.estimated_times_ms.total / 1000)}s
{/* Preview Images */}

Original

{previewUrl && Original}

Maske

{maskUrl ? ( Mask ) : (
Klicke "Maske laden" zum Anzeigen
)}
) } // ============================================================================= // Step 3: Result // ============================================================================= interface ResultStepProps { isDark: boolean labelStyle: string cardStyle: string pipelineResult: PipelineResult previewUrl: string | null cleanedUrl: string | null } export function ResultStep({ isDark, labelStyle, cardStyle, pipelineResult, previewUrl, cleanedUrl, }: ResultStepProps) { return (
{/* Status */}
{pipelineResult.success ? ( ) : ( )}

{pipelineResult.success ? 'Erfolgreich bereinigt' : 'Bereinigung fehlgeschlagen'}

{pipelineResult.handwriting_detected ? pipelineResult.handwriting_removed ? 'Handschrift wurde erkannt und entfernt' : 'Handschrift erkannt, aber nicht entfernt' : 'Keine Handschrift gefunden'}

{/* Result Images */}

Original

{previewUrl && Original}

Bereinigt

{cleanedUrl ? ( Cleaned ) : (
Kein Bild
)}
{/* Layout Info */} {pipelineResult.layout_reconstructed && pipelineResult.metadata?.layout && (

Layout-Rekonstruktion

Elemente:

{pipelineResult.metadata.layout.element_count}

Tabellen:

{pipelineResult.metadata.layout.table_count}

Größe:

{pipelineResult.metadata.layout.page_width} × {pipelineResult.metadata.layout.page_height}

)}
) }