Skip to content

Commit 1e6df4c

Browse files
committed
PR comments from AI
1 parent 736e25d commit 1e6df4c

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

web-app/src/app/components/GtfsVisualizationMap.layers.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
type LayerSpecification,
77
} from 'maplibre-gl';
88
import { generateStopColorExpression } from './GtfsVisualizationMap.functions';
9-
import { useTheme } from '@mui/material';
9+
import { type Theme } from '@mui/material';
1010

1111
// layer helpers
1212

@@ -43,8 +43,8 @@ export const stopsBaseFilter = (
4343
// layers
4444
export const RoutesWhiteLayer = (
4545
filteredRouteTypeIds: string[],
46+
theme: Theme,
4647
): LayerSpecification => {
47-
const theme = useTheme();
4848
return {
4949
id: 'routes-white',
5050
source: 'routes',
@@ -186,8 +186,8 @@ export const StopsHighlightOuterLayer = (
186186
hoverInfo: string[],
187187
hideStops: boolean,
188188
filteredRoutes: string[],
189+
theme: Theme,
189190
): LayerSpecification => {
190-
const theme = useTheme();
191191
return {
192192
id: 'stops-highlight-outer',
193193
source: 'sample',

web-app/src/app/components/GtfsVisualizationMap.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,12 @@ export const GtfsVisualizationMap = ({
111111
mapElements.forEach((el) => {
112112
if (!el.isStop) {
113113
const routeElement: MapRouteElement = el as MapRouteElement;
114-
if (routeElement.routeId !== '' && routeElement.routeColor !== '') {
114+
if (
115+
routeElement?.routeId != null &&
116+
routeElement.routeId !== '' &&
117+
routeElement.routeColor != null &&
118+
routeElement.routeColor !== ''
119+
) {
115120
routeIdToColorMap[routeElement.routeId] = routeElement.routeColor;
116121
}
117122
}
@@ -592,7 +597,7 @@ export const GtfsVisualizationMap = ({
592597
minzoom: 0,
593598
maxzoom: 22,
594599
},
595-
RoutesWhiteLayer(filteredRouteTypeIds),
600+
RoutesWhiteLayer(filteredRouteTypeIds, theme),
596601
RouteLayer(filteredRoutes, filteredRouteTypeIds),
597602
StopLayer(hideStops, allSelectedRouteIds, stopRadius),
598603
RouteHighlightLayer(
@@ -607,7 +612,12 @@ export const GtfsVisualizationMap = ({
607612
mapClickStopData?.stop_id,
608613
stopHighlightColorMap,
609614
),
610-
StopsHighlightOuterLayer(hoverInfo, hideStops, filteredRoutes),
615+
StopsHighlightOuterLayer(
616+
hoverInfo,
617+
hideStops,
618+
filteredRoutes,
619+
theme,
620+
),
611621
StopsIndexLayer(),
612622
],
613623
}}

0 commit comments

Comments
 (0)