From 5d8bb70255fb5e40787af561cb5bcfb30ea74777 Mon Sep 17 00:00:00 2001 From: Marcel Date: Wed, 27 May 2026 18:50:18 +0200 Subject: [PATCH] feat(documents): explain that a date range excludes undated documents DocumentList gains from/to props; when a date range is active and yields no results, the empty state shows the localized docs_range_excludes_undated note instead of the generic copy, so the reader understands undated letters aren't part of a range. Person-grouped modes keep undated letters under their sender/receiver (badge-on-row, no synthetic sub-group). Refs #668 --- frontend/src/routes/DocumentList.svelte | 19 ++++- .../src/routes/DocumentList.svelte.spec.ts | 83 +++++++++++++++++++ frontend/src/routes/documents/+page.svelte | 2 + 3 files changed, 102 insertions(+), 2 deletions(-) diff --git a/frontend/src/routes/DocumentList.svelte b/frontend/src/routes/DocumentList.svelte index 8d29c870..e0cc4d17 100644 --- a/frontend/src/routes/DocumentList.svelte +++ b/frontend/src/routes/DocumentList.svelte @@ -15,7 +15,9 @@ let { error, total = 0, q = '', - sort = 'DATE' + sort = 'DATE', + from = '', + to = '' }: { items: DocumentListItem[]; canWrite: boolean; @@ -23,8 +25,15 @@ let { total?: number; q?: string; sort?: SortMode; + from?: string; + to?: string; } = $props(); +// A from/to range excludes undated documents — when it yields nothing, the +// empty state must say so explicitly (a localized constant, never a reflected +// backend string). Issue #668. +const hasDateRange = $derived(!!from || !!to); + const groups = $derived.by(() => { if (sort === 'SENDER') return groupBySender(items); if (sort === 'RECEIVER') return groupByReceiver(items); @@ -119,7 +128,13 @@ function groupByReceiver(docItems: DocumentListItem[]) {

{m.docs_empty_heading()}

- {q ? m.docs_empty_for_term({ term: q }) : m.docs_empty_text()} + {#if hasDateRange} + {m.docs_range_excludes_undated()} + {:else if q} + {m.docs_empty_for_term({ term: q })} + {:else} + {m.docs_empty_text()} + {/if}