feat(lesereisen): implement lesereisen
All checks were successful
CI / Unit & Component Tests (push) Successful in 4m34s
CI / OCR Service Tests (push) Successful in 27s
CI / Backend Unit Tests (push) Successful in 5m1s
CI / fail2ban Regex (push) Successful in 47s
CI / Semgrep Security Scan (push) Successful in 23s
CI / Compose Bucket Idempotency (push) Successful in 1m11s
All checks were successful
CI / Unit & Component Tests (push) Successful in 4m34s
CI / OCR Service Tests (push) Successful in 27s
CI / Backend Unit Tests (push) Successful in 5m1s
CI / fail2ban Regex (push) Successful in 47s
CI / Semgrep Security Scan (push) Successful in 23s
CI / Compose Bucket Idempotency (push) Successful in 1m11s
This commit was merged in pull request #787.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { formatDate } from '$lib/shared/utils/date';
|
||||
import { m } from '$lib/paraglide/messages.js';
|
||||
|
||||
type Person = { firstName?: string | null; lastName: string; displayName: string };
|
||||
type DocForMeta = {
|
||||
@@ -17,6 +18,19 @@ function djb2(str: string): number {
|
||||
return Math.abs(hash);
|
||||
}
|
||||
|
||||
/** Localized fallback when a person has no name parts. */
|
||||
export function unknownPersonName(): string {
|
||||
return m.person_unknown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Single source for the join-names-or-fallback rule. Mirrors the server-side
|
||||
* fallback in GeschichteService.toView (which emits the literal '[Unbekannt]').
|
||||
*/
|
||||
export function joinNameOrUnknown(firstName?: string | null, lastName?: string | null): string {
|
||||
return [firstName, lastName].filter(Boolean).join(' ').trim() || unknownPersonName();
|
||||
}
|
||||
|
||||
export function getInitials(name: string): string {
|
||||
const words = name.trim().split(/\s+/).filter(Boolean);
|
||||
if (words.length === 0) return '';
|
||||
|
||||
Reference in New Issue
Block a user