mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-14 08:53:11 +00:00
Ship A2 with a static Bahia municipality↔zone map, pure suggestion engine, and form chips that never auto-apply geography.
24 lines
800 B
TypeScript
24 lines
800 B
TypeScript
import {
|
|
bahiaIdentityTerritories,
|
|
bahiaMunicipalities,
|
|
citiesForTerritory,
|
|
isBahiaIdentityTerritory,
|
|
} from '@/lib/bahiaTerritories'
|
|
|
|
export type StrictComboboxOption = {
|
|
label: string
|
|
value: string
|
|
}
|
|
|
|
const toOptions = (values: readonly string[]): StrictComboboxOption[] =>
|
|
values.map((value) => ({ label: value, value }))
|
|
|
|
export const territoryComboboxOptions = toOptions(bahiaIdentityTerritories)
|
|
|
|
/** Full Bahia municipality list — stable module reference for client filters. */
|
|
export const allMunicipalityComboboxOptions = toOptions(bahiaMunicipalities)
|
|
|
|
export const municipalityComboboxOptions = (region?: string | null): StrictComboboxOption[] =>
|
|
region && isBahiaIdentityTerritory(region)
|
|
? toOptions(citiesForTerritory(region))
|
|
: allMunicipalityComboboxOptions
|