@@ -6,7 +6,7 @@ import currencyFormatter from 'currency-formatter'
6
6
import LegDiagramPreview from '../leg-diagram-preview'
7
7
8
8
import { distanceString } from '../../../util/distance'
9
- import { getLegModeString , getIcon , getPlaceName , getStepDirection , getStepStreetName } from '../../../util/itinerary'
9
+ import { getLegModeLabel , getIcon , getPlaceName , getStepDirection , getStepStreetName } from '../../../util/itinerary'
10
10
import { formatDuration , formatTime } from '../../../util/time'
11
11
import { isMobile } from '../../../util/ui'
12
12
@@ -15,7 +15,6 @@ import DirectionIcon from '../../icons/direction-icon'
15
15
export default class AccessLegBody extends Component {
16
16
static propTypes = {
17
17
leg : PropTypes . object ,
18
- legMode : PropTypes . any ,
19
18
routingType : PropTypes . string
20
19
}
21
20
@@ -33,15 +32,15 @@ export default class AccessLegBody extends Component {
33
32
}
34
33
35
34
render ( ) {
36
- const { customIcons, leg , legMode , timeOptions , followsTransit } = this . props
35
+ const { customIcons, followsTransit , iconKey , leg , timeOptions } = this . props
37
36
38
37
if ( leg . mode === 'CAR' && leg . hailedCar ) {
39
- return < TNCLeg leg = { leg } legMode = { legMode } onSummaryClick = { this . _onSummaryClick } timeOptions = { timeOptions } followsTransit = { followsTransit } customIcons = { customIcons } />
38
+ return < TNCLeg leg = { leg } iconKey = { iconKey } onSummaryClick = { this . _onSummaryClick } timeOptions = { timeOptions } followsTransit = { followsTransit } customIcons = { customIcons } />
40
39
}
41
40
42
41
return (
43
42
< div className = 'leg-body' >
44
- < AccessLegSummary leg = { leg } legMode = { legMode } onSummaryClick = { this . _onSummaryClick } customIcons = { customIcons } />
43
+ < AccessLegSummary leg = { leg } iconKey = { iconKey } onSummaryClick = { this . _onSummaryClick } customIcons = { customIcons } />
45
44
46
45
< div onClick = { this . _onStepsHeaderClick } className = 'steps-header' >
47
46
{ formatDuration ( leg . duration ) }
@@ -60,7 +59,15 @@ export default class AccessLegBody extends Component {
60
59
class TNCLeg extends Component {
61
60
render ( ) {
62
61
// TODO: ensure that client ID fields are populated
63
- const { customIcons, leg, legMode, timeOptions, followsTransit, LYFT_CLIENT_ID , UBER_CLIENT_ID } = this . props
62
+ const {
63
+ LYFT_CLIENT_ID ,
64
+ UBER_CLIENT_ID ,
65
+ customIcons,
66
+ followsTransit,
67
+ iconKey,
68
+ leg,
69
+ timeOptions
70
+ } = this . props
64
71
const universalLinks = {
65
72
'UBER' : `https://m.uber.com/${ isMobile ( ) ? 'ul/' : '' } ?client_id=${ UBER_CLIENT_ID } &action=setPickup&pickup[latitude]=${ leg . from . lat } &pickup[longitude]=${ leg . from . lon } &pickup[formatted_address]=${ encodeURI ( leg . from . name ) } &dropoff[latitude]=${ leg . to . lat } &dropoff[longitude]=${ leg . to . lon } &dropoff[formatted_address]=${ encodeURI ( leg . to . name ) } ` ,
66
73
'LYFT' : `https://lyft.com/ride?id=lyft&partner=${ LYFT_CLIENT_ID } &pickup[latitude]=${ leg . from . lat } &pickup[longitude]=${ leg . from . lon } &destination[latitude]=${ leg . to . lat } &destination[longitude]=${ leg . to . lon } `
@@ -76,7 +83,7 @@ class TNCLeg extends Component {
76
83
77
84
< div className = 'leg-body' >
78
85
{ /* The icon/summary row */ }
79
- < AccessLegSummary leg = { leg } legMode = { legMode } onSummaryClick = { this . props . onSummaryClick } customIcons = { customIcons } />
86
+ < AccessLegSummary leg = { leg } iconKey = { iconKey } onSummaryClick = { this . props . onSummaryClick } customIcons = { customIcons } />
80
87
81
88
{ /* The "Book Ride" button */ }
82
89
< div style = { { marginTop : 10 , marginBottom : 10 , height : 32 , position : 'relative' } } >
@@ -119,15 +126,15 @@ class TNCLeg extends Component {
119
126
120
127
class AccessLegSummary extends Component {
121
128
render ( ) {
122
- const { customIcons, leg, legMode } = this . props
129
+ const { customIcons, leg, iconKey } = this . props
123
130
return (
124
131
< div className = 'summary leg-description' onClick = { this . props . onSummaryClick } >
125
132
{ /* Mode-specific icon */ }
126
- < div > < div className = 'icon' > { getIcon ( legMode , customIcons ) } </ div > </ div >
133
+ < div > < div className = 'icon' > { getIcon ( iconKey , customIcons ) } </ div > </ div >
127
134
128
135
{ /* Leg description, e.g. "Walk 0.5 mi to..." */ }
129
136
< div >
130
- { getLegModeString ( leg ) }
137
+ { getLegModeLabel ( leg ) }
131
138
{ ' ' }
132
139
{ leg . distance && < span > { distanceString ( leg . distance ) } </ span > }
133
140
{ ` to ${ getPlaceName ( leg . to ) } ` }
0 commit comments