feat(ui): manual-first OCR workflow — remove full-page auto-segmentation

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 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-13 22:24:50 +02:00
parent 669f2f8b98
commit 5afdc37653
6 changed files with 29 additions and 73 deletions

View File

@@ -1,67 +1,38 @@
<script lang="ts">
import { untrack } from 'svelte';
import { m } from '$lib/paraglide/messages.js';
import { getConfirmService } from '$lib/services/confirm.svelte';
import ScriptTypeSelect from './ScriptTypeSelect.svelte';
interface Props {
existingBlockCount: number;
blockCount: number;
storedScriptType: string;
annotationCount?: number;
onTrigger: (scriptType: string, useExistingAnnotations: boolean) => void;
}
let { existingBlockCount, storedScriptType, annotationCount = 0, onTrigger }: Props = $props();
const { confirm } = getConfirmService();
let { blockCount, storedScriptType, onTrigger }: Props = $props();
import { untrack } from 'svelte';
let selectedScriptType: string = $state(
untrack(() => (storedScriptType && storedScriptType !== 'UNKNOWN' ? storedScriptType : ''))
);
let useExistingAnnotations: boolean = $state(false);
async function handleClick() {
function handleClick() {
if (!selectedScriptType) return;
if (!useExistingAnnotations && existingBlockCount > 0) {
const confirmed = await confirm({
title: m.ocr_confirm_title(),
body: m.ocr_confirm_body({ count: String(existingBlockCount) }),
confirmLabel: m.ocr_confirm_btn(),
destructive: true
});
if (!confirmed) return;
}
onTrigger(selectedScriptType, useExistingAnnotations);
onTrigger(selectedScriptType, true);
}
</script>
<div class="flex flex-col gap-3">
<ScriptTypeSelect bind:value={selectedScriptType} />
{#if annotationCount > 0}
<div class="flex flex-col gap-1">
<label class="flex cursor-pointer items-center gap-2">
<input
type="checkbox"
bind:checked={useExistingAnnotations}
class="h-4 w-4 cursor-pointer rounded-sm border-brand-navy/30 accent-brand-navy"
/>
<span class="font-sans text-sm font-medium text-brand-navy">
{m.ocr_use_existing_annotations()}
</span>
</label>
<p class="pl-6 text-xs text-ink-3">{m.ocr_use_existing_annotations_hint()}</p>
</div>
{/if}
<button
type="button"
disabled={!selectedScriptType}
disabled={!selectedScriptType || blockCount === 0}
title={!selectedScriptType ? m.ocr_trigger_btn_disabled() : undefined}
onclick={handleClick}
class="min-h-[44px] w-full rounded-sm bg-brand-navy font-sans text-sm font-medium text-white transition-colors hover:bg-brand-navy/90 disabled:cursor-not-allowed disabled:opacity-50"
>
{m.ocr_trigger_btn()}
</button>
{#if blockCount === 0}
<p class="text-xs text-ink-3">{m.ocr_trigger_no_annotations()}</p>
{/if}
</div>