feat(#145): add DashboardMentions widget component
Shows unread mention notifications as a dashboard widget. Renders nothing when the mentions list is empty. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
38
frontend/src/lib/components/DashboardMentions.svelte
Normal file
38
frontend/src/lib/components/DashboardMentions.svelte
Normal file
@@ -0,0 +1,38 @@
|
||||
<script lang="ts">
|
||||
type NotificationDTO = {
|
||||
id: string;
|
||||
type: 'REPLY' | 'MENTION';
|
||||
documentId?: string;
|
||||
read: boolean;
|
||||
createdAt: string;
|
||||
actorName?: string;
|
||||
};
|
||||
|
||||
interface Props {
|
||||
mentions: NotificationDTO[];
|
||||
}
|
||||
|
||||
let { mentions }: Props = $props();
|
||||
</script>
|
||||
|
||||
{#if mentions.length > 0}
|
||||
<div data-testid="dashboard-mentions" class="border-brand-sand rounded-sm border bg-white p-6">
|
||||
<h2 class="mb-4 font-sans text-xs font-bold tracking-widest text-gray-400 uppercase">
|
||||
Erwähnungen
|
||||
</h2>
|
||||
{#each mentions as mention (mention.id)}
|
||||
<div class="border-brand-sand flex items-center gap-3 border-b py-2 last:border-0">
|
||||
{#if mention.documentId}
|
||||
<a
|
||||
href="/documents/{mention.documentId}"
|
||||
class="font-serif text-sm text-ink hover:text-brand-navy"
|
||||
>
|
||||
{mention.actorName ?? ''}
|
||||
</a>
|
||||
{:else}
|
||||
<span class="font-serif text-sm text-ink">{mention.actorName ?? ''}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user