@@ -6,12 +6,23 @@ import currencyFormatter from 'currency-formatter'
66import LegDiagramPreview from '../leg-diagram-preview'
77
88import { distanceString } from '../../../util/distance'
9- import { getLegModeLabel , getLegIcon , getPlaceName , getStepDirection , getStepStreetName } from '../../../util/itinerary'
9+ import {
10+ getLegModeLabel ,
11+ getLegIcon ,
12+ getPlaceName ,
13+ getStepDirection ,
14+ getStepStreetName
15+ } from '../../../util/itinerary'
1016import { formatDuration , formatTime } from '../../../util/time'
1117import { isMobile } from '../../../util/ui'
1218
1319import DirectionIcon from '../../icons/direction-icon'
1420
21+ /**
22+ * Component for access (e.g. walk/bike/etc.) leg in narrative itinerary. This
23+ * particular component is used in the line-itin (i.e., trimet-mod-otp) version
24+ * of the narrative itinerary.
25+ */
1526export default class AccessLegBody extends Component {
1627 static propTypes = {
1728 leg : PropTypes . object ,
@@ -32,15 +43,27 @@ export default class AccessLegBody extends Component {
3243 }
3344
3445 render ( ) {
35- const { customIcons, followsTransit, leg, timeOptions } = this . props
46+ const { config , customIcons, followsTransit, leg, timeOptions } = this . props
3647
3748 if ( leg . mode === 'CAR' && leg . hailedCar ) {
38- return < TNCLeg leg = { leg } onSummaryClick = { this . _onSummaryClick } timeOptions = { timeOptions } followsTransit = { followsTransit } customIcons = { customIcons } />
49+ return (
50+ < TNCLeg
51+ config = { config }
52+ leg = { leg }
53+ onSummaryClick = { this . _onSummaryClick }
54+ timeOptions = { timeOptions }
55+ followsTransit = { followsTransit }
56+ customIcons = { customIcons } />
57+ )
3958 }
4059
4160 return (
4261 < div className = 'leg-body' >
43- < AccessLegSummary leg = { leg } onSummaryClick = { this . _onSummaryClick } customIcons = { customIcons } />
62+ < AccessLegSummary
63+ config = { config }
64+ leg = { leg }
65+ onSummaryClick = { this . _onSummaryClick }
66+ customIcons = { customIcons } />
4467
4568 < div onClick = { this . _onStepsHeaderClick } className = 'steps-header' >
4669 { formatDuration ( leg . duration ) }
@@ -60,6 +83,7 @@ class TNCLeg extends Component {
6083 render ( ) {
6184 // TODO: ensure that client ID fields are populated
6285 const {
86+ config,
6387 LYFT_CLIENT_ID ,
6488 UBER_CLIENT_ID ,
6589 customIcons,
@@ -82,7 +106,11 @@ class TNCLeg extends Component {
82106
83107 < div className = 'leg-body' >
84108 { /* The icon/summary row */ }
85- < AccessLegSummary leg = { leg } onSummaryClick = { this . props . onSummaryClick } customIcons = { customIcons } />
109+ < AccessLegSummary
110+ config = { config }
111+ leg = { leg }
112+ onSummaryClick = { this . props . onSummaryClick }
113+ customIcons = { customIcons } />
86114
87115 { /* The "Book Ride" button */ }
88116 < div style = { { marginTop : 10 , marginBottom : 10 , height : 32 , position : 'relative' } } >
@@ -125,7 +153,7 @@ class TNCLeg extends Component {
125153
126154class AccessLegSummary extends Component {
127155 render ( ) {
128- const { customIcons, leg } = this . props
156+ const { config , customIcons, leg } = this . props
129157 return (
130158 < div className = 'summary leg-description' onClick = { this . props . onSummaryClick } >
131159 { /* Mode-specific icon */ }
@@ -136,7 +164,7 @@ class AccessLegSummary extends Component {
136164 { getLegModeLabel ( leg ) }
137165 { ' ' }
138166 { leg . distance && < span > { distanceString ( leg . distance ) } </ span > }
139- { ` to ${ getPlaceName ( leg . to ) } ` }
167+ { ` to ${ getPlaceName ( leg . to , config . companies ) } ` }
140168 </ div >
141169 </ div >
142170 )
0 commit comments