Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions lib/components/narrative/line-itin/realtime-time-column.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import {
legType,
timeOptionsType
} from '@opentripplanner/core-utils/lib/types'
import { formatTime, getTimeFormat } from '@opentripplanner/core-utils/lib/time'
import { formatTime } from '@opentripplanner/core-utils/lib/time'
import PropTypes from 'prop-types'
import React from 'react'
import { connect } from 'react-redux'
import styled from 'styled-components'

const TimeText = styled.div``
Expand Down Expand Up @@ -129,16 +128,7 @@ function RealtimeTimeColumn ({
)
}

// Connect to redux store for timeOptions.
const mapStateToProps = (state, ownProps) => {
return {
timeOptions: {
format: getTimeFormat(state.otp.config)
}
}
}

export default connect(mapStateToProps)(RealtimeTimeColumn)
export default RealtimeTimeColumn

RealtimeTimeColumn.propTypes = {
isDestination: PropTypes.bool.isRequired,
Expand Down
48 changes: 24 additions & 24 deletions lib/components/narrative/tabbed-itineraries.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class TabbedItineraries extends Component {
static propTypes = {
itineraries: PropTypes.array,
itineraryClass: PropTypes.func,
pending: PropTypes.number,
pending: PropTypes.bool,
activeItinerary: PropTypes.number,
setActiveItinerary: PropTypes.func,
setActiveLeg: PropTypes.func,
Expand Down Expand Up @@ -85,6 +85,7 @@ class TabbedItineraries extends Component {
expanded: true,
routingType: 'ITINERARY',
showRealtimeAnnotation,
timeFormat,
...itineraryClassProps
})
: null
Expand All @@ -95,29 +96,6 @@ class TabbedItineraries extends Component {
}
}

// connect to the redux store

const mapStateToProps = (state, ownProps) => {
const activeSearch = getActiveSearch(state.otp)
// const { activeItinerary, activeLeg, activeStep } = activeSearch ? activeSearch.activeItinerary : {}
const pending = activeSearch ? activeSearch.pending : false
const realtimeEffects = getRealtimeEffects(state.otp)
const useRealtime = state.otp.useRealtime
return {
// swap out realtime itineraries with non-realtime depending on boolean
pending,
realtimeEffects,
activeItinerary: activeSearch && activeSearch.activeItinerary,
activeLeg: activeSearch && activeSearch.activeLeg,
activeStep: activeSearch && activeSearch.activeStep,
useRealtime,
companies: state.otp.currentQuery.companies,
tnc: state.otp.tnc,
timeFormat: getTimeFormat(state.otp.config),
user: state.user.loggedInUser
}
}

class TabButton extends Component {
_onClick = () => {
const {index, onClick} = this.props
Expand Down Expand Up @@ -180,6 +158,28 @@ class TabButton extends Component {
}
}

// connect to the redux store

const mapStateToProps = (state, ownProps) => {
const activeSearch = getActiveSearch(state.otp)
const pending = activeSearch ? Boolean(activeSearch.pending) : false
const realtimeEffects = getRealtimeEffects(state.otp)
const useRealtime = state.otp.useRealtime
return {
// swap out realtime itineraries with non-realtime depending on boolean
pending,
realtimeEffects,
activeItinerary: activeSearch && activeSearch.activeItinerary,
activeLeg: activeSearch && activeSearch.activeLeg,
activeStep: activeSearch && activeSearch.activeStep,
useRealtime,
companies: state.otp.currentQuery.companies,
tnc: state.otp.tnc,
timeFormat: getTimeFormat(state.otp.config),
user: state.user.loggedInUser
}
}

const mapDispatchToProps = (dispatch, ownProps) => {
const {setActiveItinerary, setActiveLeg, setActiveStep, setUseRealtimeResponse} = narrativeActions
return {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"redux-actions": "^1.2.1",
"redux-logger": "^2.7.4",
"redux-thunk": "^2.3.0",
"transitive-js": "^0.13.3",
"transitive-js": "^0.13.4",
"velocity-react": "^1.3.3",
"yup": "^0.29.3"
},
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15841,10 +15841,10 @@ tr46@^1.0.1:
dependencies:
punycode "^2.1.0"

transitive-js@^0.13.3:
version "0.13.3"
resolved "https://registry.yarnpkg.com/transitive-js/-/transitive-js-0.13.3.tgz#4c1671628a65551d7b70b53362300d7017fc0ac9"
integrity sha512-vm3v3HuCcmoL+64pew5MHltOabN+ONhs/IonHqf6sRWFUcpVgrUBc9OWLzkJpi1DDPiLjZa6KP27WuoZ1Mk/Fg==
transitive-js@^0.13.3, transitive-js@^0.13.4:
version "0.13.4"
resolved "https://registry.yarnpkg.com/transitive-js/-/transitive-js-0.13.4.tgz#2ef9b57f4c0f4ec594f84664300d91a46dfde820"
integrity sha512-26lcurtKYJAZJY0kWo3DelTO2ADIZz6uNxrCRUT0hvAcq/lnTLV3WR/vSmR8vsIWRQ10dokJ80VXK0Y3461Jag==
dependencies:
augment "4.3.0"
component-each "0.2.6"
Expand Down