/** Popup content and options for the Places map (`PlaceClusterMap`). Kept out of the * component so the label, the links and the escaping are unit-tested. Counts are real * (from the warehouse); nothing here invents a figure. */ import { MAP_POPUP_OPTIONS, escapeHtml } from './mapPopup' export interface PlacePopupPin { geoid: string name: string state_code: string | null place_count: number transcript_count: number } /** Shared auto-pan padding, plus the width this popup's button needs. */ export const PLACE_POPUP_OPTIONS = { ...MAP_POPUP_OPTIONS, minWidth: 180, maxWidth: 260, } /** State pins open the places list filtered to that state; every other place opens its * meetings page. */ export function placePopupHtml(pin: PlacePopupPin, level: string): string { const name = escapeHtml(pin.name) const isState = level === 'state' const href = isState ? `/jurisdictions?state=${encodeURIComponent(pin.state_code ?? '')}` : `/jurisdiction/${encodeURIComponent(pin.geoid)}/meetings` const label = isState ? `Browse places in ${name} →` : 'Open meetings →' const transcripts = `${pin.transcript_count.toLocaleString()} transcript${pin.transcript_count === 1 ? '' : 's'}` const places = isState ? `