Files
familienarchiv/frontend/src/routes/persons/[id]/NameHistoryCard.svelte
Marcel f11d8a38ed feat(frontend): replace all name concatenation with displayName
- Add displayName default method to PersonSummaryDTO
- Update native SQL queries to include title, person_type columns
- Add getInitials() utility to personFormat.ts
- Update abbreviateName/abbreviateCompact for nullable firstName
- Replace firstName+lastName concatenation with displayName in all
  person-displaying components and server load files
- Regenerate API types with displayName on Person and PersonSummaryDTO

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:22:30 +02:00

54 lines
1.2 KiB
Svelte

<script lang="ts">
import { m } from '$lib/paraglide/messages.js';
interface Props {
aliases: Array<{
id: string;
lastName: string;
firstName?: string | null;
type: string;
sortOrder: number;
}>;
personFirstName?: string | null;
}
let { aliases, personFirstName }: Props = $props();
let sorted = $derived([...aliases].sort((a, b) => a.sortOrder - b.sortOrder));
function typeLabel(type: string): string {
switch (type) {
case 'BIRTH':
return m.person_alias_type_BIRTH();
case 'WIDOWED':
return m.person_alias_type_WIDOWED();
case 'DIVORCED':
return m.person_alias_type_DIVORCED();
default:
return m.person_alias_type_OTHER();
}
}
</script>
<div class="rounded-sm border border-line bg-surface p-6 shadow-sm">
<h2 class="mb-5 text-xs font-bold tracking-widest text-ink-3 uppercase">
{m.person_alias_heading()}
</h2>
{#if sorted.length === 0}
<p class="text-sm text-ink-2 italic">{m.person_alias_empty()}</p>
{:else}
<ul class="space-y-2">
{#each sorted as alias (alias.id)}
<li>
<span class="text-ink-2 italic">{typeLabel(alias.type)}</span>
<span class="font-serif text-ink">
{alias.firstName ?? personFirstName}
{alias.lastName}
</span>
</li>
{/each}
</ul>
{/if}
</div>