Add a toggleable IATA border layer to the map

Draw each active IATA's GeoJSON region border as an outline over a faint
fill beneath the node markers, behind a Map Settings toggle that's off by
default and shareable via a URL param. IATAs with no border answer 204
and are skipped.
This commit is contained in:
MrAlders0n
2026-07-24 22:21:12 -04:00
parent 8baa562794
commit 464e701f76
10 changed files with 305 additions and 4 deletions
+14
View File
@@ -17,6 +17,9 @@ import type {
NodeTypeCount,
ClockDriftEntry,
} from "../features/stats/types";
import type { Feature, Polygon, MultiPolygon } from "geojson";
export type IataBorder = Feature<Polygon | MultiPolygon>;
// typed fetch wrapper with query params
@@ -81,6 +84,17 @@ export function getIatas(): Promise<IataCode[]> {
return request("/iatas");
}
// An IATA's GeoJSON border, or null when none is configured. Can't use request(): the endpoint
// answers 204 (empty body) or a literal `null` for "no border", and request() always parses JSON.
export async function getIataBorder(iata: string): Promise<IataBorder | null> {
const url = new URL(`${API_BASE}/iatas/${iata}/border`, window.location.origin);
const res = await fetch(url.toString());
if (res.status === 204) return null;
if (!res.ok) throw new ApiError(res.status, "unknown", res.statusText);
const body = await res.json();
return (body ?? null) as IataBorder | null;
}
export function getRegions(): Promise<RegionSummary[]> {
return request("/regions");
}