Phase 1 — Python (klausur-service): 5 monoliths → 36 files - dsfa_corpus_ingestion.py (1,828 LOC → 5 files) - cv_ocr_engines.py (2,102 LOC → 7 files) - cv_layout.py (3,653 LOC → 10 files) - vocab_worksheet_api.py (2,783 LOC → 8 files) - grid_build_core.py (1,958 LOC → 6 files) Phase 2 — Go (edu-search-service, school-service): 8 monoliths → 19 files - staff_crawler.go (1,402 → 4), policy/store.go (1,168 → 3) - policy_handlers.go (700 → 2), repository.go (684 → 2) - search.go (592 → 2), ai_extraction_handlers.go (554 → 2) - seed_data.go (591 → 2), grade_service.go (646 → 2) Phase 3 — TypeScript (admin-lehrer): 45 monoliths → 220+ files - sdk/types.ts (2,108 → 16 domain files) - ai/rag/page.tsx (2,686 → 14 files) - 22 page.tsx files split into _components/ + _hooks/ - 11 component files split into sub-components - 10 SDK data catalogs added to loc-exceptions - Deleted dead backup index_original.ts (4,899 LOC) All original public APIs preserved via re-export facades. Zero new errors: Python imports verified, Go builds clean, TypeScript tsc --noEmit shows only pre-existing errors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
95 lines
3.2 KiB
TypeScript
95 lines
3.2 KiB
TypeScript
'use client'
|
|
|
|
import { useState } from 'react'
|
|
import type { DewarpGroundTruth } from '@/app/(admin)/ai/ocr-kombi/types'
|
|
|
|
interface DewarpGroundTruthPanelProps {
|
|
manualShear: number
|
|
onGroundTruth: (gt: DewarpGroundTruth) => void
|
|
gtSaved: boolean
|
|
onGtSaved: () => void
|
|
}
|
|
|
|
export function DewarpGroundTruthPanel({
|
|
manualShear,
|
|
onGroundTruth,
|
|
gtSaved,
|
|
onGtSaved,
|
|
}: DewarpGroundTruthPanelProps) {
|
|
const [gtFeedback, setGtFeedback] = useState<'correct' | 'incorrect' | null>(null)
|
|
const [gtNotes, setGtNotes] = useState('')
|
|
|
|
const handleGroundTruth = (isCorrect: boolean) => {
|
|
setGtFeedback(isCorrect ? 'correct' : 'incorrect')
|
|
if (isCorrect) {
|
|
onGroundTruth({ is_correct: true })
|
|
onGtSaved()
|
|
}
|
|
}
|
|
|
|
const handleGroundTruthIncorrect = () => {
|
|
onGroundTruth({
|
|
is_correct: false,
|
|
corrected_shear: manualShear !== 0 ? manualShear : undefined,
|
|
notes: gtNotes || undefined,
|
|
})
|
|
onGtSaved()
|
|
}
|
|
|
|
return (
|
|
<div className="bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4">
|
|
<div className="text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
|
|
Spalten vertikal ausgerichtet?
|
|
</div>
|
|
<p className="text-xs text-gray-400 mb-2">Pruefen ob die Spaltenraender jetzt senkrecht zum Raster stehen.</p>
|
|
{!gtSaved ? (
|
|
<div className="space-y-3">
|
|
<div className="flex gap-2">
|
|
<button
|
|
onClick={() => handleGroundTruth(true)}
|
|
className={`px-4 py-1.5 rounded-md text-sm font-medium transition-colors ${
|
|
gtFeedback === 'correct'
|
|
? 'bg-green-100 text-green-700 ring-2 ring-green-400'
|
|
: 'bg-gray-100 text-gray-600 hover:bg-green-50 dark:bg-gray-700 dark:text-gray-300'
|
|
}`}
|
|
>
|
|
Ja
|
|
</button>
|
|
<button
|
|
onClick={() => handleGroundTruth(false)}
|
|
className={`px-4 py-1.5 rounded-md text-sm font-medium transition-colors ${
|
|
gtFeedback === 'incorrect'
|
|
? 'bg-red-100 text-red-700 ring-2 ring-red-400'
|
|
: 'bg-gray-100 text-gray-600 hover:bg-red-50 dark:bg-gray-700 dark:text-gray-300'
|
|
}`}
|
|
>
|
|
Nein
|
|
</button>
|
|
</div>
|
|
{gtFeedback === 'incorrect' && (
|
|
<div className="space-y-2">
|
|
<textarea
|
|
value={gtNotes}
|
|
onChange={(e) => setGtNotes(e.target.value)}
|
|
placeholder="Notizen zur Korrektur..."
|
|
className="w-full text-sm border border-gray-300 dark:border-gray-600 rounded-md p-2 bg-white dark:bg-gray-900 text-gray-800 dark:text-gray-200"
|
|
rows={2}
|
|
/>
|
|
<button
|
|
onClick={handleGroundTruthIncorrect}
|
|
className="text-sm px-3 py-1 bg-red-600 text-white rounded-md hover:bg-red-700 transition-colors"
|
|
>
|
|
Feedback speichern
|
|
</button>
|
|
</div>
|
|
)}
|
|
</div>
|
|
) : (
|
|
<div className="text-sm text-green-600 dark:text-green-400">
|
|
Feedback gespeichert
|
|
</div>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|