feat(#145): add DashboardResumeStrip component

- Component reads familienarchiv.lastVisited from localStorage and
  shows a 'Zuletzt geöffnet' link to the last-visited document
- Renders nothing when no localStorage entry exists
- Document detail page writes id+title to localStorage on mount

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-29 00:36:33 +01:00
parent 0610f0ee0f
commit 49f71e32ff
3 changed files with 87 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<script lang="ts">
import { onMount } from 'svelte';
interface LastVisited {
id: string;
title: string;
}
let lastVisited = $state<LastVisited | null>(null);
onMount(() => {
try {
const raw = localStorage.getItem('familienarchiv.lastVisited');
if (raw) {
const parsed = JSON.parse(raw) as LastVisited;
if (parsed?.id) {
lastVisited = parsed;
}
}
} catch {
// ignore malformed JSON
}
});
</script>
{#if lastVisited}
<div
data-testid="resume-strip"
class="border-brand-sand flex items-center gap-2 rounded-sm border bg-white px-4 py-3 font-sans text-sm"
>
<span class="text-gray-500">Zuletzt geöffnet:</span>
<a href="/documents/{lastVisited.id}" class="font-medium text-brand-navy hover:underline">
{lastVisited.title || 'Zuletzt geöffnet'}
</a>
</div>
{/if}