From 63c073259a06dc954cc6d5487ec169340f33fc72 Mon Sep 17 00:00:00 2001 From: miles-grant-ibigroup Date: Thu, 19 Oct 2023 11:52:07 -0400 Subject: [PATCH] repair `getTransitiveRouteLabel` behavior --- lib/components/narrative/default/itinerary-summary.js | 7 ++++++- lib/util/state.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/components/narrative/default/itinerary-summary.js b/lib/components/narrative/default/itinerary-summary.js index 047ba3936..94fdade6f 100644 --- a/lib/components/narrative/default/itinerary-summary.js +++ b/lib/components/narrative/default/itinerary-summary.js @@ -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, @@ -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 = [] @@ -121,7 +126,7 @@ export default class ItinerarySummary extends Component { title={title} > - {leg.routeShortName} + {getTransitiveRouteLabel(leg)} ) }) diff --git a/lib/util/state.js b/lib/util/state.js index c25b0b615..c9eaca75e 100644 --- a/lib/util/state.js +++ b/lib/util/state.js @@ -721,7 +721,7 @@ export const getTransitiveData = createSelector( ? itineraryToTransitive(itineraryToRender, { companies, disableFlexArc, - getTransitiveRouteLabel, + getRouteLabel: getTransitiveRouteLabel, intl }) : null