feat(T03): OCR-Erfassung via OpenRouter Qwen2.5-VL + OCR UI with drag-and-drop

This commit is contained in:
2026-07-17 00:45:14 +02:00
parent b128ea6b39
commit 149ac04dc1
20 changed files with 2348 additions and 182 deletions
+46
View File
@@ -0,0 +1,46 @@
'use client';
import { useState } from 'react';
import { OCRUpload } from '@/components/ocr/OCRUpload';
import { OCRResults } from '@/components/ocr/OCRResults';
import { OCRDetail } from '@/components/ocr/OCRDetail';
import { getOCRResult, type OCRResultResponse } from '@/lib/ocr';
export default function OCRPage() {
const [selectedResult, setSelectedResult] = useState<OCRResultResponse | null>(null);
const handleUploadComplete = async (resultId: string) => {
// Refresh results by triggering a re-render
// The OCRResults component will auto-refresh via its useEffect
// Optionally fetch the new result
try {
const result = await getOCRResult(resultId);
setSelectedResult(result);
} catch {
// Result might not be ready yet, ignore
}
};
const handleSelectResult = (result: OCRResultResponse) => {
setSelectedResult(result);
};
return (
<div data-testid="ocr-page" className="space-y-6">
<h1 className="text-2xl font-bold text-text">OCR Erfassung</h1>
<OCRUpload onUploadComplete={handleUploadComplete} />
<OCRResults onSelectResult={handleSelectResult} />
{selectedResult && (
<OCRDetail
result={selectedResult}
onApplyComplete={() => {
// Could refresh results here
}}
/>
)}
</div>
);
}