aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/app/config/RegionConfig.ts
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2025-11-30 20:49:48 +0100
committerAriel Costas Guerrero <ariel@costas.dev>2025-11-30 20:49:48 +0100
commita68ba30716062b265f85c4be078a736c7135d7bc (patch)
treedd079a2d3860349402ad5b614659fedcb90c2b99 /src/frontend/app/config/RegionConfig.ts
parentcee521142a4e0673b155d97c3e4825b7fec1987f (diff)
Refactor StopMap and Settings components; replace region config usage with REGION_DATA, update StopDataProvider calls, and improve UI elements. Remove unused timetable files and add Tailwind CSS support.
Diffstat (limited to 'src/frontend/app/config/RegionConfig.ts')
-rw-r--r--src/frontend/app/config/RegionConfig.ts69
1 files changed, 19 insertions, 50 deletions
diff --git a/src/frontend/app/config/RegionConfig.ts b/src/frontend/app/config/RegionConfig.ts
index a6ffdf8..4677509 100644
--- a/src/frontend/app/config/RegionConfig.ts
+++ b/src/frontend/app/config/RegionConfig.ts
@@ -1,53 +1,22 @@
-export type RegionId = "vigo";
+import type { LngLatLike } from "maplibre-gl";
-export interface RegionConfig {
- id: RegionId;
- name: string;
- stopsEndpoint: string;
- estimatesEndpoint: string;
- consolidatedCirculationsEndpoint: string | null;
- timetableEndpoint: string | null;
- shapeEndpoint: string | null;
- defaultCenter: [number, number]; // [lat, lng]
- bounds?: {
- sw: [number, number];
- ne: [number, number];
- };
- textColour?: string;
- defaultZoom: number;
- showMeters: boolean; // Whether to show distance in meters
-}
-
-export const REGIONS: Record<RegionId, RegionConfig> = {
- vigo: {
- id: "vigo",
- name: "Vigo",
- stopsEndpoint: "/stops/vigo.json",
- estimatesEndpoint: "/api/vigo/GetStopEstimates",
- consolidatedCirculationsEndpoint: "/api/vigo/GetConsolidatedCirculations",
- timetableEndpoint: "/api/vigo/GetStopTimetable",
- shapeEndpoint: "/api/vigo/GetShape",
- defaultCenter: [42.229188855975046, -8.72246955783102],
- bounds: {
- sw: [-8.951059, 42.098923],
- ne: [-8.447748, 42.3496],
- },
- textColour: "#e72b37",
- defaultZoom: 14,
- showMeters: true,
+export const REGION_DATA = {
+ id: "vigo",
+ name: "Vigo",
+ stopsEndpoint: "/stops/vigo.json",
+ estimatesEndpoint: "/api/vigo/GetStopEstimates",
+ consolidatedCirculationsEndpoint: "/api/vigo/GetConsolidatedCirculations",
+ timetableEndpoint: "/api/vigo/GetStopTimetable",
+ shapeEndpoint: "/api/vigo/GetShape",
+ defaultCenter: [
+ 42.229188855975046,
+ -8.72246955783102
+ ] as LngLatLike,
+ bounds: {
+ sw: [-8.951059, 42.098923] as LngLatLike,
+ ne: [-8.447748, 42.3496] as LngLatLike,
},
+ textColour: "#e72b37",
+ defaultZoom: 14,
+ showMeters: true,
};
-
-export const DEFAULT_REGION: RegionId = "vigo";
-
-export function getRegionConfig(regionId: RegionId): RegionConfig {
- return REGIONS[regionId];
-}
-
-export function getAvailableRegions(): RegionConfig[] {
- return Object.values(REGIONS);
-}
-
-export function isValidRegion(regionId: string): regionId is RegionId {
- return regionId === "vigo";
-}