Skip to content

Commit 60b4d74

Browse files
authored
Merge pull request #147 from opentripplanner/otp-ui-itinerary-body
otp-ui itinerary body
2 parents 721d403 + bc4487f commit 60b4d74

16 files changed

+415
-1277
lines changed

__tests__/reducers/__snapshots__/create-otp-reducer.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ Object {
88
"debouncePlanTimeMs": 0,
99
"homeTimezone": "America/Los_Angeles",
1010
"language": Object {},
11-
"operators": Array [],
1211
"realtimeEffectsDisplayThreshold": 120,
1312
"routingTypes": Array [],
1413
"stopViewer": Object {
1514
"numberOfDepartures": 3,
1615
"timeRange": 345600,
1716
},
17+
"transitOperators": Array [],
1818
},
1919
"currentQuery": Object {
2020
"bikeSpeed": 3.58,

lib/components/app/print-layout.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import BaseMap from '@opentripplanner/base-map'
2-
import EndpointsOverlay from '@opentripplanner/endpoints-overlay'
31
import TriMetLegIcon from '@opentripplanner/icons/lib/trimet-leg-icon'
42
import PrintableItinerary from '@opentripplanner/printable-itinerary'
5-
import TransitiveOverlay from '@opentripplanner/transitive-overlay'
63
import PropTypes from 'prop-types'
74
import React, { Component } from 'react'
85
import { Button } from 'react-bootstrap'
96
import { connect } from 'react-redux'
107

118
import { parseUrlQueryString } from '../../actions/form'
129
import { routingQuery } from '../../actions/api'
13-
import { getActiveItinerary } from '../../util/state'
10+
import DefaultMap from '../map/default-map'
1411
import TripDetails from '../narrative/connected-trip-details'
12+
import { getActiveItinerary } from '../../util/state'
1513

1614
class PrintLayout extends Component {
1715
static propTypes = {
@@ -91,10 +89,7 @@ class PrintLayout extends Component {
9189
{/* The map, if visible */}
9290
{this.state.mapVisible &&
9391
<div className='map-container'>
94-
<BaseMap>
95-
<TransitiveOverlay />
96-
<EndpointsOverlay />
97-
</BaseMap>
92+
<DefaultMap />
9893
</div>
9994
}
10095

lib/components/narrative/line-itin/access-leg-body.js

Lines changed: 0 additions & 200 deletions
This file was deleted.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import isEqual from 'lodash.isequal'
2+
import TriMetLegIcon from '@opentripplanner/icons/lib/trimet-leg-icon'
3+
import TransitLegSummary from '@opentripplanner/itinerary-body/lib/defaults/transit-leg-summary'
4+
import ItineraryBody from '@opentripplanner/itinerary-body/lib/otp-react-redux/itinerary-body'
5+
import LineColumnContent from '@opentripplanner/itinerary-body/lib/otp-react-redux/line-column-content'
6+
import PlaceName from '@opentripplanner/itinerary-body/lib/otp-react-redux/place-name'
7+
import RouteDescription from '@opentripplanner/itinerary-body/lib/otp-react-redux/route-description'
8+
import React, { Component } from 'react'
9+
import { connect } from 'react-redux'
10+
import styled from 'styled-components'
11+
12+
import { showLegDiagram } from '../../../actions/map'
13+
import { setActiveLeg } from '../../../actions/narrative'
14+
import { setViewedTrip } from '../../../actions/ui'
15+
import TransitLegSubheader from './connected-transit-leg-subheader'
16+
import TripDetails from '../connected-trip-details'
17+
import TripTools from '../trip-tools'
18+
19+
const noop = () => {}
20+
21+
const ItineraryBodyContainer = styled.div`
22+
padding: 20px 0px;
23+
`
24+
25+
class ConnectedItineraryBody extends Component {
26+
/** avoid rerendering if the itinerary to display hasn't changed */
27+
shouldComponentUpdate (nextProps, nextState) {
28+
return !isEqual(this.props.itinerary, nextProps.itinerary)
29+
}
30+
31+
render () {
32+
const {
33+
config,
34+
diagramVisible,
35+
itinerary,
36+
setActiveLeg,
37+
setViewedTrip,
38+
showLegDiagram
39+
} = this.props
40+
41+
return (
42+
<ItineraryBodyContainer>
43+
<ItineraryBody
44+
config={config}
45+
diagramVisible={diagramVisible}
46+
itinerary={itinerary}
47+
LegIcon={TriMetLegIcon}
48+
LineColumnContent={LineColumnContent}
49+
PlaceName={PlaceName}
50+
RouteDescription={RouteDescription}
51+
setActiveLeg={setActiveLeg}
52+
setLegDiagram={showLegDiagram}
53+
setViewedTrip={setViewedTrip}
54+
showAgencyInfo
55+
showElevationProfile
56+
showLegIcon
57+
showMapButtonColumn={false}
58+
showViewTripButton
59+
toRouteAbbreviation={noop}
60+
TransitLegSubheader={TransitLegSubheader}
61+
TransitLegSummary={TransitLegSummary}
62+
/>
63+
<TripDetails itinerary={itinerary} />
64+
<TripTools itinerary={itinerary} />
65+
</ItineraryBodyContainer>
66+
)
67+
}
68+
}
69+
70+
const mapStateToProps = (state, ownProps) => {
71+
return {
72+
config: state.otp.config,
73+
diagramVisible: state.otp.ui.diagramLeg
74+
}
75+
}
76+
77+
const mapDispatchToProps = {
78+
setActiveLeg,
79+
setViewedTrip,
80+
showLegDiagram
81+
}
82+
83+
export default connect(mapStateToProps, mapDispatchToProps)(
84+
ConnectedItineraryBody
85+
)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import TransitLegSubheader from '@opentripplanner/itinerary-body/lib/otp-react-redux/transit-leg-subheader'
2+
import React, { Component } from 'react'
3+
import { connect } from 'react-redux'
4+
5+
import { setMainPanelContent, setViewedStop } from '../../../actions/ui'
6+
7+
class ConnectedTransitLegSubheader extends Component {
8+
onClick = (payload) => {
9+
const { setMainPanelContent, setViewedStop } = this.props
10+
setMainPanelContent(null)
11+
setViewedStop(payload)
12+
}
13+
14+
render () {
15+
const { languageConfig, leg } = this.props
16+
return (
17+
<TransitLegSubheader
18+
languageConfig={languageConfig}
19+
leg={leg}
20+
onStopClick={this.onClick}
21+
/>
22+
)
23+
}
24+
}
25+
26+
const mapDispatchToProps = {
27+
setMainPanelContent,
28+
setViewedStop
29+
}
30+
31+
export default connect(null, mapDispatchToProps)(
32+
ConnectedTransitLegSubheader
33+
)

0 commit comments

Comments
 (0)