feat(conversations): add summary with document count and year range (#31)

Shows a summary line above the conversation listing with total document
count and the year span, e.g. "4 Dokumente · 1923–1965".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-20 16:18:48 +01:00
parent ca212e871f
commit 0a1075e03f
4 changed files with 24 additions and 0 deletions

View File

@@ -141,6 +141,7 @@
"conv_no_results_heading": "Keine Dokumente gefunden.",
"conv_no_results_text": "Versuchen Sie, den Zeitraum anzupassen.",
"conv_swap_btn": "Personen tauschen",
"conv_summary": "{count} Dokumente · {yearFrom}{yearTo}",
"admin_heading": "Admin Dashboard",
"admin_tab_users": "Benutzer",

View File

@@ -141,6 +141,7 @@
"conv_no_results_heading": "No documents found.",
"conv_no_results_text": "Try adjusting the time period.",
"conv_swap_btn": "Swap persons",
"conv_summary": "{count} documents · {yearFrom}{yearTo}",
"admin_heading": "Admin Dashboard",
"admin_tab_users": "Users",

View File

@@ -141,6 +141,7 @@
"conv_no_results_heading": "No se encontraron documentos.",
"conv_no_results_text": "Intente ajustar el período de tiempo.",
"conv_swap_btn": "Intercambiar personas",
"conv_summary": "{count} documentos · {yearFrom}{yearTo}",
"admin_heading": "Panel de administración",
"admin_tab_users": "Usuarios",

View File

@@ -14,6 +14,14 @@ let fromDate = $state(untrack(() => data.filters.from));
let toDate = $state(untrack(() => data.filters.to));
let sortDir = $state(untrack(() => data.filters.dir));
const documentYears = $derived(
data.documents
.map((doc) => (doc.documentDate ? new Date(doc.documentDate).getFullYear() : null))
.filter((y): y is number => y !== null)
);
const yearFrom = $derived(documentYears.length > 0 ? Math.min(...documentYears) : null);
const yearTo = $derived(documentYears.length > 0 ? Math.max(...documentYears) : null);
// Sync with server data after navigation
$effect(() => {
senderId = data.filters.senderId;
@@ -191,6 +199,19 @@ function swapPersons() {
<p class="mt-2 text-sm text-gray-400">{m.conv_no_results_text()}</p>
</div>
{:else}
<!-- Summary bar -->
<div class="mb-4">
{#if yearFrom !== null && yearTo !== null}
<p data-testid="conv-summary" class="font-sans text-sm font-medium text-brand-navy/70">
{m.conv_summary({ count: data.documents.length, yearFrom, yearTo })}
</p>
{:else}
<p data-testid="conv-summary" class="font-sans text-sm font-medium text-brand-navy/70">
{data.documents.length}
</p>
{/if}
</div>
<!-- CHAT CONTAINER -->
<div class="relative overflow-hidden rounded-sm border border-brand-sand bg-white shadow-sm">
<!-- Decoration: Central Timeline Line -->