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:
36
frontend/src/lib/components/DashboardResumeStrip.svelte
Normal file
36
frontend/src/lib/components/DashboardResumeStrip.svelte
Normal 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}
|
||||
Reference in New Issue
Block a user