feat(search): case-appropriate disambiguation picker copy (#763)

A 1-item picker now reads "Meintest du …?" (a single direct match auto-selects
and never reaches the picker), while ≥2 keeps the "Person auswählen" framing.
The prompt lives in a visible, non-truncated panel heading (the trigger span
clips at 320px), and the "(auswählen…)" cue is dropped for the 1-item case.
DisambiguationPicker takes heading + showCue props; the page derives both from
ambiguousPersons.length. New search_disambiguation_did_you_mean key in de/en/es.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-06-07 01:14:25 +02:00
committed by marcel
parent f1bb9d3a69
commit 0ef4f4f07c
6 changed files with 80 additions and 25 deletions

View File

@@ -57,7 +57,16 @@ let nlResult = $state<DocumentSearchResult | null>(null);
const showNlView = $derived(smartMode && nlSubmitted);
const nlHasResults = $derived((nlResult?.items.length ?? 0) > 0);
const nlIsAmbiguous = $derived((nlInterpretation?.ambiguousPersons.length ?? 0) > 0);
const ambiguousPersons = $derived(nlInterpretation?.ambiguousPersons ?? []);
const nlIsAmbiguous = $derived(ambiguousPersons.length > 0);
// A 1-item picker is always a "did you mean …?" suggestion (a single direct match auto-selects
// and never reaches the picker); ≥2 keeps the "choose a person" framing and the action cue.
const disambiguationHeading = $derived(
ambiguousPersons.length === 1
? m.search_disambiguation_did_you_mean({ name: ambiguousPersons[0].displayName })
: m.search_disambiguation_heading()
);
const showDisambiguationCue = $derived(ambiguousPersons.length >= 2);
function hasAdvancedFilters() {
return (
@@ -442,6 +451,8 @@ $effect(() => {
{#if nlIsAmbiguous}
<DisambiguationPicker
persons={nlInterpretation.ambiguousPersons}
heading={disambiguationHeading}
showCue={showDisambiguationCue}
onSelect={selectDisambiguated}
/>
{:else}