feat(documents): inline relationship pills next to person names
Replaces the standalone "Beziehung" badge at the bottom of the metadata drawer's Personen column with small inline pills attached to each personCard — sender gets labelFromA, the single receiver gets labelFromB. Matches docs/specs/stammbaum-doc-badge-spec.html. Drops the now-unused RelationshipBadge component. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import { m } from '$lib/paraglide/messages.js';
|
||||
import { formatDate } from '$lib/utils/date';
|
||||
import { formatDocumentStatus } from '$lib/utils/documentStatusLabel';
|
||||
import { getInitials, personAvatarColor } from '$lib/utils/personFormat';
|
||||
import RelationshipBadge from '$lib/components/RelationshipBadge.svelte';
|
||||
import RelationshipPill from '$lib/components/RelationshipPill.svelte';
|
||||
|
||||
type Person = { id: string; firstName?: string | null; lastName: string; displayName: string };
|
||||
type Tag = { id: string; name: string };
|
||||
@@ -47,7 +47,7 @@ function getFullName(person: Person): string {
|
||||
}
|
||||
</script>
|
||||
|
||||
{#snippet personCard(person: Person)}
|
||||
{#snippet personCard(person: Person, relationLabel: string | null = null)}
|
||||
<a
|
||||
href="/persons/{person.id}"
|
||||
class="group flex items-center gap-2.5 rounded px-2 py-1.5 transition-colors hover:bg-muted"
|
||||
@@ -59,7 +59,10 @@ function getFullName(person: Person): string {
|
||||
>
|
||||
{getInitials(person.displayName)}
|
||||
</span>
|
||||
<span class="font-serif text-sm text-ink">{getFullName(person)}</span>
|
||||
<span class="min-w-0 truncate font-serif text-sm text-ink">{getFullName(person)}</span>
|
||||
{#if relationLabel}
|
||||
<RelationshipPill label={relationLabel} />
|
||||
{/if}
|
||||
</a>
|
||||
{/snippet}
|
||||
|
||||
@@ -98,7 +101,7 @@ function getFullName(person: Person): string {
|
||||
<p class="mb-1 font-sans text-xs font-medium text-ink-3">
|
||||
{m.doc_details_field_sender()}
|
||||
</p>
|
||||
{@render personCard(sender)}
|
||||
{@render personCard(sender, inferredRelationship?.labelFromA ?? null)}
|
||||
</div>
|
||||
{/if}
|
||||
{#if receivers.length > 0}
|
||||
@@ -107,8 +110,11 @@ function getFullName(person: Person): string {
|
||||
{m.doc_details_field_receivers()}
|
||||
</p>
|
||||
<div class="space-y-0.5">
|
||||
{#each displayedReceivers as receiver (receiver.id)}
|
||||
{@render personCard(receiver)}
|
||||
{#each displayedReceivers as receiver, i (receiver.id)}
|
||||
{@render personCard(
|
||||
receiver,
|
||||
i === 0 ? (inferredRelationship?.labelFromB ?? null) : null
|
||||
)}
|
||||
{/each}
|
||||
</div>
|
||||
{#if hiddenReceiverCount > 0 && !showAllReceivers}
|
||||
@@ -122,12 +128,6 @@ function getFullName(person: Person): string {
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{#if inferredRelationship}
|
||||
<RelationshipBadge
|
||||
labelFromA={inferredRelationship.labelFromA}
|
||||
labelFromB={inferredRelationship.labelFromB}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<p class="font-serif text-sm text-ink-3">{m.doc_details_no_persons()}</p>
|
||||
|
||||
Reference in New Issue
Block a user