From a1d589c1a0d5a5010e5fe4e8a1ec403ffafb289f Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Sun, 7 Dec 2025 23:33:10 +0100 Subject: Implement Renfe data source --- src/frontend/app/routes/map.tsx | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src/frontend/app/routes/map.tsx') diff --git a/src/frontend/app/routes/map.tsx b/src/frontend/app/routes/map.tsx index 461e891..402bf60 100644 --- a/src/frontend/app/routes/map.tsx +++ b/src/frontend/app/routes/map.tsx @@ -35,7 +35,7 @@ export default function StopMap() { const [stops, setStops] = useState< GeoJsonFeature< Point, - { stopId: number; name: string; lines: string[]; cancelled?: boolean } + { stopId: string; name: string; lines: string[]; cancelled?: boolean, prefix: string } >[] >([]); const [selectedStop, setSelectedStop] = useState(null); @@ -65,7 +65,7 @@ export default function StopMap() { StopDataProvider.getStops().then((data) => { const features: GeoJsonFeature< Point, - { stopId: number; name: string; lines: string[]; cancelled?: boolean } + { stopId: string; name: string; lines: string[]; cancelled?: boolean, prefix: string } >[] = data.map((s) => ({ type: "Feature", geometry: { @@ -77,6 +77,7 @@ export default function StopMap() { name: s.name.original, lines: s.lines, cancelled: s.cancelled ?? false, + prefix: s.stopId.startsWith("renfe:") ? "stop-renfe" : (s.cancelled ? "stop-vitrasa-cancelled" : "stop-vitrasa"), }, })); setStops(features); @@ -152,7 +153,7 @@ export default function StopMap() { return; } - const stopId = parseInt(props.stopId, 10); + const stopId = props.stopId; // fetch full stop to get lines array StopDataProvider.getStopById(stopId) @@ -200,25 +201,23 @@ export default function StopMap() {