mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-25 11:13:09 +00:00
chore: format + e2e manifest mappings for B128 omnibox modules
This commit is contained in:
parent
0903576f9e
commit
f59d4a6736
18 changed files with 73 additions and 42 deletions
|
|
@ -46,6 +46,7 @@ export const E2E_AFFECTED_MANIFEST = [
|
||||||
`${CAMPAIGN_APP}/atividades`,
|
`${CAMPAIGN_APP}/atividades`,
|
||||||
'src/components/campaign/activity',
|
'src/components/campaign/activity',
|
||||||
'src/utilities/activity',
|
'src/utilities/activity',
|
||||||
|
'src/utilities/activityOmnibox',
|
||||||
'src/lib/activityQuickActions',
|
'src/lib/activityQuickActions',
|
||||||
],
|
],
|
||||||
specs: ['campaignActivity'],
|
specs: ['campaignActivity'],
|
||||||
|
|
@ -107,6 +108,15 @@ export const E2E_AFFECTED_MANIFEST = [
|
||||||
'src/components/campaign/supporter',
|
'src/components/campaign/supporter',
|
||||||
'src/components/campaign/votePledge',
|
'src/components/campaign/votePledge',
|
||||||
'src/components/campaign/auth',
|
'src/components/campaign/auth',
|
||||||
|
'src/lib/searchOnlyListOmnibox',
|
||||||
|
'src/utilities/advisor',
|
||||||
|
'src/utilities/advisorData',
|
||||||
|
'src/utilities/campaignDemandData',
|
||||||
|
'src/utilities/demand',
|
||||||
|
'src/utilities/organization',
|
||||||
|
'src/utilities/organizationData',
|
||||||
|
'src/utilities/stateDeputyOmnibox',
|
||||||
|
'src/utilities/supporter/supporterOmnibox',
|
||||||
`${CAMPAIGN_APP}/acoes`,
|
`${CAMPAIGN_APP}/acoes`,
|
||||||
'src/components/campaign/shared/WizardMunicipality',
|
'src/components/campaign/shared/WizardMunicipality',
|
||||||
'src/components/campaign/shared/useCampaignListFilterNavigation',
|
'src/components/campaign/shared/useCampaignListFilterNavigation',
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { useMemo, useState } from 'react'
|
import { useMemo, useState } from 'react'
|
||||||
|
|
||||||
import type { RelationOption } from '@/components/campaign/shared/RelationMultiSelect'
|
|
||||||
import { CampaignListOmnibox } from '@/components/campaign/shared/CampaignListOmnibox'
|
import { CampaignListOmnibox } from '@/components/campaign/shared/CampaignListOmnibox'
|
||||||
|
import type { RelationOption } from '@/components/campaign/shared/RelationMultiSelect'
|
||||||
import { useCampaignListFilterNavigation } from '@/components/campaign/shared/useCampaignListFilterNavigation'
|
import { useCampaignListFilterNavigation } from '@/components/campaign/shared/useCampaignListFilterNavigation'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import {
|
import {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +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 {
|
import {
|
||||||
applyDemandOmniboxSuggestion,
|
applyDemandOmniboxSuggestion,
|
||||||
buildDemandOmniboxChips,
|
buildDemandOmniboxChips,
|
||||||
|
|
@ -14,7 +15,6 @@ import {
|
||||||
type DemandListState,
|
type DemandListState,
|
||||||
type DemandOmniboxAction,
|
type DemandOmniboxAction,
|
||||||
} from '@/utilities/demand/demandOmnibox'
|
} from '@/utilities/demand/demandOmnibox'
|
||||||
import { buildDemandListHref } from '@/utilities/demand/demandListUrl'
|
|
||||||
|
|
||||||
export const DemandFilters = ({ state }: { state: DemandListState }) => {
|
export const DemandFilters = ({ state }: { state: DemandListState }) => {
|
||||||
const { navigate, isPending } = useCampaignListFilterNavigation({
|
const { navigate, isPending } = useCampaignListFilterNavigation({
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,11 @@ 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 { buildTerritoryListHref, type TerritoryListState } from '@/utilities/territory/territoryListUrl'
|
|
||||||
import type { TerritoryFilterOption } from '@/utilities/territory/territoryListFilters'
|
import type { TerritoryFilterOption } from '@/utilities/territory/territoryListFilters'
|
||||||
|
import {
|
||||||
|
buildTerritoryListHref,
|
||||||
|
type TerritoryListState,
|
||||||
|
} from '@/utilities/territory/territoryListUrl'
|
||||||
import {
|
import {
|
||||||
applyTerritoryOmniboxSuggestion,
|
applyTerritoryOmniboxSuggestion,
|
||||||
buildTerritoryOmniboxChips,
|
buildTerritoryOmniboxChips,
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,10 @@ export const OrganizationFilters = ({ state }: { state: OrganizationListState })
|
||||||
})
|
})
|
||||||
const [query, setQuery] = useState('')
|
const [query, setQuery] = useState('')
|
||||||
|
|
||||||
const withPageReset = (next: OrganizationListState): OrganizationListState => ({ ...next, page: 1 })
|
const withPageReset = (next: OrganizationListState): OrganizationListState => ({
|
||||||
|
...next,
|
||||||
|
page: 1,
|
||||||
|
})
|
||||||
|
|
||||||
const chips = useMemo(() => buildSearchOnlyOmniboxChips(state), [state])
|
const chips = useMemo(() => buildSearchOnlyOmniboxChips(state), [state])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,9 @@
|
||||||
|
|
||||||
import { useMemo, useState } from 'react'
|
import { useMemo, useState } from 'react'
|
||||||
|
|
||||||
import type { RelationOption } from '@/components/campaign/shared/RelationMultiSelect'
|
|
||||||
import { CampaignListOmnibox } from '@/components/campaign/shared/CampaignListOmnibox'
|
import { CampaignListOmnibox } from '@/components/campaign/shared/CampaignListOmnibox'
|
||||||
|
import type { RelationOption } from '@/components/campaign/shared/RelationMultiSelect'
|
||||||
import { useCampaignListFilterNavigation } from '@/components/campaign/shared/useCampaignListFilterNavigation'
|
import { useCampaignListFilterNavigation } from '@/components/campaign/shared/useCampaignListFilterNavigation'
|
||||||
import { municipalityComboboxOptions } from '@/utilities/territory/territoryComboboxOptions'
|
|
||||||
import {
|
import {
|
||||||
applySupporterOmniboxSuggestion,
|
applySupporterOmniboxSuggestion,
|
||||||
buildSupporterOmniboxChips,
|
buildSupporterOmniboxChips,
|
||||||
|
|
@ -16,6 +15,7 @@ import {
|
||||||
type SupporterOmniboxAction,
|
type SupporterOmniboxAction,
|
||||||
} from '@/utilities/supporter/supporterOmnibox'
|
} from '@/utilities/supporter/supporterOmnibox'
|
||||||
import { buildSupporterListHref, type SupporterListState } from '@/utilities/supporter/supporterUi'
|
import { buildSupporterListHref, type SupporterListState } from '@/utilities/supporter/supporterUi'
|
||||||
|
import { municipalityComboboxOptions } from '@/utilities/territory/territoryComboboxOptions'
|
||||||
|
|
||||||
export const SupporterFilters = ({
|
export const SupporterFilters = ({
|
||||||
state,
|
state,
|
||||||
|
|
@ -39,7 +39,8 @@ export const SupporterFilters = ({
|
||||||
}, [municipalityOptions])
|
}, [municipalityOptions])
|
||||||
|
|
||||||
const cityOptions = useMemo(
|
const cityOptions = useMemo(
|
||||||
() => municipalityComboboxOptions().map((option) => ({ value: option.value, label: option.label })),
|
() =>
|
||||||
|
municipalityComboboxOptions().map((option) => ({ value: option.value, label: option.label })),
|
||||||
[],
|
[],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,12 @@ export type SearchOnlyOmniboxAction<T extends SearchOnlyListState> =
|
||||||
|
|
||||||
const chipLabel = (dimension: string, value: string): string => `${dimension}: ${value}`
|
const chipLabel = (dimension: string, value: string): string => `${dimension}: ${value}`
|
||||||
|
|
||||||
export const buildSearchOnlyOmniboxChips = (state: SearchOnlyListState): CampaignListOmniboxChip[] =>
|
export const buildSearchOnlyOmniboxChips = (
|
||||||
state.q ? [{ id: 'q', label: chipLabel('Busca', state.q) }] : []
|
state: SearchOnlyListState,
|
||||||
|
): CampaignListOmniboxChip[] => (state.q ? [{ id: 'q', label: chipLabel('Busca', state.q) }] : [])
|
||||||
|
|
||||||
export const buildSearchOnlyOmniboxSuggestions = (
|
export const buildSearchOnlyOmniboxSuggestions = (query: string): CampaignListOmniboxSuggestion[] =>
|
||||||
query: string,
|
filterOmniboxSuggestionSeeds([], query)
|
||||||
): CampaignListOmniboxSuggestion[] => filterOmniboxSuggestionSeeds([], query)
|
|
||||||
|
|
||||||
export const applySearchOnlyOmniboxSuggestion = <T extends SearchOnlyListState>({
|
export const applySearchOnlyOmniboxSuggestion = <T extends SearchOnlyListState>({
|
||||||
state,
|
state,
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
* Activity list omnibox adapter (B128). Pure / client-safe.
|
* Activity list omnibox adapter (B128). Pure / client-safe.
|
||||||
* Tab preset stays outside the omnibox (product map).
|
* Tab preset stays outside the omnibox (product map).
|
||||||
*/
|
*/
|
||||||
import { activityKindLabels, activityStatusLabels } from '@/lib/schemas/activity'
|
|
||||||
import {
|
import {
|
||||||
createOmniboxSuggestionSeed,
|
createOmniboxSuggestionSeed,
|
||||||
filterOmniboxSuggestionSeeds,
|
filterOmniboxSuggestionSeeds,
|
||||||
type CampaignListOmniboxChip,
|
type CampaignListOmniboxChip,
|
||||||
type CampaignListOmniboxSuggestion,
|
type CampaignListOmniboxSuggestion,
|
||||||
} from '@/lib/campaignListOmnibox'
|
} from '@/lib/campaignListOmnibox'
|
||||||
|
import { activityKindLabels, activityStatusLabels } from '@/lib/schemas/activity'
|
||||||
import {
|
import {
|
||||||
buildActivityListSearchParams,
|
buildActivityListSearchParams,
|
||||||
parseActivityListParams,
|
parseActivityListParams,
|
||||||
|
|
@ -29,8 +29,9 @@ const chipLabel = (dimension: string, value: string): string => `${dimension}: $
|
||||||
|
|
||||||
const withPageReset = (state: ActivityListState): ActivityListState => ({ ...state, page: 1 })
|
const withPageReset = (state: ActivityListState): ActivityListState => ({ ...state, page: 1 })
|
||||||
|
|
||||||
const parseStateFromParams = (raw: Record<string, string | string[] | undefined>): ActivityListState =>
|
const parseStateFromParams = (
|
||||||
parseActivityListParams(raw)
|
raw: Record<string, string | string[] | undefined>,
|
||||||
|
): ActivityListState => parseActivityListParams(raw)
|
||||||
|
|
||||||
const setExclusiveField = (
|
const setExclusiveField = (
|
||||||
state: ActivityListState,
|
state: ActivityListState,
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ import {
|
||||||
type AdvisorListState,
|
type AdvisorListState,
|
||||||
} from '@/utilities/advisor/advisorListUrl'
|
} from '@/utilities/advisor/advisorListUrl'
|
||||||
|
|
||||||
export type { AdvisorListState }
|
|
||||||
export { advisorListHrefForPage, parseAdvisorListParams }
|
export { advisorListHrefForPage, parseAdvisorListParams }
|
||||||
|
export type { AdvisorListState }
|
||||||
|
|
||||||
type AdvisorMunicipalityViewModel = {
|
type AdvisorMunicipalityViewModel = {
|
||||||
id: number
|
id: number
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ import {
|
||||||
loadMunicipalityLabelsByIds,
|
loadMunicipalityLabelsByIds,
|
||||||
} from '@/utilities/loadNamesByIds'
|
} from '@/utilities/loadNamesByIds'
|
||||||
|
|
||||||
export type { DemandListState }
|
|
||||||
export { buildDemandListHref, parseDemandListParams }
|
export { buildDemandListHref, parseDemandListParams }
|
||||||
|
export type { DemandListState }
|
||||||
|
|
||||||
const demandPageSize = 25
|
const demandPageSize = 25
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,10 @@ export const parseDemandListParams = (searchParams: RawSearchParams): DemandList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const buildDemandListSearchParams = (state: DemandListState, page = state.page): URLSearchParams => {
|
const buildDemandListSearchParams = (
|
||||||
|
state: DemandListState,
|
||||||
|
page = state.page,
|
||||||
|
): URLSearchParams => {
|
||||||
const params = new URLSearchParams()
|
const params = new URLSearchParams()
|
||||||
if (state.status) params.set('status', state.status)
|
if (state.status) params.set('status', state.status)
|
||||||
if (state.kind) params.set('kind', state.kind)
|
if (state.kind) params.set('kind', state.kind)
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,17 @@
|
||||||
* Demand list omnibox adapter (B128). Status-only; kind/activity deep-links
|
* Demand list omnibox adapter (B128). Status-only; kind/activity deep-links
|
||||||
* stay URL-only without new list UI. Pure / client-safe.
|
* stay URL-only without new list UI. Pure / client-safe.
|
||||||
*/
|
*/
|
||||||
import {
|
|
||||||
campaignDemandStatusLabels,
|
|
||||||
campaignDemandStatuses,
|
|
||||||
type CampaignDemandStatus,
|
|
||||||
} from '@/lib/schemas/campaignDemand'
|
|
||||||
import {
|
import {
|
||||||
createOmniboxSuggestionSeed,
|
createOmniboxSuggestionSeed,
|
||||||
filterOmniboxSuggestionSeeds,
|
filterOmniboxSuggestionSeeds,
|
||||||
type CampaignListOmniboxChip,
|
type CampaignListOmniboxChip,
|
||||||
type CampaignListOmniboxSuggestion,
|
type CampaignListOmniboxSuggestion,
|
||||||
} from '@/lib/campaignListOmnibox'
|
} from '@/lib/campaignListOmnibox'
|
||||||
|
import {
|
||||||
|
campaignDemandStatusLabels,
|
||||||
|
campaignDemandStatuses,
|
||||||
|
type CampaignDemandStatus,
|
||||||
|
} from '@/lib/schemas/campaignDemand'
|
||||||
import type { DemandListState } from '@/utilities/demand/demandListUrl'
|
import type { DemandListState } from '@/utilities/demand/demandListUrl'
|
||||||
|
|
||||||
export type { DemandListState }
|
export type { DemandListState }
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,10 @@ import {
|
||||||
type CampaignListOmniboxChip,
|
type CampaignListOmniboxChip,
|
||||||
type CampaignListOmniboxSuggestion,
|
type CampaignListOmniboxSuggestion,
|
||||||
} from '@/lib/campaignListOmnibox'
|
} from '@/lib/campaignListOmnibox'
|
||||||
|
import {
|
||||||
|
leadershipAccessFilterLabels,
|
||||||
|
supportStatusLabels,
|
||||||
|
} from '@/utilities/leadership/leadershipLabels'
|
||||||
import {
|
import {
|
||||||
clearLeadershipListFilters,
|
clearLeadershipListFilters,
|
||||||
leadershipAccessFilterOptions,
|
leadershipAccessFilterOptions,
|
||||||
|
|
@ -23,10 +27,6 @@ import {
|
||||||
type LeadershipListSortKey,
|
type LeadershipListSortKey,
|
||||||
type LeadershipListState,
|
type LeadershipListState,
|
||||||
} from '@/utilities/leadership/leadershipListUrl'
|
} from '@/utilities/leadership/leadershipListUrl'
|
||||||
import {
|
|
||||||
leadershipAccessFilterLabels,
|
|
||||||
supportStatusLabels,
|
|
||||||
} from '@/utilities/leadership/leadershipLabels'
|
|
||||||
|
|
||||||
const DEFAULT_LEADERSHIP_LIST_SORT_KEY: LeadershipListSortKey = 'updatedAt'
|
const DEFAULT_LEADERSHIP_LIST_SORT_KEY: LeadershipListSortKey = 'updatedAt'
|
||||||
const DEFAULT_LEADERSHIP_LIST_SORT_DIR: LeadershipListSortDirection = 'desc'
|
const DEFAULT_LEADERSHIP_LIST_SORT_DIR: LeadershipListSortDirection = 'desc'
|
||||||
|
|
@ -95,7 +95,9 @@ export const buildLeadershipOmniboxChips = ({
|
||||||
|
|
||||||
if (!isDefaultLeadershipListSort(state)) {
|
if (!isDefaultLeadershipListSort(state)) {
|
||||||
const { sort, dir } = resolveLeadershipListSort(state)
|
const { sort, dir } = resolveLeadershipListSort(state)
|
||||||
const option = leadershipListSortOptions.find((entry) => entry.key === sort && entry.dir === dir)
|
const option = leadershipListSortOptions.find(
|
||||||
|
(entry) => entry.key === sort && entry.dir === dir,
|
||||||
|
)
|
||||||
chips.push({
|
chips.push({
|
||||||
id: 'sort',
|
id: 'sort',
|
||||||
label: chipLabel('Ordenação', option?.label ?? `${sort} ${dir}`),
|
label: chipLabel('Ordenação', option?.label ?? `${sort} ${dir}`),
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,15 @@ import { relationshipId } from '@/lib/relationship'
|
||||||
import type { OrganizationKind } from '@/lib/schemas/organization'
|
import type { OrganizationKind } from '@/lib/schemas/organization'
|
||||||
import type { CampaignUser, Organization } from '@/payload-types'
|
import type { CampaignUser, Organization } from '@/payload-types'
|
||||||
import type { ActivityStatus } from '@/utilities/activityUi'
|
import type { ActivityStatus } from '@/utilities/activityUi'
|
||||||
|
import { loadMunicipalityLabelsByIds } from '@/utilities/loadNamesByIds'
|
||||||
import {
|
import {
|
||||||
buildOrganizationListHref,
|
buildOrganizationListHref,
|
||||||
parseOrganizationListParams,
|
parseOrganizationListParams,
|
||||||
type OrganizationListState,
|
type OrganizationListState,
|
||||||
} from '@/utilities/organization/organizationListUrl'
|
} from '@/utilities/organization/organizationListUrl'
|
||||||
import { loadMunicipalityLabelsByIds } from '@/utilities/loadNamesByIds'
|
|
||||||
|
|
||||||
export type { OrganizationListState }
|
|
||||||
export { buildOrganizationListHref, parseOrganizationListParams }
|
export { buildOrganizationListHref, parseOrganizationListParams }
|
||||||
|
export type { OrganizationListState }
|
||||||
|
|
||||||
const organizationPageSize = 25
|
const organizationPageSize = 25
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,9 @@ const isDefaultStateDeputyListSort = (state: StateDeputyListState): boolean => {
|
||||||
const partyChipLabel = (party: string): string =>
|
const partyChipLabel = (party: string): string =>
|
||||||
party === NO_PARTY_FILTER_VALUE ? noPartyFilterLabel : party
|
party === NO_PARTY_FILTER_VALUE ? noPartyFilterLabel : party
|
||||||
|
|
||||||
export const buildStateDeputyOmniboxChips = (state: StateDeputyListState): CampaignListOmniboxChip[] => {
|
export const buildStateDeputyOmniboxChips = (
|
||||||
|
state: StateDeputyListState,
|
||||||
|
): CampaignListOmniboxChip[] => {
|
||||||
const chips: CampaignListOmniboxChip[] = []
|
const chips: CampaignListOmniboxChip[] = []
|
||||||
|
|
||||||
if (state.q) chips.push({ id: 'q', label: chipLabel('Busca', state.q) })
|
if (state.q) chips.push({ id: 'q', label: chipLabel('Busca', state.q) })
|
||||||
|
|
@ -127,7 +129,9 @@ export const applyStateDeputyOmniboxSuggestion = ({
|
||||||
if (suggestionId.startsWith('sort:')) {
|
if (suggestionId.startsWith('sort:')) {
|
||||||
const raw = suggestionId.slice(5)
|
const raw = suggestionId.slice(5)
|
||||||
const [key, dir] = raw.split('|')
|
const [key, dir] = raw.split('|')
|
||||||
const option = stateDeputyListSortOptions.find((entry) => entry.key === key && entry.dir === dir)
|
const option = stateDeputyListSortOptions.find(
|
||||||
|
(entry) => entry.key === key && entry.dir === dir,
|
||||||
|
)
|
||||||
if (!option) return { kind: 'url', state }
|
if (!option) return { kind: 'url', state }
|
||||||
const next = withPageReset({ ...state, sort: option.key, dir: option.dir })
|
const next = withPageReset({ ...state, sort: option.key, dir: option.dir })
|
||||||
if (isDefaultStateDeputyListSort(next)) {
|
if (isDefaultStateDeputyListSort(next)) {
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,9 @@ const chipLabel = (dimension: string, value: string): string => `${dimension}: $
|
||||||
|
|
||||||
const withPageReset = (state: SupporterListState): SupporterListState => ({ ...state, page: 1 })
|
const withPageReset = (state: SupporterListState): SupporterListState => ({ ...state, page: 1 })
|
||||||
|
|
||||||
const parseStateFromParams = (raw: Record<string, string | string[] | undefined>): SupporterListState =>
|
const parseStateFromParams = (
|
||||||
parseSupporterListParams(raw)
|
raw: Record<string, string | string[] | undefined>,
|
||||||
|
): SupporterListState => parseSupporterListParams(raw)
|
||||||
|
|
||||||
export const buildSupporterOmniboxChips = ({
|
export const buildSupporterOmniboxChips = ({
|
||||||
state,
|
state,
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,9 @@ const isDefaultTerritoryListSort = (state: TerritoryListState): boolean => {
|
||||||
return sort === DEFAULT_TERRITORY_LIST_SORT_KEY && dir === DEFAULT_TERRITORY_LIST_SORT_DIR
|
return sort === DEFAULT_TERRITORY_LIST_SORT_KEY && dir === DEFAULT_TERRITORY_LIST_SORT_DIR
|
||||||
}
|
}
|
||||||
|
|
||||||
export const buildTerritoryOmniboxChips = (state: TerritoryListState): CampaignListOmniboxChip[] => {
|
export const buildTerritoryOmniboxChips = (
|
||||||
|
state: TerritoryListState,
|
||||||
|
): CampaignListOmniboxChip[] => {
|
||||||
const chips: CampaignListOmniboxChip[] = []
|
const chips: CampaignListOmniboxChip[] = []
|
||||||
|
|
||||||
if (state.q) chips.push({ id: 'q', label: chipLabel('Busca', state.q) })
|
if (state.q) chips.push({ id: 'q', label: chipLabel('Busca', state.q) })
|
||||||
|
|
@ -161,7 +163,8 @@ export const removeTerritoryOmniboxChip = ({
|
||||||
chipId: string
|
chipId: string
|
||||||
}): TerritoryOmniboxAction => {
|
}): TerritoryOmniboxAction => {
|
||||||
if (chipId === 'q') return { kind: 'url', state: { ...state, q: undefined } }
|
if (chipId === 'q') return { kind: 'url', state: { ...state, q: undefined } }
|
||||||
if (chipId === 'sort') return { kind: 'url', state: { ...state, sort: undefined, dir: undefined } }
|
if (chipId === 'sort')
|
||||||
|
return { kind: 'url', state: { ...state, sort: undefined, dir: undefined } }
|
||||||
|
|
||||||
if (chipId.startsWith('region:')) {
|
if (chipId.startsWith('region:')) {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,15 @@
|
||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
import { parseActivityListParams } from '@/utilities/activityUi'
|
import {
|
||||||
|
applySearchOnlyOmniboxSuggestion,
|
||||||
|
buildSearchOnlyOmniboxChips,
|
||||||
|
} from '@/lib/searchOnlyListOmnibox'
|
||||||
import {
|
import {
|
||||||
applyActivityOmniboxSuggestion,
|
applyActivityOmniboxSuggestion,
|
||||||
buildActivityOmniboxChips,
|
buildActivityOmniboxChips,
|
||||||
clearActivityOmnibox,
|
clearActivityOmnibox,
|
||||||
} from '@/utilities/activityOmnibox'
|
} from '@/utilities/activityOmnibox'
|
||||||
|
import { parseActivityListParams } from '@/utilities/activityUi'
|
||||||
import { parseDemandListParams } from '@/utilities/demand/demandListUrl'
|
import { parseDemandListParams } from '@/utilities/demand/demandListUrl'
|
||||||
import {
|
import {
|
||||||
applyDemandOmniboxSuggestion,
|
applyDemandOmniboxSuggestion,
|
||||||
|
|
@ -23,11 +27,11 @@ import {
|
||||||
applyStateDeputyOmniboxSuggestion,
|
applyStateDeputyOmniboxSuggestion,
|
||||||
buildStateDeputyOmniboxChips,
|
buildStateDeputyOmniboxChips,
|
||||||
} from '@/utilities/stateDeputyOmnibox'
|
} from '@/utilities/stateDeputyOmnibox'
|
||||||
import { parseSupporterListParams } from '@/utilities/supporter/supporterUi'
|
|
||||||
import {
|
import {
|
||||||
applySupporterOmniboxSuggestion,
|
applySupporterOmniboxSuggestion,
|
||||||
buildSupporterOmniboxChips,
|
buildSupporterOmniboxChips,
|
||||||
} from '@/utilities/supporter/supporterOmnibox'
|
} from '@/utilities/supporter/supporterOmnibox'
|
||||||
|
import { parseSupporterListParams } from '@/utilities/supporter/supporterUi'
|
||||||
import { parseTerritoryListParams } from '@/utilities/territory/territoryListUrl'
|
import { parseTerritoryListParams } from '@/utilities/territory/territoryListUrl'
|
||||||
import {
|
import {
|
||||||
applyTerritoryOmniboxSuggestion,
|
applyTerritoryOmniboxSuggestion,
|
||||||
|
|
@ -35,10 +39,6 @@ import {
|
||||||
buildTerritoryOmniboxSuggestionSeeds,
|
buildTerritoryOmniboxSuggestionSeeds,
|
||||||
filterTerritoryOmniboxSuggestions,
|
filterTerritoryOmniboxSuggestions,
|
||||||
} from '@/utilities/territory/territoryOmnibox'
|
} from '@/utilities/territory/territoryOmnibox'
|
||||||
import {
|
|
||||||
applySearchOnlyOmniboxSuggestion,
|
|
||||||
buildSearchOnlyOmniboxChips,
|
|
||||||
} from '@/lib/searchOnlyListOmnibox'
|
|
||||||
|
|
||||||
describe('list omnibox adapters (B128)', () => {
|
describe('list omnibox adapters (B128)', () => {
|
||||||
it('territory builds chips and applies search', () => {
|
it('territory builds chips and applies search', () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue