From 5afdc37653c8e839bb2d37df323a4039a71634b5 Mon Sep 17 00:00:00 2001 From: Marcel Date: Mon, 13 Apr 2026 22:24:50 +0200 Subject: [PATCH] =?UTF-8?q?feat(ui):=20manual-first=20OCR=20workflow=20?= =?UTF-8?q?=E2=80=94=20remove=20full-page=20auto-segmentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drawing annotations is now the primary workflow. OCR only runs on manually drawn regions (guided mode always). Full-page layout detection and the useExistingAnnotations checkbox are removed entirely. - OcrTrigger: guided-only, disabled with hint when no annotations exist - TranscriptionEditView: empty state shows draw-regions instruction, OCR trigger moved out of collapsible and shown inline after block list - i18n: add ocr_trigger_no_annotations, ocr_section_heading, transcription_empty_draw_hint; remove ocr_use_existing_annotations keys Co-Authored-By: Claude Sonnet 4.6 --- frontend/messages/de.json | 5 +- frontend/messages/en.json | 5 +- frontend/messages/es.json | 5 +- frontend/src/lib/components/OcrTrigger.svelte | 47 ++++--------------- .../components/TranscriptionEditView.svelte | 39 ++++----------- .../TranscriptionEditView.svelte.spec.ts | 1 + 6 files changed, 29 insertions(+), 73 deletions(-) diff --git a/frontend/messages/de.json b/frontend/messages/de.json index 52a82271..9e4222fd 100644 --- a/frontend/messages/de.json +++ b/frontend/messages/de.json @@ -479,6 +479,7 @@ "scan_collapse": "Scan verkleinern", "transcription_empty_title": "Noch keine Transkription", "transcription_empty_desc": "Zeichne Bereiche auf dem Scan und tippe den Text ab, um eine Transkription zu erstellen.", + "transcription_empty_draw_hint": "Zeichnen Sie Bereiche auf dem Dokument, um mit der Transkription zu beginnen.", "transcription_panel_close": "Panel schließen", "person_alias_heading": "Namensverlauf", "person_alias_empty": "Noch keine Namensaenderungen erfasst.", @@ -530,8 +531,8 @@ "ocr_status_analyzing_page": "Seite {current} von {total} wird analysiert…", "ocr_status_done_skipped": "{count} Blöcke erstellt, {skipped} Seite(n) übersprungen", "ocr_status_error": "OCR fehlgeschlagen", - "ocr_use_existing_annotations": "Nur annotierte Bereiche", - "ocr_use_existing_annotations_hint": "OCR wird nur innerhalb der bereits markierten Bereiche ausgeführt — keine neue Layout-Erkennung.", + "ocr_trigger_no_annotations": "Zeichnen Sie zuerst Bereiche auf dem Dokument ein.", + "ocr_section_heading": "OCR ausführen", "transcription_block_review": "Als geprüft markieren", "transcription_block_unreview": "Markierung aufheben", "transcription_reviewed_count": "{reviewed} von {total} geprüft", diff --git a/frontend/messages/en.json b/frontend/messages/en.json index b8670f73..4816e6d1 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -479,6 +479,7 @@ "scan_collapse": "Collapse scan", "transcription_empty_title": "No transcription yet", "transcription_empty_desc": "Draw regions on the scan and type the text to create a transcription.", + "transcription_empty_draw_hint": "Draw regions on the document to start transcribing.", "transcription_panel_close": "Close panel", "person_alias_heading": "Name history", "person_alias_empty": "No name changes recorded yet.", @@ -530,8 +531,8 @@ "ocr_status_analyzing_page": "Analyzing page {current} of {total}…", "ocr_status_done_skipped": "{count} blocks created, {skipped} page(s) skipped", "ocr_status_error": "OCR failed", - "ocr_use_existing_annotations": "Annotated regions only", - "ocr_use_existing_annotations_hint": "OCR runs only within the already marked regions — no new layout detection.", + "ocr_trigger_no_annotations": "Draw regions on the document first.", + "ocr_section_heading": "Run OCR", "transcription_block_review": "Mark as reviewed", "transcription_block_unreview": "Unmark as reviewed", "transcription_reviewed_count": "{reviewed} of {total} reviewed", diff --git a/frontend/messages/es.json b/frontend/messages/es.json index f6611cef..9376117a 100644 --- a/frontend/messages/es.json +++ b/frontend/messages/es.json @@ -479,6 +479,7 @@ "scan_collapse": "Reducir escaneo", "transcription_empty_title": "Sin transcripcion", "transcription_empty_desc": "Dibuja regiones en el escaneo y escribe el texto para crear una transcripcion.", + "transcription_empty_draw_hint": "Dibuje regiones en el documento para comenzar a transcribir.", "transcription_panel_close": "Cerrar panel", "person_alias_heading": "Historial de nombres", "person_alias_empty": "Aun no se han registrado cambios de nombre.", @@ -530,8 +531,8 @@ "ocr_status_analyzing_page": "Analizando página {current} de {total}…", "ocr_status_done_skipped": "{count} bloques creados, {skipped} página(s) omitida(s)", "ocr_status_error": "OCR fallido", - "ocr_use_existing_annotations": "Solo regiones anotadas", - "ocr_use_existing_annotations_hint": "El OCR se ejecuta solo dentro de las regiones ya marcadas — sin nueva detección de diseño.", + "ocr_trigger_no_annotations": "Dibuje regiones en el documento primero.", + "ocr_section_heading": "Ejecutar OCR", "transcription_block_review": "Marcar como revisado", "transcription_block_unreview": "Desmarcar como revisado", "transcription_reviewed_count": "{reviewed} de {total} revisados", diff --git a/frontend/src/lib/components/OcrTrigger.svelte b/frontend/src/lib/components/OcrTrigger.svelte index 55e8bfe9..e764263c 100644 --- a/frontend/src/lib/components/OcrTrigger.svelte +++ b/frontend/src/lib/components/OcrTrigger.svelte @@ -1,67 +1,38 @@
- {#if annotationCount > 0} -
- -

{m.ocr_use_existing_annotations_hint()}

-
- {/if} + {#if blockCount === 0} +

{m.ocr_trigger_no_annotations()}

+ {/if}
diff --git a/frontend/src/lib/components/TranscriptionEditView.svelte b/frontend/src/lib/components/TranscriptionEditView.svelte index b460119a..2ed30a60 100644 --- a/frontend/src/lib/components/TranscriptionEditView.svelte +++ b/frontend/src/lib/components/TranscriptionEditView.svelte @@ -361,21 +361,18 @@ $effect(() => { {#if canRunOcr && onTriggerOcr} -
- - {m.ocr_rerun_label()} - -
+
+

+ {m.ocr_section_heading()} +

+
-
+ {/if} @@ -395,25 +392,9 @@ $effect(() => { /> - {#if canRunOcr && onTriggerOcr} -

- {m.transcription_empty_title()} -

-
- -
-

- {m.transcription_empty_desc()} -

- {:else} -

- {m.transcription_empty_cta()} -

- {/if} +

+ {m.transcription_empty_draw_hint()} +

{/if} diff --git a/frontend/src/lib/components/TranscriptionEditView.svelte.spec.ts b/frontend/src/lib/components/TranscriptionEditView.svelte.spec.ts index a6490eb5..a0429018 100644 --- a/frontend/src/lib/components/TranscriptionEditView.svelte.spec.ts +++ b/frontend/src/lib/components/TranscriptionEditView.svelte.spec.ts @@ -40,6 +40,7 @@ function renderView(overrides: Record = {}, service = createCon onBlockFocus: vi.fn(), onSaveBlock: vi.fn(), onDeleteBlock: vi.fn(), + onReviewToggle: vi.fn(), ...overrides }, context: new Map([[CONFIRM_KEY, service]])