From 04ebd2a5bdb89a118825c1abbdb1587dc3353124 Mon Sep 17 00:00:00 2001 From: Marcel Date: Wed, 22 Apr 2026 22:36:20 +0200 Subject: [PATCH] feat(frontend): render DocumentThumbnail in DocumentRow and PersonDocumentList MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Home search rows and person detail sidebars now show the real first-page preview when one exists, falling back to the PDF icon for documents the backfill hasn't processed yet. The old `variant` prop on PersonDocumentList is removed — it tinted the icon differently for sent vs received, which no longer applies with a uniform thumbnail tile. Refs #307 Co-Authored-By: Claude Opus 4.7 --- .../src/lib/components/DocumentRow.svelte | 6 ++++- frontend/src/routes/persons/[id]/+page.svelte | 2 -- .../persons/[id]/PersonDocumentList.svelte | 26 +++++-------------- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/frontend/src/lib/components/DocumentRow.svelte b/frontend/src/lib/components/DocumentRow.svelte index 18766320..0bf9fdfa 100644 --- a/frontend/src/lib/components/DocumentRow.svelte +++ b/frontend/src/lib/components/DocumentRow.svelte @@ -6,6 +6,7 @@ import { formatDate } from '$lib/utils/date'; import * as m from '$lib/paraglide/messages.js'; import ProgressRing from './ProgressRing.svelte'; import ContributorStack from './ContributorStack.svelte'; +import DocumentThumbnail from './DocumentThumbnail.svelte'; type DocumentSearchItem = components['schemas']['DocumentSearchItem']; @@ -37,7 +38,10 @@ function safeTagColor(color: string | null | undefined): string {
  • -
    +
    + + +
    diff --git a/frontend/src/routes/persons/[id]/+page.svelte b/frontend/src/routes/persons/[id]/+page.svelte index 05fc412c..64978be9 100644 --- a/frontend/src/routes/persons/[id]/+page.svelte +++ b/frontend/src/routes/persons/[id]/+page.svelte @@ -72,14 +72,12 @@ const coCorrespondents = $derived.by(() => { documents={sentDocuments} heading={m.person_docs_heading()} emptyMessage={m.person_no_docs()} - variant="sent" />
    diff --git a/frontend/src/routes/persons/[id]/PersonDocumentList.svelte b/frontend/src/routes/persons/[id]/PersonDocumentList.svelte index cedefbf4..64b71cfb 100644 --- a/frontend/src/routes/persons/[id]/PersonDocumentList.svelte +++ b/frontend/src/routes/persons/[id]/PersonDocumentList.svelte @@ -3,14 +3,14 @@ import { m } from '$lib/paraglide/messages.js'; import { formatDate } from '$lib/utils/date'; import { formatDocumentStatus } from '$lib/utils/documentStatusLabel'; import { sortDocumentsByDate, type SortDir } from '$lib/utils/sort'; +import DocumentThumbnail from '$lib/components/DocumentThumbnail.svelte'; const DOCS_PREVIEW_LIMIT = 5; let { documents, heading, - emptyMessage, - variant = 'sent' + emptyMessage }: { documents: { id: string; @@ -19,10 +19,12 @@ let { documentDate?: string | null; location?: string | null; status: string; + contentType?: string; + thumbnailKey?: string; + thumbnailGeneratedAt?: string; }[]; heading: string; emptyMessage: string; - variant?: 'sent' | 'received'; } = $props(); const yearRange = $derived.by(() => { @@ -42,11 +44,6 @@ const sortedDocuments = $derived(sortDocumentsByDate(documents, sortDir)); const visibleDocuments = $derived( showAll ? sortedDocuments : sortedDocuments.slice(0, DOCS_PREVIEW_LIMIT) ); - -// Spec: sent = navy-tint icon bg, received = teal-tint icon bg -const iconClasses = $derived( - variant === 'sent' ? 'bg-primary/10 text-primary' : 'bg-accent/20 text-accent-fg' -);
    @@ -81,17 +78,8 @@ const iconClasses = $derived( href="/documents/{doc.id}" class="group flex items-center gap-3 border-b border-line px-4 py-3 transition-colors last:border-b-0 hover:bg-muted" > - -
    - -
    + +