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/routes/map.tsx | 42 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 22 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 df4808d..343cf91 100644 --- a/src/frontend/app/routes/map.tsx +++ b/src/frontend/app/routes/map.tsx @@ -15,7 +15,7 @@ import Map, { type StyleSpecification } from "react-map-gl/maplibre"; import { StopSheet } from "~/components/StopSheet"; -import { getRegionConfig } from "~/config/RegionConfig"; +import { REGION_DATA } from "~/config/RegionConfig"; import { usePageTitle } from "~/contexts/PageTitleContext"; import { useApp } from "../AppContext"; @@ -40,7 +40,7 @@ export default function StopMap() { >([]); const [selectedStop, setSelectedStop] = useState(null); const [isSheetOpen, setIsSheetOpen] = useState(false); - const { mapState, updateMapState, theme, region } = useApp(); + const { mapState, updateMapState, theme } = useApp(); const mapRef = useRef(null); const [mapStyleKey, setMapStyleKey] = useState("light"); @@ -62,7 +62,7 @@ export default function StopMap() { }; useEffect(() => { - StopDataProvider.getStops(region).then((data) => { + StopDataProvider.getStops().then((data) => { const features: GeoJsonFeature< Point, { stopId: number; name: string; lines: string[]; cancelled?: boolean } @@ -81,7 +81,7 @@ export default function StopMap() { })); setStops(features); }); - }, [region]); + }, []); useEffect(() => { //const styleName = "carto"; @@ -155,7 +155,7 @@ export default function StopMap() { const stopId = parseInt(props.stopId, 10); // fetch full stop to get lines array - StopDataProvider.getStopById(region, stopId) + StopDataProvider.getStopById(stopId) .then((stop) => { if (!stop) { console.warn("Stop not found:", stopId); @@ -186,14 +186,10 @@ export default function StopMap() { zoom: mapState.zoom, }} attributionControl={{ compact: false }} - maxBounds={ - getRegionConfig(region).bounds - ? [getRegionConfig(region).bounds!.sw, getRegionConfig(region).bounds!.ne] - : undefined - } + maxBounds={[REGION_DATA.bounds.sw, REGION_DATA.bounds.ne]} > - + - {selectedStop && ( - setIsSheetOpen(false)} - stop={selectedStop} - /> - )} - + { + selectedStop && ( + setIsSheetOpen(false)} + stop={selectedStop} + /> + ) + } + ); } -- cgit v1.3