All checks were successful
CI / Unit & Component Tests (pull_request) Successful in 3m9s
CI / OCR Service Tests (pull_request) Successful in 16s
CI / Backend Unit Tests (pull_request) Successful in 4m29s
CI / fail2ban Regex (pull_request) Successful in 38s
CI / Compose Bucket Idempotency (pull_request) Successful in 55s
CI / Unit & Component Tests (push) Successful in 3m8s
CI / OCR Service Tests (push) Successful in 16s
CI / Backend Unit Tests (push) Successful in 4m25s
CI / fail2ban Regex (push) Successful in 38s
CI / Compose Bucket Idempotency (push) Successful in 55s
- Extract ImportStatus type to types.ts — removes duplication across
+page.svelte, ImportStatusCard.svelte, and test file (Felix blocker)
- Fix H2 to match CLAUDE.md card pattern: text-xs uppercase tracking-widest
text-ink-3 mb-5 (Leonie blocker 1)
- Add font-sans to RUNNING and DONE status labels (Leonie blocker 2)
- Add data-testid="processed-count" to count elements in both states
- Replace document.querySelector with locator API in spinner tests
- Tighten getByText('7') to getByTestId('processed-count') (Felix/Sara)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
82 lines
2.8 KiB
Svelte
82 lines
2.8 KiB
Svelte
<script lang="ts">
|
|
import { m } from '$lib/paraglide/messages.js';
|
|
import type { ImportStatus } from './types.js';
|
|
|
|
let {
|
|
importStatus,
|
|
ontrigger
|
|
}: {
|
|
importStatus: ImportStatus | null;
|
|
ontrigger: () => void;
|
|
} = $props();
|
|
|
|
const failureMessage = $derived(
|
|
importStatus?.statusCode === 'IMPORT_FAILED_NO_SPREADSHEET'
|
|
? m.admin_system_import_failed_no_spreadsheet()
|
|
: m.admin_system_import_failed_internal()
|
|
);
|
|
</script>
|
|
|
|
<div class="rounded-sm border border-line bg-surface p-6 shadow-sm">
|
|
<h2 class="mb-5 font-sans text-xs font-bold tracking-widest text-ink-3 uppercase">
|
|
{m.admin_system_import_heading()}
|
|
</h2>
|
|
<p class="mb-4 text-sm text-ink-2">{m.admin_system_import_description()}</p>
|
|
|
|
{#if importStatus?.state === 'RUNNING'}
|
|
<div class="mb-4 flex items-center gap-3">
|
|
<span
|
|
data-testid="spinner"
|
|
role="status"
|
|
aria-label={m.admin_system_import_status_running()}
|
|
class="inline-block h-5 w-5 animate-spin rounded-full border-2 border-ink-3 border-t-brand-mint motion-reduce:animate-none"
|
|
></span>
|
|
<div>
|
|
<p data-testid="processed-count" class="text-base font-bold text-ink">
|
|
{importStatus.processed}
|
|
</p>
|
|
<p class="font-sans text-xs font-bold tracking-widest text-ink-3 uppercase">
|
|
{m.admin_system_import_status_running()}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
{:else if importStatus?.state === 'DONE'}
|
|
<div class="mb-4 rounded-sm border border-green-200 bg-green-50 p-4 text-green-700">
|
|
<p data-testid="processed-count" class="text-base font-bold">{importStatus.processed}</p>
|
|
<p class="font-sans text-xs font-bold tracking-widest text-green-800 uppercase">
|
|
{m.admin_system_import_status_done_label()}
|
|
</p>
|
|
<p class="mt-1 text-xs text-green-800">{m.admin_system_import_status_done()}</p>
|
|
</div>
|
|
<button
|
|
data-import-trigger
|
|
onclick={ontrigger}
|
|
class="min-h-[44px] rounded-sm bg-primary px-5 py-2 font-sans text-xs font-bold tracking-widest text-primary-fg uppercase transition-opacity hover:opacity-80"
|
|
>
|
|
{m.admin_system_import_btn_retry()}
|
|
</button>
|
|
{:else if importStatus?.state === 'FAILED'}
|
|
<p class="mb-4 rounded-sm border border-red-200 bg-red-50 p-3 text-sm text-red-700">
|
|
{failureMessage}
|
|
</p>
|
|
<button
|
|
data-import-trigger
|
|
onclick={ontrigger}
|
|
class="min-h-[44px] rounded-sm bg-primary px-5 py-2 font-sans text-xs font-bold tracking-widest text-primary-fg uppercase transition-opacity hover:opacity-80"
|
|
>
|
|
{m.admin_system_import_btn_retry()}
|
|
</button>
|
|
{:else}
|
|
{#if importStatus !== null}
|
|
<p class="mb-4 text-sm text-ink-2">{m.admin_system_import_status_idle()}</p>
|
|
{/if}
|
|
<button
|
|
data-import-trigger
|
|
onclick={ontrigger}
|
|
class="min-h-[44px] rounded-sm bg-primary px-5 py-2 font-sans text-xs font-bold tracking-widest text-primary-fg uppercase transition-opacity hover:opacity-80"
|
|
>
|
|
{m.admin_system_import_btn_start()}
|
|
</button>
|
|
{/if}
|
|
</div>
|