Skip to content

Commit

Permalink
Merge pull request #5014 from HSLdevcom/DT-6293
Browse files Browse the repository at this point in the history
DT-6293 Itinerary notifier removes intermediate stop list
  • Loading branch information
vesameskanen authored Jun 13, 2024
2 parents cafa80d + 97e5db6 commit 5607a04
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions app/component/itinerary/TransitLeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ class TransitLeg extends React.Component {
constructor(props) {
super(props);
this.state = {
showIntermediateStops: props.leg.intermediatePlaces.length < 2,
showIntermediateStops:
props.interliningLegs.length >= 1
? props.interliningLegs.reduce(
(sum, leg) => sum + leg.intermediatePlaces.length,
0,
) < 2
: props.leg.intermediatePlaces.length < 2,
showAlternativeLegs: false,
};
}
Expand Down Expand Up @@ -143,7 +149,7 @@ class TransitLeg extends React.Component {
renderIntermediate() {
const { leg, mode, interliningLegs } = this.props;
if (
leg.intermediatePlaces.length > 0 &&
(leg.intermediatePlaces.length > 0 || interliningLegs.length > 0) &&
this.state.showIntermediateStops === true
) {
const places = leg.intermediatePlaces.slice();
Expand Down Expand Up @@ -419,7 +425,7 @@ class TransitLeg extends React.Component {
color={leg.route ? `#${leg.route.color}` : 'currentColor'}
renderBottomMarker={
!this.state.showIntermediateStops ||
leg.intermediatePlaces.length === 0
(leg.intermediatePlaces.length === 0 && interliningLegs.length < 1)
}
/>
<div
Expand Down Expand Up @@ -570,7 +576,8 @@ class TransitLeg extends React.Component {
<LegAgencyInfo leg={leg} />
{intermediateStopCount !== 0 && (
<div className="intermediate-stops-button-container">
{leg.intermediatePlaces.length > 1 && (
{(leg.intermediatePlaces.length > 1 ||
interliningLegs.length >= 1) && (
<StopInfo
toggleFunction={this.toggleShowIntermediateStops}
leg={leg}
Expand Down

0 comments on commit 5607a04

Please sign in to comment.