refactor(search): extract ChipType to chip-types.ts; audit NL fixtures
Pre-implementation step for #743: ChipType union extracted from InterpretationChipRow and +page.svelte into shared chip-types.ts; resolvedTags/tagsApplied neutral defaults added to test fixtures. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,8 +13,10 @@ const interpretation = {
|
||||
dateFrom: '1914-01-01',
|
||||
dateTo: '1918-12-31',
|
||||
keywords: ['krieg'],
|
||||
resolvedTags: [{ id: '33333333-3333-3333-3333-333333333333', name: 'Weltkrieg', color: 'sage' }],
|
||||
rawQuery: 'Was hat Walter an Emma im Krieg geschrieben?',
|
||||
keywordsApplied: true
|
||||
keywordsApplied: true,
|
||||
tagsApplied: true
|
||||
};
|
||||
|
||||
const nlResponse = {
|
||||
|
||||
@@ -10,6 +10,7 @@ import BulkSelectionBar from '$lib/document/BulkSelectionBar.svelte';
|
||||
import TimelineDensityFilter from '$lib/document/TimelineDensityFilter.svelte';
|
||||
import SmartSearchStatus from '../search/SmartSearchStatus.svelte';
|
||||
import InterpretationChipRow from '../search/InterpretationChipRow.svelte';
|
||||
import type { ChipType } from '../search/chip-types.js';
|
||||
import DisambiguationPicker from '../search/DisambiguationPicker.svelte';
|
||||
import { bulkSelectionStore } from '$lib/document/bulkSelection.svelte';
|
||||
import { getErrorMessage, parseBackendError } from '$lib/shared/errors';
|
||||
@@ -269,8 +270,6 @@ function paramsFromInterpretation(interp: NlQueryInterpretation) {
|
||||
};
|
||||
}
|
||||
|
||||
type ChipType = 'sender' | 'directional' | 'date' | 'keyword';
|
||||
|
||||
function removeChip(type: ChipType, value?: string) {
|
||||
if (!nlInterpretation) return;
|
||||
const p = paramsFromInterpretation(nlInterpretation);
|
||||
|
||||
@@ -3,8 +3,9 @@ import { SvelteSet } from 'svelte/reactivity';
|
||||
import { m } from '$lib/paraglide/messages.js';
|
||||
import type { components } from '$lib/generated/api';
|
||||
|
||||
import type { ChipType } from './chip-types.js';
|
||||
|
||||
type NlQueryInterpretation = components['schemas']['NlQueryInterpretation'];
|
||||
type ChipType = 'sender' | 'directional' | 'date' | 'keyword';
|
||||
|
||||
let {
|
||||
interpretation,
|
||||
|
||||
@@ -17,8 +17,10 @@ const makeInterpretation = (
|
||||
resolvedPersons: [],
|
||||
ambiguousPersons: [],
|
||||
keywords: [],
|
||||
resolvedTags: [],
|
||||
rawQuery: 'test',
|
||||
keywordsApplied: true,
|
||||
tagsApplied: false,
|
||||
...overrides
|
||||
});
|
||||
|
||||
|
||||
1
frontend/src/routes/search/chip-types.ts
Normal file
1
frontend/src/routes/search/chip-types.ts
Normal file
@@ -0,0 +1 @@
|
||||
export type ChipType = 'sender' | 'directional' | 'date' | 'keyword' | 'theme';
|
||||
Reference in New Issue
Block a user