mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-15 10:43:07 +00:00
Estende o chassis B127 (CampaignListOmnibox + adapters puros por domínio) para territórios, lideranças, dobradinhas, apoiadores, atividades, demandas, organizações e assessores. Remove pilhas antigas (search debounced, collapsible, mobile selects, CampaignFilterChips). URL contracts extraídos para módulos client-safe onde necessário (demand/organization/advisor). Testes unitários nos adapters + hook navigate-only. Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
33 lines
949 B
TypeScript
33 lines
949 B
TypeScript
import { CAMPAIGN_ADVISORS_HOME } from '@/lib/campaignPaths'
|
|
import {
|
|
buildListHref,
|
|
firstValue,
|
|
normalizedText,
|
|
strictDecimalInteger,
|
|
type RawSearchParams,
|
|
} from '@/utilities/campaignListUrl'
|
|
|
|
export type AdvisorListState = {
|
|
page: number
|
|
q?: string
|
|
}
|
|
|
|
export const parseAdvisorListParams = (searchParams: RawSearchParams): AdvisorListState => {
|
|
const q = normalizedText(firstValue(searchParams.q))
|
|
const page = strictDecimalInteger(firstValue(searchParams.page)) ?? 1
|
|
|
|
return {
|
|
page,
|
|
...(q ? { q } : {}),
|
|
}
|
|
}
|
|
|
|
const buildAdvisorListSearchParams = (state: AdvisorListState, page = state.page) => {
|
|
const params = new URLSearchParams()
|
|
if (state.q) params.set('q', state.q)
|
|
if (page > 1) params.set('page', String(page))
|
|
return params
|
|
}
|
|
|
|
export const advisorListHrefForPage = (state: AdvisorListState, page: number): string =>
|
|
buildListHref(state, buildAdvisorListSearchParams, CAMPAIGN_ADVISORS_HOME, page)
|