Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 1x 8x 8x 4x 1x | /** Known city slug → display name map. Add new cities here as they onboard. */
export const CITY_NAMES: Record<string, string> = {
hyderabad: "Hyderabad",
pune: "Pune",
bangalore: "Bangalore",
mumbai: "Mumbai",
chennai: "Chennai",
delhi: "Delhi",
};
/**
* Derives a city display name from a pro's localityId.
*
* localityId format: 'loc_hyderabad_banjara_hills'
* → city slug is the first segment after the 'loc_' prefix.
*
* Returns undefined when localityId is absent or the city slug is empty.
*/
export function cityDisplayNameFromLocalityId(
localityId: string | null | undefined,
): string | undefined {
const citySlug = localityId?.replace(/^loc_/, "").split("_")[0];
if (!citySlug) return undefined;
return CITY_NAMES[citySlug] ?? toTitleCase(citySlug);
}
function toTitleCase(s: string): string {
return s.charAt(0).toUpperCase() + s.slice(1);
}
|