mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-14 17:43:04 +00:00
Staff Início posts to /campanha/home-search with scoped word-start matches, shared readout component, and simplify hardening (messages, fetch busy, malformed response guard).
26 lines
735 B
TypeScript
26 lines
735 B
TypeScript
import type { MunicipalityVoteRankEntry } from '@/lib/municipalityVoteRank'
|
|
|
|
export type HomeSearchMunicipalityHit = {
|
|
kind: 'municipality'
|
|
slug: string
|
|
name: string
|
|
region: string
|
|
priority: 'alta' | 'normal' | null
|
|
votePosition2022: MunicipalityVoteRankEntry | null
|
|
}
|
|
|
|
export type HomeSearchTerritoryHit = {
|
|
kind: 'territory'
|
|
region: string
|
|
votes2022: number
|
|
}
|
|
|
|
export type HomeSearchSuccessResponse = {
|
|
status: 'success'
|
|
municipalities: HomeSearchMunicipalityHit[]
|
|
territories: HomeSearchTerritoryHit[]
|
|
}
|
|
|
|
export const homeSearchMunicipalityGroupHasHits = (
|
|
data: Pick<HomeSearchSuccessResponse, 'municipalities' | 'territories'>,
|
|
): boolean => data.municipalities.length > 0 || data.territories.length > 0
|