Skip to content

Commit 0a65449

Browse files
committed
Merge branch 'v3' into AB#583
2 parents 58367ae + 08f2527 commit 0a65449

75 files changed

Lines changed: 3145 additions & 2867 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/component/Card.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
22
import React, { forwardRef } from 'react';
33
import cx from 'classnames';
44

5-
const Card = forwardRef(({ className, children, ...rest }, ref) => {
5+
const Card = forwardRef(({ className = undefined, children, ...rest }, ref) => {
66
return (
77
<div ref={ref} className={cx('card', className)} {...rest}>
88
{children}
@@ -17,6 +17,4 @@ Card.propTypes = {
1717
children: PropTypes.node.isRequired,
1818
};
1919

20-
Card.defaultProps = { className: undefined };
21-
2220
export default Card;

app/component/Icon.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ const Icon = ({
3131
viewBox={!omitViewBox ? viewBox : null}
3232
className={cx('icon', className)}
3333
aria-label={ariaLabel}
34+
transform={
35+
background?.props?.shape === 'stopsign'
36+
? 'translate(0, -3.33)'
37+
: undefined
38+
}
3439
>
3540
{background}
3641
<g

app/component/MapLayersDialogContent.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ const mapLayersconfigShape = PropTypes.shape({
5454
subway: transportModeconfigShape,
5555
tram: transportModeconfigShape,
5656
scooter: transportModeconfigShape,
57+
funicular: transportModeconfigShape,
58+
airplane: transportModeconfigShape,
5759
}),
5860
mapLayers: PropTypes.shape({
5961
tooltip: PropTypes.shape({
@@ -262,6 +264,19 @@ class MapLayersDialogContent extends React.Component {
262264
}}
263265
/>
264266
)}
267+
{isTransportModeEnabled(transportModes.airplane) && (
268+
<Checkbox
269+
large
270+
checked={stop.airplane}
271+
disabled={!!this.props.mapLayerOptions?.stop?.airplane?.isLocked}
272+
defaultMessage="Airport"
273+
labelId="map-layer-stop-airplane"
274+
onChange={e => {
275+
this.updateStopSetting({ airplane: e.target.checked });
276+
sendLayerChangeAnalytic('AirplaneStop', e.target.checked);
277+
}}
278+
/>
279+
)}
265280
{config.parkAndRide?.showParkAndRide && (
266281
<Checkbox
267282
large

app/component/icon/IconBackground.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33

4-
const STOP_SIGN_POLE_WIDTH = 4;
4+
const STOP_SIGN_POLE_WIDTH = 3;
55
const STOP_SIGN_POLE_X = 20 - STOP_SIGN_POLE_WIDTH / 2;
66

77
const IconBackground = ({ shape, color }) => {
@@ -10,23 +10,23 @@ const IconBackground = ({ shape, color }) => {
1010
}
1111
return (
1212
<>
13-
<circle
14-
className="icon-circle"
15-
cx="20"
16-
cy="20"
17-
fill={color}
18-
r={shape === 'stopsign' ? '13.33' : '20'}
19-
/>
2013
{shape === 'stopsign' && (
2114
<rect
2215
x={STOP_SIGN_POLE_X}
23-
y="33.33"
16+
y="30"
2417
width={STOP_SIGN_POLE_WIDTH}
25-
height="6.67"
18+
height="10"
2619
fill="#333333"
2720
rx="2"
2821
/>
2922
)}
23+
<circle
24+
className="icon-circle"
25+
cx="20"
26+
cy="20"
27+
fill={color}
28+
r={shape === 'stopsign' ? '13.33' : '20'}
29+
/>
3030
{shape === 'square' && (
3131
<rect
3232
className="icon-square"

app/component/itinerary/ItineraryCircleLineWithIcon.js

Lines changed: 111 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,37 @@ import Icon from '../Icon';
55
import RouteNumber from '../RouteNumber';
66
import { ViaLocationType, IndoorLegType } from '../../constants';
77

8-
class ItineraryCircleLineWithIcon extends React.Component {
9-
static propTypes = {
10-
index: PropTypes.number.isRequired,
11-
modeClassName: PropTypes.string.isRequired,
12-
viaType: PropTypes.string,
13-
indoorLegType: PropTypes.oneOf(Object.values(IndoorLegType)),
14-
showIntermediateSteps: PropTypes.bool,
15-
bikePark: PropTypes.bool,
16-
carPark: PropTypes.bool,
17-
color: PropTypes.string,
18-
appendClass: PropTypes.string,
19-
icon: PropTypes.string,
20-
style: PropTypes.shape({}),
21-
isNotFirstLeg: PropTypes.bool,
22-
isStop: PropTypes.bool,
23-
indoorStepsLength: PropTypes.number,
24-
};
25-
26-
static defaultProps = {
27-
viaType: null,
28-
indoorLegType: IndoorLegType.NoStepsInside,
29-
showIntermediateSteps: false,
30-
color: null,
31-
bikePark: false,
32-
carPark: false,
33-
appendClass: undefined,
34-
icon: undefined,
35-
style: {},
36-
isNotFirstLeg: undefined,
37-
isStop: false,
38-
indoorStepsLength: 0,
39-
};
40-
41-
isFirstChild = () => {
42-
return (
43-
!this.props.isNotFirstLeg && this.props.index === 0 && !this.props.viaType
44-
);
45-
};
46-
47-
getMarker = top => {
48-
if (this.props.viaType === ViaLocationType.Visit && !this.props.isStop) {
8+
function ItineraryCircleLineWithIcon({
9+
index,
10+
modeClassName,
11+
viaType = null,
12+
indoorLegType = IndoorLegType.NoStepsInside,
13+
showIntermediateSteps = false,
14+
bikePark = false,
15+
carPark = false,
16+
color = null,
17+
appendClass,
18+
icon,
19+
style = {},
20+
isNotFirstLeg,
21+
isStop = false,
22+
hasPreviousTransitLeg = false,
23+
indoorStepsLength = 0,
24+
}) {
25+
const getMarker = top => {
26+
if (top && hasPreviousTransitLeg) {
27+
return null;
28+
}
29+
if (viaType === ViaLocationType.Visit && !isStop) {
4930
return (
5031
<div className="itinerary-icon-container">
5132
<Icon img="icon_mapMarker" className="itinerary-icon via via-it" />
5233
</div>
5334
);
5435
}
55-
if (this.isFirstChild()) {
36+
37+
// Check if this is the first leg with no via point to show origin marker
38+
if (!isNotFirstLeg && index === 0 && !viaType) {
5639
return (
5740
<div className="itinerary-icon-container start">
5841
<Icon
@@ -62,117 +45,126 @@ class ItineraryCircleLineWithIcon extends React.Component {
6245
</div>
6346
);
6447
}
65-
if (this.props.bikePark) {
48+
if (bikePark) {
6649
return (
6750
<div className="itinerary-icon-container bike-park">
6851
<Icon img="icon-bike_parking" />
6952
</div>
7053
);
7154
}
72-
if (this.props.carPark) {
55+
if (carPark) {
7356
return (
7457
<div className="itinerary-icon-container car-park">
7558
<Icon img="icon_car-park" />
7659
</div>
7760
);
7861
}
79-
if (
80-
this.props.modeClassName === 'walk' ||
81-
this.props.modeClassName === 'bicycle'
82-
) {
62+
if (modeClassName === 'walk' || modeClassName === 'bicycle') {
8363
return null;
8464
}
8565
return (
8666
<div
87-
className={`leg-before-circle circle ${this.props.modeClassName} ${
67+
className={`leg-before-circle circle ${modeClassName} ${
8868
top ? 'top' : ''
8969
}`}
9070
>
9171
<svg
9272
xmlns="http://www.w3.org/2000/svg"
9373
width={28}
9474
height={28}
95-
style={{ fill: '#fff', stroke: this.props.color }}
75+
style={{ fill: '#fff', stroke: color }}
9676
>
9777
<circle strokeWidth="4" width={28} cx={11} cy={10} r={6} />
9878
</svg>
9979
</div>
10080
);
10181
};
10282

103-
render() {
104-
const topMarker = this.getMarker(true);
105-
const bottomMarker = this.getMarker(false);
106-
const legBeforeLineStyle = { color: this.props.color, ...this.props.style };
107-
let topBackgroundClass = '';
108-
let bottomBackgroundClass = '';
109-
if (
110-
this.props.modeClassName === 'walk' ||
111-
this.props.modeClassName === 'bicycle_walk'
112-
) {
113-
switch (this.props.indoorLegType) {
114-
case IndoorLegType.StepsAfterEntranceInside:
115-
topBackgroundClass = 'default-dotted-line';
83+
const topMarker = getMarker(true);
84+
const bottomMarker = getMarker(false);
85+
const legBeforeLineStyle = { color, ...style };
86+
let topBackgroundClass = '';
87+
let bottomBackgroundClass = '';
88+
if (modeClassName === 'walk' || modeClassName === 'bicycle_walk') {
89+
switch (indoorLegType) {
90+
case IndoorLegType.StepsAfterEntranceInside:
91+
topBackgroundClass = 'default-dotted-line';
92+
bottomBackgroundClass = 'indoor-dotted-line';
93+
break;
94+
case IndoorLegType.StepsBeforeEntranceInside:
95+
if (showIntermediateSteps) {
96+
topBackgroundClass = 'indoor-dotted-line';
11697
bottomBackgroundClass = 'indoor-dotted-line';
117-
break;
118-
case IndoorLegType.StepsBeforeEntranceInside:
119-
if (this.props.showIntermediateSteps) {
120-
topBackgroundClass = 'indoor-dotted-line';
121-
bottomBackgroundClass = 'indoor-dotted-line';
122-
} else {
123-
topBackgroundClass = 'indoor-dotted-line';
124-
bottomBackgroundClass = 'default-dotted-line';
125-
}
126-
break;
127-
default:
128-
topBackgroundClass = 'default-dotted-line';
98+
} else {
99+
topBackgroundClass = 'indoor-dotted-line';
129100
bottomBackgroundClass = 'default-dotted-line';
130-
}
101+
}
102+
break;
103+
default:
104+
topBackgroundClass = 'default-dotted-line';
105+
bottomBackgroundClass = 'default-dotted-line';
131106
}
132-
return (
133-
<div
134-
className={cx('leg-before', this.props.modeClassName, {
135-
via: !!this.props.viaType,
136-
indoor: this.props.indoorLegType !== IndoorLegType.NoStepsInside,
137-
'has-indoor-steps': this.props.indoorStepsLength !== 0,
138-
'only-one-step': this.props.indoorStepsLength === 1,
139-
'first-leg': this.props.index === 0 && !this.props.isNotFirstLeg,
140-
})}
141-
aria-hidden="true"
142-
>
143-
{topMarker}
144-
145-
<div
146-
style={legBeforeLineStyle}
147-
className={cx(
148-
'leg-before-line',
149-
this.props.modeClassName,
150-
this.props.appendClass,
151-
topBackgroundClass,
152-
)}
153-
/>
154-
<RouteNumber
155-
appendClass={this.props.appendClass}
156-
mode={this.props.modeClassName}
157-
icon={this.props.icon}
158-
vertical
159-
/>
160-
<div
161-
style={legBeforeLineStyle}
162-
className={cx(
163-
'leg-before-line',
164-
this.props.modeClassName,
165-
'bottom',
166-
this.props.appendClass,
167-
bottomBackgroundClass,
168-
)}
169-
/>
170-
{(this.props.modeClassName === 'scooter' ||
171-
this.props.modeClassName === 'taxi-external') &&
172-
bottomMarker}
173-
</div>
174-
);
175107
}
108+
return (
109+
<div
110+
className={cx('leg-before', modeClassName, {
111+
via: !!viaType,
112+
indoor: indoorLegType !== IndoorLegType.NoStepsInside,
113+
'has-indoor-steps': indoorStepsLength !== 0,
114+
'only-one-step': indoorStepsLength === 1,
115+
'first-leg': index === 0 && !isNotFirstLeg,
116+
})}
117+
aria-hidden="true"
118+
>
119+
{topMarker}
120+
121+
<div
122+
style={legBeforeLineStyle}
123+
className={cx(
124+
'leg-before-line',
125+
modeClassName,
126+
appendClass,
127+
topBackgroundClass,
128+
)}
129+
/>
130+
<RouteNumber
131+
appendClass={appendClass}
132+
mode={modeClassName}
133+
icon={icon}
134+
vertical
135+
/>
136+
<div
137+
style={legBeforeLineStyle}
138+
className={cx(
139+
'leg-before-line',
140+
modeClassName,
141+
'bottom',
142+
appendClass,
143+
bottomBackgroundClass,
144+
)}
145+
/>
146+
{(modeClassName === 'scooter' || modeClassName === 'taxi-external') &&
147+
bottomMarker}
148+
</div>
149+
);
176150
}
177151

152+
ItineraryCircleLineWithIcon.propTypes = {
153+
index: PropTypes.number.isRequired,
154+
modeClassName: PropTypes.string.isRequired,
155+
viaType: PropTypes.string,
156+
indoorLegType: PropTypes.oneOf(Object.values(IndoorLegType)),
157+
showIntermediateSteps: PropTypes.bool,
158+
bikePark: PropTypes.bool,
159+
carPark: PropTypes.bool,
160+
color: PropTypes.string,
161+
appendClass: PropTypes.string,
162+
icon: PropTypes.string,
163+
style: PropTypes.shape({}),
164+
isNotFirstLeg: PropTypes.bool,
165+
isStop: PropTypes.bool,
166+
hasPreviousTransitLeg: PropTypes.bool,
167+
indoorStepsLength: PropTypes.number,
168+
};
169+
178170
export default ItineraryCircleLineWithIcon;

app/component/itinerary/Legs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ export default class Legs extends React.Component {
184184
icon={
185185
usingOwnCarWholeTrip ? 'icon_wait-car' : 'icon_wait_standing'
186186
}
187+
hasPreviousTransitLeg={leg.transitLeg}
187188
>
188189
{stopCode(leg.to.stop)}
189190
</WaitLeg>

0 commit comments

Comments
 (0)