Skip to content

Commit 37494c2

Browse files
refactor: address pr feedback
1 parent a93c6bf commit 37494c2

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

lib/actions/apiV2.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import {
1919
} from './api'
2020
import { zoomToStop } from './map'
2121

22+
const LIGHT_GRAY = '666666'
23+
2224
/**
2325
* Generic helper for crafting GraphQL queries.
2426
*/
@@ -436,7 +438,7 @@ const fetchStopInfo = (map, stop) => {
436438
if (!stop) return findStopError()
437439

438440
const color =
439-
stop.routes?.length > 0 && `#${stop.routes[0]?.color || '666666'}`
441+
stop.routes?.length > 0 && `#${stop.routes[0]?.color || LIGHT_GRAY}`
440442

441443
// Doing some OTP1 compatibility rewriting here
442444
return {
@@ -586,7 +588,7 @@ export const findRoute = (params) =>
586588
const patternStops = pattern.stops.map((stop) => {
587589
const color =
588590
stop.routes?.length > 0 &&
589-
`#${stop.routes[0]?.color || '666666'}`
591+
`#${stop.routes[0]?.color || LIGHT_GRAY}`
590592
if (stop.routes) delete stop.routes
591593
return { ...stop, color }
592594
})

lib/actions/ui.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ export function setViewedRoute(payload) {
102102
viewedRoute &&
103103
payload?.viewedRoute?.routeId === viewedRoute.routeId &&
104104
payload?.viewedRoute?.patternId === viewedRoute.patternId
105-
)
105+
) {
106106
return
107+
}
107108

108109
dispatch(viewRoute(payload))
109110

lib/components/app/print-layout.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ class PrintLayout extends Component<Props, State> {
6767
if (!itinerary && location && location.search) {
6868
parseUrlQueryString()
6969
}
70+
71+
// TODO: use currentQuery to pan/zoom to the correct part of the map
7072
}
7173

7274
componentWillUnmount() {

lib/components/map/enhanced-stop-marker.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ const borderPixels = (props) => (props?.active ? 3 : 1)
3030
const caretMarginPixels = (props) =>
3131
(iconPixels - caretPixels - borderPixels(props)) / 2
3232

33-
const defaultColor = '#a6a6a6'
33+
const DEFAULT_COLOR = '#a6a6a6'
3434

3535
const BaseStopIcon = styled.div`
3636
background: #fff;
3737
border-radius: 50%;
3838
border: ${borderPixels}px solid
39-
${(props) => (props?.active ? props.mainColor : defaultColor)};
40-
color: ${(props) => (props?.active ? props.mainColor : defaultColor)};
41-
fill: ${(props) => (props?.active ? props.mainColor : defaultColor)};
39+
${(props) => (props?.active ? props.mainColor : DEFAULT_COLOR)};
40+
color: ${(props) => (props?.active ? props.mainColor : DEFAULT_COLOR)};
41+
fill: ${(props) => (props?.active ? props.mainColor : DEFAULT_COLOR)};
4242
font-size: ${iconPixels}px;
4343
height: ${iconPixels}px;
4444
line-height: 1px;
@@ -56,9 +56,9 @@ const BaseStopIcon = styled.div`
5656
&::after {
5757
background: #fff;
5858
border-bottom: ${borderPixels}px solid
59-
${(props) => (props?.active ? props.mainColor : defaultColor)};
59+
${(props) => (props?.active ? props.mainColor : DEFAULT_COLOR)};
6060
border-right: ${borderPixels}px solid
61-
${(props) => (props?.active ? props.mainColor : defaultColor)};
61+
${(props) => (props?.active ? props.mainColor : DEFAULT_COLOR)};
6262
content: '';
6363
display: block;
6464
height: ${caretPixels}px;

0 commit comments

Comments
 (0)