Files
familienarchiv/frontend/src/routes/admin/ocr/OcrModelsTable.svelte
Marcel a00617194c
Some checks failed
CI / Unit & Component Tests (push) Failing after 3m17s
CI / OCR Service Tests (push) Successful in 57s
CI / Backend Unit Tests (push) Failing after 2m52s
CI / Unit & Component Tests (pull_request) Failing after 2m47s
CI / OCR Service Tests (pull_request) Successful in 43s
CI / Backend Unit Tests (pull_request) Failing after 2m48s
fix(admin): i18n all hardcoded OCR strings, fix personName lookup, add empty state
- Replace hardcoded EN strings in OcrHealthBar/OcrStatCards/OcrModelsTable with
  Paraglide message keys (de/en/es translations added)
- Add role=img + aria-label to OcrHealthBar status dot
- Add {:else} empty-state row in OcrModelsTable
- Fix personName derivation in [personId]/+page.svelte to use params.personId key
  instead of Object.values()[0] (fragile when multiple persons present)
- Update OcrModelsTable spec to assert empty-state row structure (locale-agnostic)
- Add missing availableSegBlocks test to OcrStatCards spec

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 08:59:49 +02:00

75 lines
2.3 KiB
Svelte

<script lang="ts">
import type { components } from '$lib/generated/api';
import * as m from '$lib/paraglide/messages.js';
type SenderModel = components['schemas']['SenderModel'];
let {
senderModels,
personNames
}: {
senderModels: SenderModel[];
personNames: Record<string, string>;
} = $props();
</script>
<div class="border-brand-sand rounded-sm border bg-white p-6 shadow-sm">
<table class="w-full text-sm">
<thead>
<tr>
<th
class="border-brand-sand border-b pb-3 text-left text-xs font-bold tracking-widest text-gray-400 uppercase"
>{m.ocr_table_person()}</th
>
<th
class="border-brand-sand border-b pb-3 text-left text-xs font-bold tracking-widest text-gray-400 uppercase"
>{m.ocr_table_cer()}</th
>
<th
class="border-brand-sand border-b pb-3 text-left text-xs font-bold tracking-widest text-gray-400 uppercase"
>{m.ocr_table_accuracy()}</th
>
<th
class="border-brand-sand border-b pb-3 text-left text-xs font-bold tracking-widest text-gray-400 uppercase"
>{m.ocr_table_lines()}</th
>
<th
class="border-brand-sand border-b pb-3 text-left text-xs font-bold tracking-widest text-gray-400 uppercase"
>{m.ocr_table_actions()}</th
>
</tr>
</thead>
<tbody>
{#each senderModels as model (model.id)}
<tr>
<td class="border-brand-sand/50 border-b py-3">
<a href="/admin/ocr/{model.personId}" class="text-brand-navy hover:underline">
{personNames[model.personId] ?? model.personId}
</a>
</td>
<td class="border-brand-sand/50 border-b py-3">
{model.cer != null ? (model.cer * 100).toFixed(1) + '%' : '—'}
</td>
<td class="border-brand-sand/50 border-b py-3">
{model.accuracy != null ? (model.accuracy * 100).toFixed(1) + '%' : '—'}
</td>
<td class="border-brand-sand/50 border-b py-3">
{model.correctedLinesAtTraining}
</td>
<td class="border-brand-sand/50 border-b py-3">
<a
href="/admin/ocr/{model.personId}"
class="font-medium text-brand-navy hover:underline">{m.ocr_table_details()}</a
>
</td>
</tr>
{:else}
<tr>
<td colspan="5" class="py-6 text-center text-sm text-gray-400">
{m.ocr_no_models()}
</td>
</tr>
{/each}
</tbody>
</table>
</div>