-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into elevation-point-marker
- Loading branch information
Showing
19 changed files
with
420 additions
and
1,310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
85 changes: 85 additions & 0 deletions
85
lib/components/narrative/line-itin/connected-itinerary-body.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import isEqual from 'lodash.isequal' | ||
import TriMetLegIcon from '@opentripplanner/icons/lib/trimet-leg-icon' | ||
import TransitLegSummary from '@opentripplanner/itinerary-body/lib/defaults/transit-leg-summary' | ||
import ItineraryBody from '@opentripplanner/itinerary-body/lib/otp-react-redux/itinerary-body' | ||
import LineColumnContent from '@opentripplanner/itinerary-body/lib/otp-react-redux/line-column-content' | ||
import PlaceName from '@opentripplanner/itinerary-body/lib/otp-react-redux/place-name' | ||
import RouteDescription from '@opentripplanner/itinerary-body/lib/otp-react-redux/route-description' | ||
import React, { Component } from 'react' | ||
import { connect } from 'react-redux' | ||
import styled from 'styled-components' | ||
|
||
import { showLegDiagram } from '../../../actions/map' | ||
import { setActiveLeg } from '../../../actions/narrative' | ||
import { setViewedTrip } from '../../../actions/ui' | ||
import TransitLegSubheader from './connected-transit-leg-subheader' | ||
import TripDetails from '../connected-trip-details' | ||
import TripTools from '../trip-tools' | ||
|
||
const noop = () => {} | ||
|
||
const ItineraryBodyContainer = styled.div` | ||
padding: 20px 0px; | ||
` | ||
|
||
class ConnectedItineraryBody extends Component { | ||
/** avoid rerendering if the itinerary to display hasn't changed */ | ||
shouldComponentUpdate (nextProps, nextState) { | ||
return !isEqual(this.props.itinerary, nextProps.itinerary) | ||
} | ||
|
||
render () { | ||
const { | ||
config, | ||
diagramVisible, | ||
itinerary, | ||
setActiveLeg, | ||
setViewedTrip, | ||
showLegDiagram | ||
} = this.props | ||
|
||
return ( | ||
<ItineraryBodyContainer> | ||
<ItineraryBody | ||
config={config} | ||
diagramVisible={diagramVisible} | ||
itinerary={itinerary} | ||
LegIcon={TriMetLegIcon} | ||
LineColumnContent={LineColumnContent} | ||
PlaceName={PlaceName} | ||
RouteDescription={RouteDescription} | ||
setActiveLeg={setActiveLeg} | ||
setLegDiagram={showLegDiagram} | ||
setViewedTrip={setViewedTrip} | ||
showAgencyInfo | ||
showElevationProfile | ||
showLegIcon | ||
showMapButtonColumn={false} | ||
showViewTripButton | ||
toRouteAbbreviation={noop} | ||
TransitLegSubheader={TransitLegSubheader} | ||
TransitLegSummary={TransitLegSummary} | ||
/> | ||
<TripDetails itinerary={itinerary} /> | ||
<TripTools itinerary={itinerary} /> | ||
</ItineraryBodyContainer> | ||
) | ||
} | ||
} | ||
|
||
const mapStateToProps = (state, ownProps) => { | ||
return { | ||
config: state.otp.config, | ||
diagramVisible: state.otp.ui.diagramLeg | ||
} | ||
} | ||
|
||
const mapDispatchToProps = { | ||
setActiveLeg, | ||
setViewedTrip, | ||
showLegDiagram | ||
} | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)( | ||
ConnectedItineraryBody | ||
) |
33 changes: 33 additions & 0 deletions
33
lib/components/narrative/line-itin/connected-transit-leg-subheader.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import TransitLegSubheader from '@opentripplanner/itinerary-body/lib/otp-react-redux/transit-leg-subheader' | ||
import React, { Component } from 'react' | ||
import { connect } from 'react-redux' | ||
|
||
import { setMainPanelContent, setViewedStop } from '../../../actions/ui' | ||
|
||
class ConnectedTransitLegSubheader extends Component { | ||
onClick = (payload) => { | ||
const { setMainPanelContent, setViewedStop } = this.props | ||
setMainPanelContent(null) | ||
setViewedStop(payload) | ||
} | ||
|
||
render () { | ||
const { languageConfig, leg } = this.props | ||
return ( | ||
<TransitLegSubheader | ||
languageConfig={languageConfig} | ||
leg={leg} | ||
onStopClick={this.onClick} | ||
/> | ||
) | ||
} | ||
} | ||
|
||
const mapDispatchToProps = { | ||
setMainPanelContent, | ||
setViewedStop | ||
} | ||
|
||
export default connect(null, mapDispatchToProps)( | ||
ConnectedTransitLegSubheader | ||
) |
Oops, something went wrong.