From a68ba30716062b265f85c4be078a736c7135d7bc Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Sun, 30 Nov 2025 20:49:48 +0100 Subject: 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. --- src/frontend/app/config/RegionConfig.ts | 69 +++++++++------------------------ 1 file changed, 19 insertions(+), 50 deletions(-) (limited to 'src/frontend/app/config') 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 = { - 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"; -} -- cgit v1.3