Files
familienarchiv/frontend/src/lib/components/DashboardRecentDocuments.svelte
Marcel adba3058b4
Some checks failed
CI / Unit & Component Tests (push) Has been cancelled
CI / Backend Unit Tests (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Unit & Component Tests (pull_request) Successful in 2m38s
CI / Backend Unit Tests (pull_request) Failing after 2m20s
CI / E2E Tests (pull_request) Failing after 1h16m46s
style(#145): bump dashboard widget content links to text-lg
Box content links (document titles, actor names) raised from text-sm to
text-lg for improved readability and touch target size. "Show all" stays
at text-sm to maintain hierarchy — box links are the primary action.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 12:18:13 +02:00

53 lines
1.3 KiB
Svelte

<script lang="ts">
import * as m from '$lib/paraglide/messages.js';
import { getLocale } from '$lib/paraglide/runtime.js';
type Document = {
id: string;
title: string;
updatedAt?: string;
sender?: { id: string; firstName: string; lastName: string };
};
interface Props {
recentDocs: Document[];
}
let { recentDocs }: Props = $props();
function formatDate(dateStr: string): string {
// updatedAt is a full ISO datetime — no T12:00:00 noon-anchor needed here
return new Intl.DateTimeFormat(getLocale(), {
day: 'numeric',
month: 'long',
year: 'numeric'
}).format(new Date(dateStr));
}
</script>
{#if recentDocs.length > 0}
<div data-testid="dashboard-recent-docs" class="rounded-sm border border-line bg-surface p-6">
<h2 class="mb-4 font-sans text-xs font-bold tracking-widest text-gray-400 uppercase">
{m.dashboard_recent_heading()}
</h2>
{#each recentDocs as doc (doc.id)}
<div class="flex items-center justify-between border-b border-line py-2 last:border-0">
<a
href="/documents/{doc.id}"
class="font-serif text-lg text-ink hover:text-ink-2 hover:underline"
>
{doc.title}
</a>
{#if doc.updatedAt}
<span
data-testid="doc-date-{doc.id}"
class="ml-2 shrink-0 font-sans text-xs text-gray-400"
>
{formatDate(doc.updatedAt)}
</span>
{/if}
</div>
{/each}
</div>
{/if}