mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-29 17:43: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 { CampaignListOmnibox } from '@/components/campaign/shared/CampaignListOmnibox'
|
||||||
import { useCampaignListFilterNavigation } from '@/components/campaign/shared/useCampaignListFilterNavigation'
|
import { useCampaignListFilterNavigation } from '@/components/campaign/shared/useCampaignListFilterNavigation'
|
||||||
import { buildDemandListHref } from '@/utilities/demand/demandListUrl'
|
import { buildDemandListHref, type DemandListState } from '@/utilities/demand/demandListUrl'
|
||||||
import {
|
import {
|
||||||
applyDemandOmniboxSuggestion,
|
applyDemandOmniboxSuggestion,
|
||||||
buildDemandOmniboxChips,
|
buildDemandOmniboxChips,
|
||||||
|
|
@ -12,7 +12,6 @@ import {
|
||||||
clearDemandOmnibox,
|
clearDemandOmnibox,
|
||||||
filterDemandOmniboxSuggestions,
|
filterDemandOmniboxSuggestions,
|
||||||
removeDemandOmniboxChip,
|
removeDemandOmniboxChip,
|
||||||
type DemandListState,
|
|
||||||
type DemandOmniboxAction,
|
type DemandOmniboxAction,
|
||||||
} from '@/utilities/demand/demandOmnibox'
|
} from '@/utilities/demand/demandOmnibox'
|
||||||
|
|
||||||
|
|
@ -60,6 +59,9 @@ export const DemandFilters = ({ state }: { state: DemandListState }) => {
|
||||||
onSelectSuggestion={(suggestionId) => {
|
onSelectSuggestion={(suggestionId) => {
|
||||||
runAction(applyDemandOmniboxSuggestion({ state, suggestionId }))
|
runAction(applyDemandOmniboxSuggestion({ state, suggestionId }))
|
||||||
}}
|
}}
|
||||||
|
onCommitQuery={(text) => {
|
||||||
|
runAction(applyDemandOmniboxSuggestion({ state, suggestionId: `q:${text}` }))
|
||||||
|
}}
|
||||||
onRemoveChip={(chipId) => {
|
onRemoveChip={(chipId) => {
|
||||||
runAction(removeDemandOmniboxChip({ state, chipId }))
|
runAction(removeDemandOmniboxChip({ state, chipId }))
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@ import {
|
||||||
} from '@/lib/schemas/campaignDemand'
|
} from '@/lib/schemas/campaignDemand'
|
||||||
import type { DemandListState } from '@/utilities/demand/demandListUrl'
|
import type { DemandListState } from '@/utilities/demand/demandListUrl'
|
||||||
|
|
||||||
export type { DemandListState }
|
|
||||||
|
|
||||||
export type DemandOmniboxAction =
|
export type DemandOmniboxAction =
|
||||||
| { kind: 'url'; state: DemandListState }
|
| { kind: 'url'; state: DemandListState }
|
||||||
| { kind: 'clear'; 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 === byRequester.slug)).toBe(true)
|
||||||
expect(requesterHits.rows.some((row) => row.slug === byTitle.slug)).toBe(false)
|
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 { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
import { advisorListHrefForPage, parseAdvisorListParams } from '@/utilities/advisorData'
|
import { advisorListHrefForPage, parseAdvisorListParams } from '@/utilities/advisorData'
|
||||||
import { parseDemandListParams } from '@/utilities/campaignDemandData'
|
import { parseDemandListParams } from '@/utilities/demand/demandListUrl'
|
||||||
import { parseOrganizationListParams } from '@/utilities/organizationData'
|
import { parseOrganizationListParams } from '@/utilities/organizationData'
|
||||||
|
|
||||||
const qAndPageParsers = [['advisor', parseAdvisorListParams]] as const
|
const qAndPageParsers = [['advisor', parseAdvisorListParams]] as const
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue