@@ -18,11 +18,7 @@ import type { FeatureCollection } from 'geojson';
1818import { Box , useTheme } from '@mui/material' ;
1919import { MapElement , MapRouteElement , MapStopElement } from './MapElement' ;
2020import type { MapElementType } from './MapElement' ;
21- import {
22- reversedRouteTypesMapping ,
23- } from '../constants/RouteTypes' ;
2421import { MapDataPopup } from './Map/MapDataPopup' ;
25- import { useTheme as themeProvider } from '../context/ThemeProvider' ;
2622
2723interface LatestDatasetLite {
2824 hosted_url ?: string ;
@@ -34,15 +30,15 @@ export interface GtfsVisualizationMapProps {
3430 polygon : LatLngExpression [ ] ;
3531 latestDataset ?: LatestDatasetLite ;
3632 filteredRoutes ?: string [ ] ;
37- filteredRouteTypes ?: string [ ] ;
33+ filteredRouteTypeIds ?: string [ ] ;
3834 hideStops ?: boolean ;
3935}
4036
4137export const GtfsVisualizationMap = ( {
4238 polygon,
4339 latestDataset,
4440 filteredRoutes = [ ] ,
45- filteredRouteTypes = [ ] ,
41+ filteredRouteTypeIds = [ ] ,
4642 hideStops = false ,
4743} : GtfsVisualizationMapProps ) : JSX . Element => {
4844
@@ -68,10 +64,6 @@ export const GtfsVisualizationMap = ({
6864 > | null > ( null ) ;
6965 const mapRef = useRef < MapRef > ( null ) ;
7066
71- const filteredRouteTypesIds = filteredRouteTypes . map (
72- ( d ) => reversedRouteTypesMapping [ d ] ,
73- ) ;
74-
7567 // Create a map to store routeId to routeColor mapping
7668 const routeIdToColorMap : Record < string , string > = { } ;
7769 mapElements . forEach ( ( el ) => {
@@ -106,8 +98,8 @@ export const GtfsVisualizationMap = ({
10698 }
10799
108100 const routeTypeFilter : ExpressionSpecification | boolean =
109- filteredRouteTypes . length > 0
110- ? [ 'in' , [ 'get' , 'route_type' ] , [ 'literal' , filteredRouteTypesIds ] ]
101+ filteredRouteTypeIds . length > 0
102+ ? [ 'in' , [ 'get' , 'route_type' ] , [ 'literal' , filteredRouteTypeIds ] ]
111103 : true ; // if no filter applied, show all
112104
113105 const handleMouseClick = ( event : maplibregl . MapLayerMouseEvent ) : void => {
0 commit comments