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>
This commit is contained in:
Marcel
2026-04-08 12:22:30 +02:00
parent 0ce803c7f1
commit f11d8a38ed
32 changed files with 117 additions and 77 deletions

View File

@@ -99,13 +99,12 @@ function handleSearch() {
<div
class="flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-primary font-serif text-base font-bold text-primary-fg transition-colors"
>
{person.firstName?.[0]}{person.lastName?.[0]}
{person.firstName ? person.firstName[0] : person.lastName[0]}{person.lastName[0]}
</div>
<!-- Name -->
<p class="font-serif text-sm font-bold text-ink group-hover:underline">
{person.firstName}
{person.lastName}
{person.displayName}
</p>
<!-- Alias -->

View File

@@ -23,7 +23,7 @@ const coCorrespondents = $derived.by(() => {
else
freq.set(key, {
id: receiver.id,
name: `${receiver.firstName} ${receiver.lastName}`,
name: receiver.displayName,
count: 1
});
}
@@ -37,7 +37,7 @@ const coCorrespondents = $derived.by(() => {
else
freq.set(key, {
id: doc.sender.id,
name: `${doc.sender.firstName} ${doc.sender.lastName}`,
name: doc.sender.displayName,
count: 1
});
}

View File

@@ -9,7 +9,7 @@ interface Props {
type: string;
sortOrder: number;
}>;
personFirstName: string;
personFirstName?: string | null;
}
let { aliases, personFirstName }: Props = $props();

View File

@@ -8,8 +8,9 @@ let {
}: {
person: {
id: string;
firstName: string;
firstName?: string | null;
lastName: string;
displayName: string;
alias?: string | null;
birthYear?: number | null;
deathYear?: number | null;
@@ -29,14 +30,13 @@ let {
<div
class="flex h-16 w-16 items-center justify-center rounded-full bg-primary font-serif text-xl font-bold text-primary-fg"
>
{person.firstName[0]}{person.lastName[0]}
{person.firstName ? person.firstName[0] : person.lastName[0]}{person.lastName[0]}
</div>
</div>
<!-- Name — centered, serif -->
<h1 class="mb-1 text-center font-serif text-xl font-bold text-ink">
{person.firstName}
{person.lastName}
{person.displayName}
</h1>
<!-- Alias — centered, italic -->

View File

@@ -7,7 +7,7 @@ let {
person,
form
}: {
person: { firstName: string; lastName: string };
person: { displayName: string };
form?: { mergeError?: string } | null;
} = $props();
@@ -74,7 +74,7 @@ let showMergeConfirm = $state(false);
{#if showMergeConfirm}
<p class="mt-3 rounded border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700">
{m.person_merge_warning()} <strong>{person.firstName} {person.lastName}</strong>
{m.person_merge_warning()} <strong>{person.displayName}</strong>
{m.person_merge_will_be_deleted()}
</p>
{/if}

View File

@@ -30,8 +30,7 @@ const person = $derived(data.person);
d="M10 19l-7-7m0 0l7-7m-7 7h18"
/>
</svg>
{person.firstName}
{person.lastName}
{person.displayName}
</a>
<h1 class="font-serif text-3xl text-ink">{m.person_edit_heading()}</h1>
</div>

View File

@@ -6,7 +6,7 @@ let {
person,
form
}: {
person: { id: string; firstName: string; lastName: string };
person: { id: string; firstName?: string | null; lastName: string; displayName: string };
form?: { mergeError?: string } | null;
} = $props();

View File

@@ -5,7 +5,7 @@ let {
person
}: {
person: {
firstName: string;
firstName?: string | null;
lastName: string;
alias?: string | null;
birthYear?: number | null;