Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
cd17a9f
chore(deps): Update itinerary package versions.
binh-dam-ibigroup Apr 25, 2022
9ebe55c
chore(deps): Update core-utils version, dedupe yarn.lock.
binh-dam-ibigroup Apr 25, 2022
3193412
Merge branch 'remove-deprecated-core-utils-methods' into update-itine…
binh-dam-ibigroup Apr 26, 2022
490b071
fix(ConnectedItineraryBody): Use new itinerary body version.
binh-dam-ibigroup Apr 26, 2022
7752184
fix(actions/form): Fix inaccurate state check.
binh-dam-ibigroup Apr 26, 2022
f6c5b6e
refactor(itinerary components): Remove unused props.
binh-dam-ibigroup Apr 26, 2022
d49f885
Merge branch 'dev' into update-itinerary-packages
binh-dam-ibigroup Apr 26, 2022
083df12
refactor(itinerary components): Fix TypeScript errors
binh-dam-ibigroup Apr 26, 2022
6b32f2d
chore(deps): Update itinerary-body package
binh-dam-ibigroup May 4, 2022
145f814
refactor(create-otp-reducer): Initialize mainPanelContent.
binh-dam-ibigroup May 4, 2022
3affce5
test(create-otp-reducer): Update snapshot
binh-dam-ibigroup May 4, 2022
d9d99f1
Revert "test(create-otp-reducer): Update snapshot"
binh-dam-ibigroup May 4, 2022
a195c4e
Revert "refactor(create-otp-reducer): Initialize mainPanelContent."
binh-dam-ibigroup May 4, 2022
2a2af6a
Revert "Revert "test(create-otp-reducer): Update snapshot""
binh-dam-ibigroup May 4, 2022
8cb0718
Revert "Revert "refactor(create-otp-reducer): Initialize mainPanelCon…
binh-dam-ibigroup May 4, 2022
d55643e
Merge branch 'remove-deprecated-core-utils-methods' into update-itine…
binh-dam-ibigroup May 5, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Object {
"diagramLeg": null,
"locale": null,
"localizedMessages": null,
"mainPanelContent": null,
"mobileScreen": 1,
"printView": false,
"routeViewer": Object {
Expand Down
1 change: 0 additions & 1 deletion lib/components/narrative/default/default-itinerary.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ class DefaultItinerary extends NarrativeItinerary {
itinerary={itinerary}
LegIcon={LegIcon}
setActiveLeg={setActiveLeg}
timeOptions={timeOptions}
/>
</>
)}
Expand Down
10 changes: 4 additions & 6 deletions lib/components/narrative/line-itin/connected-itinerary-body.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable react/prop-types */
// TODO: Typescript (otp-rr config object)
import { connect } from 'react-redux'
import { PlaceName } from '@opentripplanner/itinerary-body/lib/otp-react-redux'
import {
PlaceName as PlaceNameWrapper,
PlaceRowWrapper
Expand All @@ -9,7 +10,6 @@ import clone from 'clone'
import isEqual from 'lodash.isequal'
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 React, { Component } from 'react'
import RouteDescription from '@opentripplanner/itinerary-body/lib/otp-react-redux/route-description'
import styled from 'styled-components'
Expand Down Expand Up @@ -44,7 +44,7 @@ class ConnectedItineraryBody extends Component {
static contextType = ComponentContext

/** avoid rerendering if the itinerary to display hasn't changed */
shouldComponentUpdate(nextProps, nextState) {
shouldComponentUpdate(nextProps) {
return !isEqual(this.props.itinerary, nextProps.itinerary)
}

Expand All @@ -57,8 +57,7 @@ class ConnectedItineraryBody extends Component {
setActiveLeg,
setLegDiagram,
setMapillaryId,
setViewedTrip,
timeOptions
setViewedTrip
} = this.props
const { LegIcon } = this.context
const clonedItinerary = clone(itinerary)
Expand Down Expand Up @@ -114,7 +113,6 @@ class ConnectedItineraryBody extends Component {
showRouteFares={config.itinerary && config.itinerary.showRouteFares}
showViewTripButton
TimeColumnContent={RealtimeTimeColumn}
timeOptions={timeOptions}
toRouteAbbreviation={noop}
TransitLegSubheader={TransitLegSubheader}
TransitLegSummary={TransitLegSummary}
Expand All @@ -126,7 +124,7 @@ class ConnectedItineraryBody extends Component {
}
}

const mapStateToProps = (state, ownProps) => {
const mapStateToProps = (state) => {
return {
config: state.otp.config,
diagramVisible: state.otp.ui.diagramLeg
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { connect } from 'react-redux'
import { Leg } from '@opentripplanner/types'
import React, { Component } from 'react'
import TransitLegSubheader from '@opentripplanner/itinerary-body/lib/otp-react-redux/transit-leg-subheader'

import { setMainPanelContent, setViewedStop } from '../../../actions/ui'

interface Props {
leg: Leg
setMainPanelContent: (content: any) => void
setViewedStop: (payload: { stopId: string }) => void
}

class ConnectedTransitLegSubheader extends Component<Props> {
onClick = (payload: { stopId: string }) => {
const { setMainPanelContent, setViewedStop } = this.props
setMainPanelContent(null)
setViewedStop(payload)
}

render() {
const { leg } = this.props
return <TransitLegSubheader leg={leg} onStopClick={this.onClick} />
}
}

const mapDispatchToProps = {
setMainPanelContent,
setViewedStop
}

export default connect(null, mapDispatchToProps)(ConnectedTransitLegSubheader)
1 change: 0 additions & 1 deletion lib/components/narrative/line-itin/line-itinerary.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export default class LineItinerary extends NarrativeItinerary {
// (will cause error when clicking on itinerary summary).
// Use the one passed by NarrativeItineraries instead.
setActiveLeg={setActiveLeg}
timeOptions={timeOptions}
/>
) : null}
{ItineraryFooter && <ItineraryFooter />}
Expand Down
72 changes: 0 additions & 72 deletions lib/components/narrative/line-itin/realtime-time-column.js

This file was deleted.

60 changes: 60 additions & 0 deletions lib/components/narrative/line-itin/realtime-time-column.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { FormattedTime } from 'react-intl'
// TYPESCRIPT TODO: wait for typescripted core-utils
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { isTransit } from '@opentripplanner/core-utils/lib/itinerary'
import { Leg } from '@opentripplanner/types'
import React, { ReactElement } from 'react'
import styled from 'styled-components'

import RealtimeStatusLabel, {
DelayText,
MainContent
} from '../../viewers/realtime-status-label'

interface Props {
isDestination: boolean
leg: Leg
}

const StyledStatusLabel = styled(RealtimeStatusLabel)`
${MainContent} {
font-size: 80%;
line-height: 1em;
}
${DelayText} {
display: block;
}
`
/**
* This component displays the scheduled departure/arrival time for a leg,
* and, for transit legs, displays any delays or earliness where applicable.
*/
function RealtimeTimeColumn({ isDestination, leg }: Props): ReactElement {
const timeMillis = isDestination ? leg.endTime : leg.startTime
const isTransitLeg = isTransit(leg.mode)
const isRealtimeTransitLeg = isTransitLeg && leg.realTime

// For non-transit legs show only the scheduled time.
if (!isTransitLeg) {
return (
<div>
<FormattedTime timeStyle="short" value={timeMillis} />
</div>
)
}

const delaySeconds = isDestination ? leg.arrivalDelay : leg.departureDelay
const originalTimeMillis = timeMillis - delaySeconds * 1000

return (
<StyledStatusLabel
delay={delaySeconds}
isRealtime={isRealtimeTransitLeg}
originalTime={originalTimeMillis}
time={timeMillis}
/>
)
}

export default RealtimeTimeColumn
1 change: 1 addition & 0 deletions lib/reducers/create-otp-reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export function getInitialState(userDefinedConfig) {
diagramLeg: null,
locale: null,
localizedMessages: null,
mainPanelContent: null,
mobileScreen: MobileScreens.WELCOME_SCREEN,
printView: window.location.href.indexOf('/print/') !== -1,
routeViewer: {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
"@opentripplanner/endpoints-overlay": "^1.4.1",
"@opentripplanner/from-to-location-picker": "^2.1.1",
"@opentripplanner/geocoder": "^1.2.1",
"@opentripplanner/humanize-distance": "^1.1.0",
"@opentripplanner/humanize-distance": "^1.2.0",
"@opentripplanner/icons": "^1.2.0",
"@opentripplanner/itinerary-body": "^2.9.0",
"@opentripplanner/itinerary-body": "^3.0.3",
"@opentripplanner/location-field": "1.12.2",
"@opentripplanner/location-icon": "^1.4.0",
"@opentripplanner/park-and-ride-overlay": "^1.2.4",
"@opentripplanner/printable-itinerary": "^1.3.1",
"@opentripplanner/printable-itinerary": "^2.0.0",
"@opentripplanner/route-viewer-overlay": "^1.3.0",
"@opentripplanner/stop-viewer-overlay": "^1.1.1",
"@opentripplanner/stops-overlay": "^4.0.0",
Expand Down
Loading