From 93aeaf01e0b1e0cf207a7c29bb6d6acf0a8da9d7 Mon Sep 17 00:00:00 2001 From: Holger Bruch Date: Thu, 18 Apr 2024 22:55:05 +0200 Subject: [PATCH] feature: add carpool disclaimer for carpool legs --- app/component/ItineraryTab.js | 19 +++++++++++++++++++ app/configurations/config.vpe.js | 3 +++ 2 files changed, 22 insertions(+) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index 74b4443880..f88e920dcb 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -108,6 +108,11 @@ class ItineraryTab extends React.Component { ); }; + shouldShowCarpoolDisclaimer = (itinerary, config) => { + const hasCarpoolLegs = itinerary.legs.some(l => l.mode === 'CARPOOL'); + return hasCarpoolLegs && config.carpoolDisclaimer; + }; + printItinerary = e => { e.stopPropagation(); @@ -236,6 +241,7 @@ class ItineraryTab extends React.Component { } } } + const suggestionIndex = this.context.match.params.secondHash ? Number(this.context.match.params.secondHash) + 1 : Number(this.context.match.params.hash) + 1; @@ -338,6 +344,19 @@ class ItineraryTab extends React.Component { focusToLeg={this.props.focusToLeg} toggleCarpoolDrawer={this.props.toggleCarpoolDrawer} /> + { this.shouldShowCarpoolDisclaimer(itinerary, config) && ( +
+
+
+ +
+
+ {config.carpoolDisclaimer} +
+
+
+ )} + {shouldShowFareInfo(config) && (