mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 23:53:05 +00:00
fix(campanha): B140 wire onCommitQuery + simplify import hygiene
Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
This commit is contained in:
parent
59206574e6
commit
7f17a7db79
4 changed files with 12 additions and 5 deletions
|
|
@ -4,7 +4,7 @@ import { useMemo, useState } from 'react'
|
|||
|
||||
import { CampaignListOmnibox } from '@/components/campaign/shared/CampaignListOmnibox'
|
||||
import { useCampaignListFilterNavigation } from '@/components/campaign/shared/useCampaignListFilterNavigation'
|
||||
import { buildDemandListHref } from '@/utilities/demand/demandListUrl'
|
||||
import { buildDemandListHref, type DemandListState } from '@/utilities/demand/demandListUrl'
|
||||
import {
|
||||
applyDemandOmniboxSuggestion,
|
||||
buildDemandOmniboxChips,
|
||||
|
|
@ -12,7 +12,6 @@ import {
|
|||
clearDemandOmnibox,
|
||||
filterDemandOmniboxSuggestions,
|
||||
removeDemandOmniboxChip,
|
||||
type DemandListState,
|
||||
type DemandOmniboxAction,
|
||||
} from '@/utilities/demand/demandOmnibox'
|
||||
|
||||
|
|
@ -60,6 +59,9 @@ export const DemandFilters = ({ state }: { state: DemandListState }) => {
|
|||
onSelectSuggestion={(suggestionId) => {
|
||||
runAction(applyDemandOmniboxSuggestion({ state, suggestionId }))
|
||||
}}
|
||||
onCommitQuery={(text) => {
|
||||
runAction(applyDemandOmniboxSuggestion({ state, suggestionId: `q:${text}` }))
|
||||
}}
|
||||
onRemoveChip={(chipId) => {
|
||||
runAction(removeDemandOmniboxChip({ state, chipId }))
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ import {
|
|||
} from '@/lib/schemas/campaignDemand'
|
||||
import type { DemandListState } from '@/utilities/demand/demandListUrl'
|
||||
|
||||
export type { DemandListState }
|
||||
|
||||
export type DemandOmniboxAction =
|
||||
| { kind: 'url'; state: DemandListState }
|
||||
| { kind: 'clear'; state: DemandListState }
|
||||
|
|
|
|||
|
|
@ -485,6 +485,13 @@ describe('loadDemandListPageData', () => {
|
|||
})
|
||||
expect(requesterHits.rows.some((row) => row.slug === byRequester.slug)).toBe(true)
|
||||
expect(requesterHits.rows.some((row) => row.slug === byTitle.slug)).toBe(false)
|
||||
|
||||
const noMatch = await loadDemandListPageData(payload, coordinator, {
|
||||
page: 1,
|
||||
q: 'zzznomatch',
|
||||
})
|
||||
expect(noMatch.rows.some((row) => row.slug === byTitle.slug)).toBe(false)
|
||||
expect(noMatch.rows.some((row) => row.slug === byRequester.slug)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { advisorListHrefForPage, parseAdvisorListParams } from '@/utilities/advisorData'
|
||||
import { parseDemandListParams } from '@/utilities/campaignDemandData'
|
||||
import { parseDemandListParams } from '@/utilities/demand/demandListUrl'
|
||||
import { parseOrganizationListParams } from '@/utilities/organizationData'
|
||||
|
||||
const qAndPageParsers = [['advisor', parseAdvisorListParams]] as const
|
||||
|
|
|
|||
Loading…
Reference in a new issue