File size: 2,064 Bytes
d15f07c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/** Base path for the choropleth map under Data explorer (ACS 5-year static bundle). */
export const DATA_EXPLORER_MAP_BASE = '/data-explorer/map'

/** Scorecard tab (trends + benchmarks). */
export const DATA_EXPLORER_SCORECARD = '/data-explorer/scorecard'

/** Matrix map tab (state tiles + pivot table). */
export const DATA_EXPLORER_MATRIX = '/data-explorer/matrix'

/** Jurisdiction website mapping coverage (NACo / USCM / NCES / GSA + exports). */
export const DATA_EXPLORER_JURISDICTION_QUALITY = '/data-explorer/jurisdiction-quality'

/** Latest Lighthouse scores from bronze (paired with accessibility batches). */
export const DATA_EXPLORER_LIGHTHOUSE_REPORT = '/data-explorer/lighthouse-report'

/** YouTube caption / policy pipeline batch job progress (live from API). */
export const DATA_EXPLORER_BATCH_JOBS = '/data-explorer/batch-jobs'

/** Prefer new prefix; support legacy `/census-map` URLs until removed. */
export function censusMapPathPrefix(pathname: string): string {
  if (pathname.includes(`${DATA_EXPLORER_MAP_BASE}/`) || pathname === DATA_EXPLORER_MAP_BASE) {
    return DATA_EXPLORER_MAP_BASE
  }
  if (pathname.includes('/census-map/') || pathname === '/census-map') {
    return '/census-map'
  }
  return DATA_EXPLORER_MAP_BASE
}

export function mapPathUs(prefix: string, vintage: string, metric: string, search?: string) {
  const q = search && search.length > 0 ? (search.startsWith('?') ? search : `?${search}`) : ''
  return `${prefix}/us/${vintage}/${metric}${q}`
}

export function mapPathState(prefix: string, stateFips: string, vintage: string, metric: string, search?: string) {
  const q = search && search.length > 0 ? (search.startsWith('?') ? search : `?${search}`) : ''
  return `${prefix}/state/${stateFips}/${vintage}/${metric}${q}`
}

export function mapPathPlace(prefix: string, stateFips: string, vintage: string, metric: string, search?: string) {
  const q = search && search.length > 0 ? (search.startsWith('?') ? search : `?${search}`) : ''
  return `${prefix}/place/${stateFips}/${vintage}/${metric}${q}`
}