Skip to content

Commit

Permalink
repair getTransitiveRouteLabel behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
miles-grant-ibigroup committed Oct 19, 2023
1 parent c3a143f commit 63c0732
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/components/narrative/default/itinerary-summary.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/* eslint-disable @typescript-eslint/no-use-before-define */

import { connect } from 'react-redux'
import { getCompanyFromLeg } from '@opentripplanner/core-utils/lib/itinerary'
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import styled from 'styled-components'

import { ComponentContext } from '../../../util/contexts'

const mapStateToProps = (state, ownProps) => {
return {
fillModeIcons: state.otp.config.itinerary?.fillModeIcons,
Expand Down Expand Up @@ -74,12 +77,14 @@ function getModeColor(mode) {
}

export default class ItinerarySummary extends Component {
static contextType = ComponentContext
static propTypes = {
itinerary: PropTypes.object,
LegIcon: PropTypes.elementType.isRequired
}

render() {
const { getTransitiveRouteLabel } = this.context
const { itinerary, LegIcon } = this.props

const blocks = []
Expand Down Expand Up @@ -121,7 +126,7 @@ export default class ItinerarySummary extends Component {
title={title}
>
<LegIcon leg={leg} style={iconStyle} />
<span>{leg.routeShortName}</span>
<span>{getTransitiveRouteLabel(leg)}</span>
</Block>
)
})
Expand Down
2 changes: 1 addition & 1 deletion lib/util/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ export const getTransitiveData = createSelector(
? itineraryToTransitive(itineraryToRender, {
companies,
disableFlexArc,
getTransitiveRouteLabel,
getRouteLabel: getTransitiveRouteLabel,
intl
})
: null
Expand Down

0 comments on commit 63c0732

Please sign in to comment.