feat(search): show result count and term-aware empty state in DocumentList

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-06 14:03:16 +02:00
parent 78fdb01ec1
commit 07dbe152e2
3 changed files with 69 additions and 3 deletions

View File

@@ -6,7 +6,9 @@ import { formatDate } from '$lib/utils/date';
let {
documents,
canWrite,
error
error,
total = 0,
q = ''
}: {
documents: {
id: string;
@@ -20,6 +22,8 @@ let {
}[];
canWrite: boolean;
error?: string | null;
total?: number;
q?: string;
} = $props();
</script>
@@ -41,6 +45,11 @@ let {
{/if}
</div>
<!-- RESULT COUNT -->
{#if total > 0}
<p class="mb-3 font-sans text-sm text-ink-2">{m.docs_result_count({ count: total })}</p>
{/if}
<!-- DOCUMENT LIST -->
<div class="border border-line bg-surface shadow-sm">
{#if error}
@@ -162,7 +171,7 @@ let {
</div>
<h3 class="font-serif text-lg font-medium text-ink">{m.docs_empty_heading()}</h3>
<p class="mt-1 font-sans text-sm text-ink-2">
{m.docs_empty_text()}
{q ? m.docs_empty_for_term({ term: q }) : m.docs_empty_text()}
</p>
<button
onclick={() => goto('/')}