fix(hover-card): use orientation-aware relationship labels; allow spaces in mention
Some checks failed
CI / Unit & Component Tests (push) Failing after 3m35s
CI / OCR Service Tests (push) Successful in 39s
CI / Backend Unit Tests (push) Failing after 3m6s
CI / Unit & Component Tests (pull_request) Failing after 4m38s
CI / OCR Service Tests (pull_request) Successful in 42s
CI / Backend Unit Tests (pull_request) Failing after 3m5s

PersonHoverCard was showing the hovered person as their own parent when stored
as the object side of a PARENT_OF row — now uses chipLabel/otherName from
relationshipLabels (same helpers the person detail page uses) to resolve the
correct name and label from the caller's perspective.

PersonMentionEditor: add allowSpaces:true so typing a last name after a space
no longer exits mention mode mid-query.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-29 19:22:37 +02:00
parent 835dc77382
commit 7ccd541d40
3 changed files with 29 additions and 15 deletions

View File

@@ -1,6 +1,7 @@
<script lang="ts">
import { m } from '$lib/paraglide/messages.js';
import { formatLifeDateRange } from '$lib/utils/personLifeDates';
import { chipLabel, otherName } from '$lib/relationshipLabels';
import type { components } from '$lib/generated/api';
import type { LoadState } from '$lib/types/personHoverCard';
@@ -22,19 +23,6 @@ const FAMILY_REL_TYPES: ReadonlySet<RelationshipDTO['relationType']> = new Set([
'SPOUSE_OF',
'SIBLING_OF'
]);
function relationLabel(type: RelationshipDTO['relationType']): string {
switch (type) {
case 'PARENT_OF':
return m.relation_parent_of();
case 'SPOUSE_OF':
return m.relation_spouse_of();
case 'SIBLING_OF':
return m.relation_sibling_of();
default:
return m.relation_other();
}
}
const NOTES_MAX = 120;
const familyChips = $derived(
@@ -136,8 +124,8 @@ const ariaBusy = $derived(state.status === 'loading');
<div class="chips" data-testid="person-hover-card-chips">
{#each familyChips as chip (chip.id)}
<span class="chip">
<span class="chip-type">{relationLabel(chip.relationType)}</span>
{chip.relatedPersonDisplayName}
<span class="chip-type">{chipLabel(chip, personId)}</span>
{otherName(chip, personId)}
</span>
{/each}
</div>