From f241a717333ec4e92f14fdc67134c5210ff158f1 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 14 Apr 2026 13:08:08 +0200 Subject: [PATCH] feat(frontend): limit training history to 3 runs with expand toggle Both training panels (OCR and segmentation) share TrainingHistory. Show only the 3 most recent runs by default; render a Mehr/Weniger anzeigen button when there are more. Co-Authored-By: Claude Sonnet 4.6 --- .../src/lib/components/TrainingHistory.svelte | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/components/TrainingHistory.svelte b/frontend/src/lib/components/TrainingHistory.svelte index ea194cd4..3409cf59 100644 --- a/frontend/src/lib/components/TrainingHistory.svelte +++ b/frontend/src/lib/components/TrainingHistory.svelte @@ -20,6 +20,12 @@ interface Props { let { runs }: Props = $props(); +const COLLAPSED_COUNT = 3; +let expanded = $state(false); + +const visibleRuns = $derived(expanded ? runs : runs.slice(0, COLLAPSED_COUNT)); +const hasMore = $derived(runs.length > COLLAPSED_COUNT); + const dateFormatter = new Intl.DateTimeFormat('de-DE', { day: 'numeric', month: 'short', @@ -54,7 +60,7 @@ function formatCer(cer: number | undefined | null): string { {:else} - {#each runs as run (run.id)} + {#each visibleRuns as run (run.id)} {formatDate(run.createdAt)} @@ -117,3 +123,15 @@ function formatCer(cer: number | undefined | null): string { {/if} + +{#if hasMore} +
+ +
+{/if}