From 9846088770e066e70536460aef51b38653fdac1c Mon Sep 17 00:00:00 2001 From: Dvun Date: Fri, 20 Oct 2023 11:15:18 +0300 Subject: [PATCH 01/49] fix: added new links for Tampere --- app/configurations/config.tampere.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/configurations/config.tampere.js b/app/configurations/config.tampere.js index c87c30d78f..4a105f806f 100644 --- a/app/configurations/config.tampere.js +++ b/app/configurations/config.tampere.js @@ -95,6 +95,23 @@ export default configMerger(walttiConfig, { }, }, + callTampereInfo: { + fi: { + callTampereInfoLink: 'https://www.nysse.fi/junat', + callTampereInfoLinkText: 'nysse.fi/junat', + }, + sv: { + callTampereInfoLink: 'https://www.nysse.fi/en/ways-to-get-around/train', + callTampereInfoLinkText: + 'Trains in the Nysse area - Nysse, Tampere regional transport', + }, + en: { + callTampereInfoLink: 'https://www.nysse.fi/en/ways-to-get-around/train', + callTampereInfoLinkText: + 'Trains in the Nysse area - Nysse, Tampere regional transport', + }, + }, + // mapping fareId from OTP fare identifiers to human readable form fareMapping: function mapFareId(fareId) { return fareId && fareId.substring From 33b3c1152618652b2f8208843767fe04533712af Mon Sep 17 00:00:00 2001 From: Dvun Date: Fri, 20 Oct 2023 11:16:11 +0300 Subject: [PATCH 02/49] fix: added new text in infobox with links --- app/component/ItineraryTab.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index 0d66d38114..0190cb5623 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -331,7 +331,7 @@ class ItineraryTab extends React.Component { ) : (
+ + +
)} From 182ba1c2da6f90ff2bb2b7ecc77e720bf4c6fafc Mon Sep 17 00:00:00 2001 From: Dvun Date: Fri, 20 Oct 2023 11:18:51 +0300 Subject: [PATCH 03/49] fix: added new text in infobox with links --- app/component/TransitLeg.js | 41 ++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/app/component/TransitLeg.js b/app/component/TransitLeg.js index 20b05cdeb9..bcfb95a380 100644 --- a/app/component/TransitLeg.js +++ b/app/component/TransitLeg.js @@ -5,8 +5,8 @@ import React from 'react'; import { FormattedMessage, intlShape } from 'react-intl'; import Link from 'found/Link'; import connectToStores from 'fluxible-addons-react/connectToStores'; +import get from 'lodash/get'; -import ExternalLink from './ExternalLink'; import LegAgencyInfo from './LegAgencyInfo'; import Icon from './Icon'; import IntermediateLeg from './IntermediateLeg'; @@ -231,7 +231,6 @@ class TransitLeg extends React.Component { .format('HH:mm')} , ]; - const LegRouteName = leg.from.name.concat(' - ').concat(leg.to.name); const modeClassName = mode.toLowerCase(); const textVersionBeforeLink = ( @@ -547,27 +546,23 @@ class TransitLeg extends React.Component { {leg.fare && leg.fare.isUnknown && shouldShowFareInfo(config) && (
- - {`${intl.formatMessage({ id: 'pay-attention' })} `} - - {intl.formatMessage({ id: 'separate-ticket-required' })} -
-
-
{LegRouteName}
- {leg.fare.agency && - !config.hideExternalOperator(leg.fare.agency) && ( - -
{leg.fare.agency.name}
- {leg.fare.agency.fareUrl && ( - - {intl.formatMessage({ id: 'extra-info' })} - - )} -
- )} + + + +
)} From 67fc9aedb5c760ba2106ce66048b543cc16417b9 Mon Sep 17 00:00:00 2001 From: Dvun Date: Fri, 20 Oct 2023 11:26:18 +0300 Subject: [PATCH 04/49] fix: added new translation texts --- app/translations.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/translations.js b/app/translations.js index 755c980cf8..29c97001a9 100644 --- a/app/translations.js +++ b/app/translations.js @@ -1295,6 +1295,8 @@ const translations = { 'number-of-minutes': '{number, plural, =0 {0 minutes} one {1 minute} other {{number} minutes}}', 'number-of-spaces': 'Number of spaces:', + 'nysse-ticket-limited': + 'Nysse tickets are valid on trains in the Nysse area with some limitations. Read more on ', 'off-canvas-info': 'Log in to the service to save your favorites and utilize them on other devices', 'one-way-journey': 'The length of a one-way journey', @@ -2431,6 +2433,8 @@ const translations = { 'number-of-minutes': '{number, plural, =0 {0 minuuttia} one {1 minuutti} other {{number} minuuttia}}', 'number-of-spaces': 'Paikkojen määrä:', + 'nysse-ticket-limited': + 'Nyssen liput käyvät junaliikenteessä rajoitetusti vain Nysse-alueella. Lue lisää ', 'off-canvas-info': 'Kirjautumalla palveluun saat suosikit talteen ja voit hyödyntää niitä muillakin laitteillasi', 'one-way-journey': 'Yhdensuuntaisen matkan pituus', @@ -4347,6 +4351,8 @@ const translations = { 'number-of-minutes': '{number, plural, =0 {0 minuter} one {1 minut} other {{number} minuter}}', 'number-of-spaces': 'Antalet platser:', + 'nysse-ticket-limited': + 'Nysse-biljetter är giltiga på tåg i Nysse-området, med vissa begränsningar. Läs mer på ', 'off-canvas-info': 'Genom att logga in kan du spara dina favoriter och använda dem med dina andra enheter.', 'one-way-journey': ' Längden på en enkel resa', From 99f7b3155e484365496dbb56a93a0026315f195e Mon Sep 17 00:00:00 2001 From: Dvun Date: Mon, 23 Oct 2023 15:06:05 +0300 Subject: [PATCH 05/49] fix: renamed names in config --- app/configurations/config.tampere.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/configurations/config.tampere.js b/app/configurations/config.tampere.js index 4a105f806f..7cdabcaee8 100644 --- a/app/configurations/config.tampere.js +++ b/app/configurations/config.tampere.js @@ -95,19 +95,21 @@ export default configMerger(walttiConfig, { }, }, - callTampereInfo: { + showTrainLimitation: { fi: { - callTampereInfoLink: 'https://www.nysse.fi/junat', - callTampereInfoLinkText: 'nysse.fi/junat', + showTrainLimitationInfoLink: 'https://www.nysse.fi/junat', + showTrainLimitationInfoLinkText: 'nysse.fi/junat', }, sv: { - callTampereInfoLink: 'https://www.nysse.fi/en/ways-to-get-around/train', - callTampereInfoLinkText: + showTrainLimitationInfoLink: + 'https://www.nysse.fi/en/ways-to-get-around/train', + showTrainLimitationInfoLinkText: 'Trains in the Nysse area - Nysse, Tampere regional transport', }, en: { - callTampereInfoLink: 'https://www.nysse.fi/en/ways-to-get-around/train', - callTampereInfoLinkText: + showTrainLimitationInfoLink: + 'https://www.nysse.fi/en/ways-to-get-around/train', + showTrainLimitationInfoLinkText: 'Trains in the Nysse area - Nysse, Tampere regional transport', }, }, From e807d10ae9db39d11998082a09a7b4b6c4b7a36b Mon Sep 17 00:00:00 2001 From: Dvun Date: Mon, 23 Oct 2023 15:09:45 +0300 Subject: [PATCH 06/49] fix: renamed --- app/configurations/config.tampere.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/configurations/config.tampere.js b/app/configurations/config.tampere.js index 7cdabcaee8..b1a66f566c 100644 --- a/app/configurations/config.tampere.js +++ b/app/configurations/config.tampere.js @@ -95,7 +95,7 @@ export default configMerger(walttiConfig, { }, }, - showTrainLimitation: { + showTrainLimitationInfo: { fi: { showTrainLimitationInfoLink: 'https://www.nysse.fi/junat', showTrainLimitationInfoLinkText: 'nysse.fi/junat', From 290cf17ef4e24b868b9dbcaa5112361524de6096 Mon Sep 17 00:00:00 2001 From: Dvun Date: Mon, 23 Oct 2023 15:24:46 +0300 Subject: [PATCH 07/49] fix: added new text for infobox --- app/component/ItineraryTab.js | 158 ++++++++++++++++++++++------------ 1 file changed, 101 insertions(+), 57 deletions(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index 0190cb5623..6ff8889c66 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -15,17 +15,17 @@ import ItineraryLegs from './ItineraryLegs'; import BackButton from './BackButton'; import MobileTicketPurchaseInformation from './MobileTicketPurchaseInformation'; import { - getRoutes, - getZones, compressLegs, + getRoutes, getTotalBikingDistance, getTotalBikingDuration, + getTotalDrivingDistance, + getTotalDrivingDuration, getTotalWalkingDistance, getTotalWalkingDuration, - legContainsRentalBike, - getTotalDrivingDuration, - getTotalDrivingDistance, + getZones, isCallAgencyPickupType, + legContainsRentalBike, } from '../util/legUtils'; import { BreakpointConsumer } from '../util/withBreakpoint'; @@ -36,10 +36,10 @@ import { } from '../util/fareUtils'; import { addAnalyticsEvent } from '../util/analyticsUtils'; import { + getCurrentMillis, + getFormattedTimeDate, isToday, isTomorrow, - getFormattedTimeDate, - getCurrentMillis, } from '../util/timeUtils'; import CityBikeDurationInfo from './CityBikeDurationInfo'; import { getCityBikeNetworkId } from '../util/citybikes'; @@ -86,7 +86,7 @@ class ItineraryTab extends React.Component { static defaultProps = { hideTitle: false, - currentLanguage: "fi" + currentLanguage: 'fi', }; static contextTypes = { @@ -216,8 +216,79 @@ 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; - const itineraryContainsCallLegs = itinerary.legs.some(leg => isCallAgencyPickupType(leg)); - + const itineraryContainsCallLegs = itinerary.legs.some(leg => + isCallAgencyPickupType(leg), + ); + + const infoBoxText = () => { + if (config.callAgencyInfo && itineraryContainsCallLegs) { + return ( +
+ + + + +
+ ); + } + + if (config.showTrainLimitationInfo) { + return ( +
+ + + + +
+ ); + } + + return ( +
+ +
+ ); + }; + return (

@@ -240,7 +311,11 @@ class ItineraryTab extends React.Component { futureText={extraProps.futureText} isMultiRow={extraProps.isMultiRow} isMobile={this.props.isMobile} - hideBottomDivider={shouldShowFarePurchaseInfo(config, breakpoint, fares)} + hideBottomDivider={shouldShowFarePurchaseInfo( + config, + breakpoint, + fares, + )} /> ) : ( <> @@ -281,18 +356,19 @@ class ItineraryTab extends React.Component { config={config} /> ), - shouldShowFareInfo(config) && ( - shouldShowFarePurchaseInfo(config,breakpoint,fares) ? ( + shouldShowFareInfo(config) && + (shouldShowFarePurchaseInfo(config, breakpoint, fares) ? ( ) : - ( + ) : ( + ) - ), + /> + )),
- {config.callAgencyInfo && itineraryContainsCallLegs ? - (
- - - - -
- ) : ( -
- - - - -
- )} + {infoBoxText()}

)} Date: Mon, 23 Oct 2023 15:26:10 +0300 Subject: [PATCH 08/49] fix: added new text for infobox --- app/component/TransitLeg.js | 89 +++++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 29 deletions(-) diff --git a/app/component/TransitLeg.js b/app/component/TransitLeg.js index bcfb95a380..ff99257bc9 100644 --- a/app/component/TransitLeg.js +++ b/app/component/TransitLeg.js @@ -5,7 +5,6 @@ import React from 'react'; import { FormattedMessage, intlShape } from 'react-intl'; import Link from 'found/Link'; import connectToStores from 'fluxible-addons-react/connectToStores'; -import get from 'lodash/get'; import LegAgencyInfo from './LegAgencyInfo'; import Icon from './Icon'; @@ -16,30 +15,31 @@ import PlatformNumber from './PlatformNumber'; import ServiceAlertIcon from './ServiceAlertIcon'; import StopCode from './StopCode'; import { + alertSeverityCompare, getActiveAlertSeverityLevel, - legHasCancelation, - tripHasCancelationForStop, getActiveLegAlerts, getActiveLegAlertSeverityLevel, - alertSeverityCompare, getMaximumAlertSeverityLevel, hasEntitiesOfType, + legHasCancelation, + tripHasCancelationForStop, } from '../util/alertUtils'; -import { PREFIX_ROUTES, PREFIX_STOPS, PREFIX_DISRUPTION } from '../util/path'; +import { PREFIX_DISRUPTION, PREFIX_ROUTES, PREFIX_STOPS } from '../util/path'; import { durationToString } from '../util/timeUtils'; import { addAnalyticsEvent } from '../util/analyticsUtils'; import { - getZoneLabel, getHeadsignFromRouteLongName, getStopHeadsignFromStoptimes, + getZoneLabel, } from '../util/legUtils'; import { shouldShowFareInfo } from '../util/fareUtils'; -import { AlertSeverityLevelType, AlertEntityType } from '../constants'; +import { AlertEntityType, AlertSeverityLevelType } from '../constants'; import ZoneIcon from './ZoneIcon'; import StopInfo from './StopInfo'; import InterlineInfo from './InterlineInfo'; import AlternativeLegsInfo from './AlternativeLegsInfo'; import LegInfo from './LegInfo'; +import ExternalLink from './ExternalLink'; class TransitLeg extends React.Component { constructor(props) { @@ -232,6 +232,7 @@ class TransitLeg extends React.Component { , ]; const modeClassName = mode.toLowerCase(); + const LegRouteName = leg.from.name.concat(' - ').concat(leg.to.name); const textVersionBeforeLink = ( )} - {leg.fare && leg.fare.isUnknown && shouldShowFareInfo(config) && ( -
-
- - - +
+ + - + > + + +
-
- )} + ) : ( +
+
+ + {`${intl.formatMessage({ id: 'pay-attention' })} `} + + {intl.formatMessage({ id: 'separate-ticket-required' })} +
+
+
{LegRouteName}
+ {leg.fare.agency && + !config.hideExternalOperator(leg.fare.agency) && ( + +
{leg.fare.agency.name}
+ {leg.fare.agency.fareUrl && ( + + {intl.formatMessage({ id: 'extra-info' })} + + )} +
+ )} +
+
+ ))} - {alertSeverityDescription} + {alertSeverityDescription}; ); }; From f569001b4b6b448c38b41ee3751f86d8cbffd3cb Mon Sep 17 00:00:00 2001 From: Dvun Date: Wed, 1 Nov 2023 15:31:28 +0200 Subject: [PATCH 09/49] fix: renamed nysse-ticket-limited" to train-ticket-limited" --- app/component/ItineraryTab.js | 4 ++-- app/component/TransitLeg.js | 8 +++++++- app/translations.js | 13 +++++++------ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index 6ff8889c66..7e7970ff43 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -251,9 +251,9 @@ class ItineraryTab extends React.Component { return (
- + Date: Tue, 7 Nov 2023 13:33:51 +0200 Subject: [PATCH 10/49] fix: new function for check pickup type --- app/component/ItineraryTab.js | 6 +++++- app/util/legUtils.js | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index 7e7970ff43..237b4faabd 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -25,6 +25,7 @@ import { getTotalWalkingDuration, getZones, isCallAgencyPickupType, + isTrainLimitationPickupType, legContainsRentalBike, } from '../util/legUtils'; import { BreakpointConsumer } from '../util/withBreakpoint'; @@ -219,6 +220,9 @@ class ItineraryTab extends React.Component { const itineraryContainsCallLegs = itinerary.legs.some(leg => isCallAgencyPickupType(leg), ); + const isTrainLimitation = itinerary.legs.some(leg => + isTrainLimitationPickupType(leg), + ); const infoBoxText = () => { if (config.callAgencyInfo && itineraryContainsCallLegs) { @@ -247,7 +251,7 @@ class ItineraryTab extends React.Component { ); } - if (config.showTrainLimitationInfo) { + if (config.showTrainLimitationInfo && isTrainLimitation) { return (
stoptime.pickupType === 'SCHEDULED') + .length > 0 + ); +} + export function isCallAgencyDeparture(departure) { return departure.pickupType === 'CALL_AGENCY'; } From 3cb02dfdb377468a43a1f4f5d46ef5ec6a78b402 Mon Sep 17 00:00:00 2001 From: Dvun Date: Tue, 7 Nov 2023 15:38:27 +0200 Subject: [PATCH 11/49] fix: added mode check --- app/component/TransitLeg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/component/TransitLeg.js b/app/component/TransitLeg.js index 6b84467778..0a6c270dcf 100644 --- a/app/component/TransitLeg.js +++ b/app/component/TransitLeg.js @@ -548,7 +548,7 @@ class TransitLeg extends React.Component { {leg.fare && leg.fare.isUnknown && shouldShowFareInfo(config) && - (config.showTrainLimitationInfo ? ( + (mode === 'RAIL' && config.showTrainLimitationInfo ? (
Date: Wed, 8 Nov 2023 10:17:19 +0200 Subject: [PATCH 12/49] fix: fixed function to check is Rail mode or not --- app/util/legUtils.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/util/legUtils.js b/app/util/legUtils.js index 20b1db5172..23545fb900 100644 --- a/app/util/legUtils.js +++ b/app/util/legUtils.js @@ -34,13 +34,6 @@ export function isCallAgencyPickupType(leg) { ); } -export function isTrainLimitationPickupType(leg) { - return ( - filterLegStops(leg, stoptime => stoptime.pickupType === 'SCHEDULED') - .length > 0 - ); -} - export function isCallAgencyDeparture(departure) { return departure.pickupType === 'CALL_AGENCY'; } @@ -77,6 +70,7 @@ export const LegMode = { CityBike: 'CITYBIKE', Walk: 'WALK', Car: 'CAR', + Rail: 'RAIL', }; /** @@ -101,11 +95,17 @@ export const getLegMode = legOrMode => { return LegMode.Walk; case LegMode.Car: return LegMode.Car; + case LegMode.Rail: + return LegMode.Rail; default: return undefined; } }; +export function isTrainLimitationPickupType(leg) { + return getLegMode(leg) === LegMode.Rail; +} + /** * Checks if both of the legs exist and are taken with mode 'BICYCLE'. * From 08845a061aec978d4e88268f2366c12b44dfe881 Mon Sep 17 00:00:00 2001 From: Dvun Date: Wed, 8 Nov 2023 11:12:43 +0200 Subject: [PATCH 13/49] fix: fixed mystic string to constants --- app/component/TransitLeg.js | 3 ++- app/translations.js | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/component/TransitLeg.js b/app/component/TransitLeg.js index eedcf2708f..0ec3eadf9a 100644 --- a/app/component/TransitLeg.js +++ b/app/component/TransitLeg.js @@ -32,6 +32,7 @@ import { getHeadsignFromRouteLongName, getStopHeadsignFromStoptimes, getZoneLabel, + LegMode, } from '../util/legUtils'; import { shouldShowFareInfo } from '../util/fareUtils'; import { AlertEntityType, AlertSeverityLevelType } from '../constants'; @@ -550,7 +551,7 @@ class TransitLeg extends React.Component { {leg.fare && leg.fare.isUnknown && shouldShowFareInfo(config) && - (mode === 'RAIL' && config.showTrainLimitationInfo ? ( + (mode === LegMode.Rail && config.showTrainLimitationInfo ? (
Date: Thu, 9 Nov 2023 08:49:03 +0200 Subject: [PATCH 14/49] fix: fixed check --- app/util/legUtils.js | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/app/util/legUtils.js b/app/util/legUtils.js index 23545fb900..1d31d2fbad 100644 --- a/app/util/legUtils.js +++ b/app/util/legUtils.js @@ -17,23 +17,6 @@ function filterLegStops(leg, filter) { return false; } -/** - * Check if legs start stop pickuptype or end stop pickupType is CALL_AGENCY - * - * leg must have: - * from.stop.gtfsId - * to.stop.gtfsId - * trip.stoptimes (with props:) - * stop.gtfsId - * pickupType - */ -export function isCallAgencyPickupType(leg) { - return ( - filterLegStops(leg, stoptime => stoptime.pickupType === 'CALL_AGENCY') - .length > 0 - ); -} - export function isCallAgencyDeparture(departure) { return departure.pickupType === 'CALL_AGENCY'; } @@ -102,6 +85,26 @@ export const getLegMode = legOrMode => { } }; +/** + * Check if legs start stop pickuptype or end stop pickupType is CALL_AGENCY + * + * leg must have: + * from.stop.gtfsId + * to.stop.gtfsId + * trip.stoptimes (with props:) + * stop.gtfsId + * pickupType + */ +export function isCallAgencyPickupType(leg) { + if (getLegMode(leg) === LegMode.Rail) { + return false; + } + return ( + filterLegStops(leg, stoptime => stoptime.pickupType === 'CALL_AGENCY') + .length > 0 + ); +} + export function isTrainLimitationPickupType(leg) { return getLegMode(leg) === LegMode.Rail; } From ca55d23fdd25b4432d8f7940e6eff5ec947aa138 Mon Sep 17 00:00:00 2001 From: Dvun Date: Thu, 9 Nov 2023 13:15:36 +0200 Subject: [PATCH 15/49] fix: removed not needed if --- app/util/legUtils.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/util/legUtils.js b/app/util/legUtils.js index 1d31d2fbad..42ac529f07 100644 --- a/app/util/legUtils.js +++ b/app/util/legUtils.js @@ -96,9 +96,6 @@ export const getLegMode = legOrMode => { * pickupType */ export function isCallAgencyPickupType(leg) { - if (getLegMode(leg) === LegMode.Rail) { - return false; - } return ( filterLegStops(leg, stoptime => stoptime.pickupType === 'CALL_AGENCY') .length > 0 From 81dfc4ba5eabcb54407f81b9e0fbc0fe23cd502c Mon Sep 17 00:00:00 2001 From: Dvun Date: Thu, 9 Nov 2023 13:16:50 +0200 Subject: [PATCH 16/49] fix: totally reworked infoBoxText and created with nested constants --- app/component/ItineraryTab.js | 116 +++++++++++++++------------------- 1 file changed, 50 insertions(+), 66 deletions(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index 51e4ad8802..c2c9fcf33e 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -225,71 +225,24 @@ class ItineraryTab extends React.Component { isTrainLimitationPickupType(leg), ); - const infoBoxText = () => { - if (config.callAgencyInfo && itineraryContainsCallLegs) { - return ( -
- - - - + const infoBoxText = (textId, values, href, configData, isNeedLink) => { + return ( +
+
+
- ); - } - - if (config.showTrainLimitationInfo && isTrainLimitation) { - return (
- - - -
- ); - } - return ( -
- + {isNeedLink && ( + + + + )} +
); }; @@ -387,12 +340,43 @@ class ItineraryTab extends React.Component { > {shouldShowFareInfo(config) && fares.some(fare => fare.isUnknown) && ( -
-
- -
- {infoBoxText()} -
+ <> + {config.showTrainLimitationInfo && + isTrainLimitation && + infoBoxText( + 'train-ticket-limited', + 'appBarLink.name', + config.showTrainLimitationInfo[currentLanguage] + .showTrainLimitationInfoLink, + config.showTrainLimitationInfo[currentLanguage] + .showTrainLimitationInfoLinkText, + true, + )} + + {config.callAgencyInfo && + itineraryContainsCallLegs && + infoBoxText( + 'separate-ticket-required-for-call-agency-disclaimer', + `callAgencyInfo.${currentLanguage}.callAgencyInfoLink`, + config.callAgencyInfo[currentLanguage] + .callAgencyInfoLink, + config.callAgencyInfo[currentLanguage] + .callAgencyInfoLinkText, + true, + )} + + {!config.callAgencyInfo && + !isTrainLimitation && + !config.callAgencyInfo && + !itineraryContainsCallLegs && + infoBoxText( + 'separate-ticket-required-disclaimer', + 'ticketInformation.primaryAgencyName', + '', + '', + false, + )} + )} Date: Thu, 9 Nov 2023 16:12:04 +0200 Subject: [PATCH 17/49] fix: if statement fix and removed 2 constants for default infoText --- app/component/ItineraryTab.js | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index c2c9fcf33e..ea40fd17f6 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -225,7 +225,7 @@ class ItineraryTab extends React.Component { isTrainLimitationPickupType(leg), ); - const infoBoxText = (textId, values, href, configData, isNeedLink) => { + const infoBoxText = (textId, values, href = null, configData = null) => { return (
@@ -237,7 +237,7 @@ class ItineraryTab extends React.Component { values={{ agencyName: get(config, values) }} /> - {isNeedLink && ( + {href && ( @@ -350,7 +350,6 @@ class ItineraryTab extends React.Component { .showTrainLimitationInfoLink, config.showTrainLimitationInfo[currentLanguage] .showTrainLimitationInfoLinkText, - true, )} {config.callAgencyInfo && @@ -362,20 +361,15 @@ class ItineraryTab extends React.Component { .callAgencyInfoLink, config.callAgencyInfo[currentLanguage] .callAgencyInfoLinkText, - true, )} - {!config.callAgencyInfo && - !isTrainLimitation && - !config.callAgencyInfo && - !itineraryContainsCallLegs && - infoBoxText( - 'separate-ticket-required-disclaimer', - 'ticketInformation.primaryAgencyName', - '', - '', - false, - )} + {(!config.callAgencyInfo && !isTrainLimitation) || + (!config.callAgencyInfo && + !itineraryContainsCallLegs && + infoBoxText( + 'separate-ticket-required-disclaimer', + 'ticketInformation.primaryAgencyName', + ))} )} Date: Fri, 10 Nov 2023 10:22:01 +0200 Subject: [PATCH 18/49] fix: created new InfoBox component --- app/component/InfoBox.js | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 app/component/InfoBox.js diff --git a/app/component/InfoBox.js b/app/component/InfoBox.js new file mode 100644 index 0000000000..81d2ea219d --- /dev/null +++ b/app/component/InfoBox.js @@ -0,0 +1,43 @@ +import React from 'react'; +import { FormattedMessage } from 'react-intl'; +import get from 'lodash/get'; +import PropTypes from 'prop-types'; +import Icon from './Icon'; + +const InfoBox = ( + { textId, values, href = null, configData = null }, + { config }, +) => { + return ( +
+
+ +
+
+ + + {href && ( + + + + )} +
+
+ ); +}; + +InfoBox.propTypes = { + textId: PropTypes.string.isRequired, + values: PropTypes.string.isRequired, + href: PropTypes.string, + configData: PropTypes.string, +}; + +InfoBox.contextTypes = { + config: PropTypes.object.isRequired, +}; + +export default InfoBox; From 28d9113a3572ad90449b49597c32bc07a90b2eb0 Mon Sep 17 00:00:00 2001 From: Dvun Date: Fri, 10 Nov 2023 10:29:09 +0200 Subject: [PATCH 19/49] fix: infoboxtext moved to own component --- app/component/ItineraryTab.js | 92 +++++++++++++++-------------------- 1 file changed, 39 insertions(+), 53 deletions(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index ea40fd17f6..e91066b282 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -1,4 +1,3 @@ -import get from 'lodash/get'; import PropTypes from 'prop-types'; import React from 'react'; import { createFragmentContainer, graphql } from 'react-relay'; @@ -6,8 +5,6 @@ import cx from 'classnames'; import { matchShape, routerShape } from 'found'; import { FormattedMessage, intlShape } from 'react-intl'; import connectToStores from 'fluxible-addons-react/connectToStores'; - -import Icon from './Icon'; import TicketInformation from './TicketInformation'; import RouteInformation from './RouteInformation'; import ItinerarySummary from './ItinerarySummary'; @@ -45,6 +42,7 @@ import { import CityBikeDurationInfo from './CityBikeDurationInfo'; import { getCityBikeNetworkId } from '../util/citybikes'; import { FareShape } from '../util/shapes'; +import InfoBox from './InfoBox'; const AlertShape = PropTypes.shape({ alertSeverityLevel: PropTypes.string }); @@ -160,7 +158,7 @@ class ItineraryTab extends React.Component { walkingDistance > 0 && (bikingDistance > 0 || drivingDistance > 0) && futureText !== ''; - const extraProps = { + return { walking: { duration: walkingDuration, distance: walkingDistance, @@ -176,7 +174,6 @@ class ItineraryTab extends React.Component { futureText, isMultiRow, }; - return extraProps; }; render() { @@ -225,28 +222,6 @@ class ItineraryTab extends React.Component { isTrainLimitationPickupType(leg), ); - const infoBoxText = (textId, values, href = null, configData = null) => { - return ( -
-
- -
-
- - - {href && ( - - - - )} -
-
- ); - }; - return (

@@ -341,35 +316,46 @@ class ItineraryTab extends React.Component { {shouldShowFareInfo(config) && fares.some(fare => fare.isUnknown) && ( <> - {config.showTrainLimitationInfo && - isTrainLimitation && - infoBoxText( - 'train-ticket-limited', - 'appBarLink.name', - config.showTrainLimitationInfo[currentLanguage] - .showTrainLimitationInfoLink, - config.showTrainLimitationInfo[currentLanguage] - .showTrainLimitationInfoLinkText, - )} + {config.showTrainLimitationInfo && isTrainLimitation && ( + + )} + + {config.callAgencyInfo && itineraryContainsCallLegs && ( + + )} - {(!config.callAgencyInfo && !isTrainLimitation) || + {((!config.callAgencyInfo && !isTrainLimitation) || (!config.callAgencyInfo && - !itineraryContainsCallLegs && - infoBoxText( - 'separate-ticket-required-disclaimer', - 'ticketInformation.primaryAgencyName', - ))} + !itineraryContainsCallLegs)) && ( + + )} )} Date: Mon, 13 Nov 2023 12:42:41 +0200 Subject: [PATCH 20/49] fix: fixed if statement for info box --- app/component/ItineraryTab.js | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index e91066b282..a74f9b88cf 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -222,6 +222,11 @@ class ItineraryTab extends React.Component { isTrainLimitationPickupType(leg), ); + const isShowTrainLimitationInfo = + config.showTrainLimitationInfo && isTrainLimitation; + const isShowItineraryContainsCallLegsInfo = + config.callAgencyInfo && itineraryContainsCallLegs; + return (

@@ -316,10 +321,10 @@ class ItineraryTab extends React.Component { {shouldShowFareInfo(config) && fares.some(fare => fare.isUnknown) && ( <> - {config.showTrainLimitationInfo && isTrainLimitation && ( + {isShowTrainLimitationInfo && ( )} - {config.callAgencyInfo && itineraryContainsCallLegs && ( + {isShowItineraryContainsCallLegsInfo && ( )} - {((!config.callAgencyInfo && !isTrainLimitation) || - (!config.callAgencyInfo && - !itineraryContainsCallLegs)) && ( - - )} + {!isShowItineraryContainsCallLegsInfo && !isShowTrainLimitationInfo && ( + + )} )} Date: Wed, 15 Nov 2023 14:22:21 +0200 Subject: [PATCH 21/49] fix: renamed from InfoBox to FareDisclaimer + added defaultProps --- app/component/{InfoBox.js => FareDisclaimer.js} | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) rename app/component/{InfoBox.js => FareDisclaimer.js} (83%) diff --git a/app/component/InfoBox.js b/app/component/FareDisclaimer.js similarity index 83% rename from app/component/InfoBox.js rename to app/component/FareDisclaimer.js index 81d2ea219d..b83a790d85 100644 --- a/app/component/InfoBox.js +++ b/app/component/FareDisclaimer.js @@ -4,7 +4,7 @@ import get from 'lodash/get'; import PropTypes from 'prop-types'; import Icon from './Icon'; -const InfoBox = ( +const FareDisclaimer = ( { textId, values, href = null, configData = null }, { config }, ) => { @@ -29,15 +29,20 @@ const InfoBox = ( ); }; -InfoBox.propTypes = { +FareDisclaimer.propTypes = { textId: PropTypes.string.isRequired, values: PropTypes.string.isRequired, href: PropTypes.string, configData: PropTypes.string, }; -InfoBox.contextTypes = { +FareDisclaimer.defaultProps = { + href: null, + configData: null, +}; + +FareDisclaimer.contextTypes = { config: PropTypes.object.isRequired, }; -export default InfoBox; +export default FareDisclaimer; From 14043e36097f801d10de96e37cad819d4651901e Mon Sep 17 00:00:00 2001 From: Dvun Date: Wed, 15 Nov 2023 20:47:52 +0200 Subject: [PATCH 22/49] fix: config method renamed --- app/configurations/config.tampere.js | 34 +++++++++++++++------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/app/configurations/config.tampere.js b/app/configurations/config.tampere.js index 1a9c162e8b..d3a4d49b7b 100644 --- a/app/configurations/config.tampere.js +++ b/app/configurations/config.tampere.js @@ -95,22 +95,24 @@ export default configMerger(walttiConfig, { }, }, - showTrainLimitationInfo: { - fi: { - showTrainLimitationInfoLink: 'https://www.nysse.fi/junat', - showTrainLimitationInfoLinkText: 'nysse.fi/junat', - }, - sv: { - showTrainLimitationInfoLink: - 'https://www.nysse.fi/en/ways-to-get-around/train', - showTrainLimitationInfoLinkText: - 'Trains in the Nysse area - Nysse, Tampere regional transport', - }, - en: { - showTrainLimitationInfoLink: - 'https://www.nysse.fi/en/ways-to-get-around/train', - showTrainLimitationInfoLinkText: - 'Trains in the Nysse area - Nysse, Tampere regional transport', + modeDisclaimers: { + rail: { + fi: { + showTrainLimitationInfoLink: 'https://www.nysse.fi/junat', + showTrainLimitationInfoLinkText: 'nysse.fi/junat', + }, + sv: { + showTrainLimitationInfoLink: + 'https://www.nysse.fi/en/ways-to-get-around/train', + showTrainLimitationInfoLinkText: + 'Trains in the Nysse area - Nysse, Tampere regional transport', + }, + en: { + showTrainLimitationInfoLink: + 'https://www.nysse.fi/en/ways-to-get-around/train', + showTrainLimitationInfoLinkText: + 'Trains in the Nysse area - Nysse, Tampere regional transport', + }, }, }, From 291099dae60cc7d4b12dfdbd4a5f8755d197258a Mon Sep 17 00:00:00 2001 From: Dvun Date: Wed, 15 Nov 2023 20:58:48 +0200 Subject: [PATCH 23/49] fix: renamed config method --- app/component/TransitLeg.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/component/TransitLeg.js b/app/component/TransitLeg.js index 0ec3eadf9a..75a48e3202 100644 --- a/app/component/TransitLeg.js +++ b/app/component/TransitLeg.js @@ -551,7 +551,7 @@ class TransitLeg extends React.Component { {leg.fare && leg.fare.isUnknown && shouldShowFareInfo(config) && - (mode === LegMode.Rail && config.showTrainLimitationInfo ? ( + (mode === LegMode.Rail && config.modeDisclaimers.rail ? (
From 798ee74af9d941ae16da44ae0ca1b6d6eb948ad7 Mon Sep 17 00:00:00 2001 From: Dvun Date: Wed, 15 Nov 2023 21:15:26 +0200 Subject: [PATCH 24/49] fix: renamed function name --- app/util/legUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/util/legUtils.js b/app/util/legUtils.js index 42ac529f07..08104dc8a7 100644 --- a/app/util/legUtils.js +++ b/app/util/legUtils.js @@ -102,7 +102,7 @@ export function isCallAgencyPickupType(leg) { ); } -export function isTrainLimitationPickupType(leg) { +export function hasLegMode(leg) { return getLegMode(leg) === LegMode.Rail; } From 98260b8e65ef764f3f4bfca168ec573665fc467d Mon Sep 17 00:00:00 2001 From: Dvun Date: Wed, 15 Nov 2023 21:18:37 +0200 Subject: [PATCH 25/49] fix: renamed function names and methods --- app/component/ItineraryTab.js | 37 ++++++++++++++++------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index a74f9b88cf..835a9f6def 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -22,7 +22,7 @@ import { getTotalWalkingDuration, getZones, isCallAgencyPickupType, - isTrainLimitationPickupType, + hasLegMode, legContainsRentalBike, } from '../util/legUtils'; import { BreakpointConsumer } from '../util/withBreakpoint'; @@ -42,7 +42,7 @@ import { import CityBikeDurationInfo from './CityBikeDurationInfo'; import { getCityBikeNetworkId } from '../util/citybikes'; import { FareShape } from '../util/shapes'; -import InfoBox from './InfoBox'; +import FareDisclaimer from './FareDisclaimer'; const AlertShape = PropTypes.shape({ alertSeverityLevel: PropTypes.string }); @@ -218,13 +218,10 @@ class ItineraryTab extends React.Component { const itineraryContainsCallLegs = itinerary.legs.some(leg => isCallAgencyPickupType(leg), ); - const isTrainLimitation = itinerary.legs.some(leg => - isTrainLimitationPickupType(leg), - ); + const hasTrainLegs = itinerary.legs.some(leg => hasLegMode(leg)); - const isShowTrainLimitationInfo = - config.showTrainLimitationInfo && isTrainLimitation; - const isShowItineraryContainsCallLegsInfo = + const showLegModeDisclaimer = config.modeDisclaimers.rail && hasTrainLegs; + const showCallAgencyDisclaimer = config.callAgencyInfo && itineraryContainsCallLegs; return ( @@ -321,23 +318,23 @@ class ItineraryTab extends React.Component { {shouldShowFareInfo(config) && fares.some(fare => fare.isUnknown) && ( <> - {isShowTrainLimitationInfo && ( - )} - {isShowItineraryContainsCallLegsInfo && ( - )} - {!isShowItineraryContainsCallLegsInfo && !isShowTrainLimitationInfo && ( - - )} + {!showCallAgencyDisclaimer && !showLegModeDisclaimer && ( + + )} )} Date: Wed, 15 Nov 2023 21:27:45 +0200 Subject: [PATCH 26/49] fix: fix --- app/component/ItineraryTab.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index 835a9f6def..100a43232c 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -220,7 +220,8 @@ class ItineraryTab extends React.Component { ); const hasTrainLegs = itinerary.legs.some(leg => hasLegMode(leg)); - const showLegModeDisclaimer = config.modeDisclaimers.rail && hasTrainLegs; + const showLegModeDisclaimer = + config.modeDisclaimers && config.modeDisclaimers.rail && hasTrainLegs; const showCallAgencyDisclaimer = config.callAgencyInfo && itineraryContainsCallLegs; From 8934ca8384a42589013b559784d845ca84c7a096 Mon Sep 17 00:00:00 2001 From: Dvun Date: Thu, 16 Nov 2023 15:32:22 +0200 Subject: [PATCH 27/49] fix: config update --- app/configurations/config.tampere.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/app/configurations/config.tampere.js b/app/configurations/config.tampere.js index d3a4d49b7b..00e5dffa5c 100644 --- a/app/configurations/config.tampere.js +++ b/app/configurations/config.tampere.js @@ -96,22 +96,18 @@ export default configMerger(walttiConfig, { }, modeDisclaimers: { - rail: { + RAIL: { fi: { - showTrainLimitationInfoLink: 'https://www.nysse.fi/junat', - showTrainLimitationInfoLinkText: 'nysse.fi/junat', + link: 'https://www.nysse.fi/junat', + text: 'nysse.fi/junat', }, sv: { - showTrainLimitationInfoLink: - 'https://www.nysse.fi/en/ways-to-get-around/train', - showTrainLimitationInfoLinkText: - 'Trains in the Nysse area - Nysse, Tampere regional transport', + link: 'https://www.nysse.fi/en/ways-to-get-around/train', + text: 'Trains in the Nysse area - Nysse, Tampere regional transport', }, en: { - showTrainLimitationInfoLink: - 'https://www.nysse.fi/en/ways-to-get-around/train', - showTrainLimitationInfoLinkText: - 'Trains in the Nysse area - Nysse, Tampere regional transport', + link: 'https://www.nysse.fi/en/ways-to-get-around/train', + text: 'Trains in the Nysse area - Nysse, Tampere regional transport', }, }, }, From 0954c57ad5c97112fc85fddf6a47dcc39643a822 Mon Sep 17 00:00:00 2001 From: Dvun Date: Thu, 16 Nov 2023 15:33:04 +0200 Subject: [PATCH 28/49] fix: renamed configData to linkText --- app/component/FareDisclaimer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/component/FareDisclaimer.js b/app/component/FareDisclaimer.js index b83a790d85..fb1f3dad30 100644 --- a/app/component/FareDisclaimer.js +++ b/app/component/FareDisclaimer.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; import Icon from './Icon'; const FareDisclaimer = ( - { textId, values, href = null, configData = null }, + { textId, values, href = null, linkText = null }, { config }, ) => { return ( @@ -21,7 +21,7 @@ const FareDisclaimer = ( {href && ( - + )}
@@ -33,12 +33,12 @@ FareDisclaimer.propTypes = { textId: PropTypes.string.isRequired, values: PropTypes.string.isRequired, href: PropTypes.string, - configData: PropTypes.string, + linkText: PropTypes.string, }; FareDisclaimer.defaultProps = { href: null, - configData: null, + linkText: null, }; FareDisclaimer.contextTypes = { From 44d211bfd6013cd29159da9b73087020973b9e3b Mon Sep 17 00:00:00 2001 From: Dvun Date: Thu, 16 Nov 2023 15:35:29 +0200 Subject: [PATCH 29/49] fix: reworked, updated function to show info text --- app/component/ItineraryTab.js | 89 ++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 44 deletions(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index 100a43232c..f69339e1a6 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -22,7 +22,6 @@ import { getTotalWalkingDuration, getZones, isCallAgencyPickupType, - hasLegMode, legContainsRentalBike, } from '../util/legUtils'; import { BreakpointConsumer } from '../util/withBreakpoint'; @@ -218,13 +217,45 @@ class ItineraryTab extends React.Component { const itineraryContainsCallLegs = itinerary.legs.some(leg => isCallAgencyPickupType(leg), ); - const hasTrainLegs = itinerary.legs.some(leg => hasLegMode(leg)); - const showLegModeDisclaimer = - config.modeDisclaimers && config.modeDisclaimers.rail && hasTrainLegs; const showCallAgencyDisclaimer = config.callAgencyInfo && itineraryContainsCallLegs; + const disclaimers = []; + + itinerary.legs.forEach(leg => { + if (config.modeDisclaimers && config.modeDisclaimers[leg.mode]) { + disclaimers.push({ + id: 1, + textId: 'train-ticket-limited', + values: 'appBarLink.name', + href: config.modeDisclaimers[leg.mode][currentLanguage].link, + linkText: config.modeDisclaimers[leg.mode][currentLanguage].link, + }); + } + + if (showCallAgencyDisclaimer) { + disclaimers.push({ + id: 2, + textId: 'separate-ticket-required-for-call-agency-disclaimer', + values: `callAgencyInfo.${currentLanguage}.callAgencyInfoLink`, + href: config.callAgencyInfo[currentLanguage].callAgencyInfoLink, + linkText: + config.callAgencyInfo[currentLanguage].callAgencyInfoLinkText, + }); + } + + if (!config.modeDisclaimers[leg.mode] && !showCallAgencyDisclaimer) { + disclaimers.push({ + id: 3, + textId: 'separate-ticket-required-disclaimer', + values: 'ticketInformation.primaryAgencyName', + href: null, + linkText: null, + }); + } + }); + return (

@@ -317,46 +348,16 @@ class ItineraryTab extends React.Component { })} > {shouldShowFareInfo(config) && - fares.some(fare => fare.isUnknown) && ( - <> - {showLegModeDisclaimer && ( - - )} - - {showCallAgencyDisclaimer && ( - - )} - - {!showCallAgencyDisclaimer && !showLegModeDisclaimer && ( - - )} - - )} + fares.some(fare => fare.isUnknown) && + disclaimers.map(disclaimer => ( + + ))} Date: Thu, 16 Nov 2023 15:36:14 +0200 Subject: [PATCH 30/49] fix: removed unnecessary function --- app/util/legUtils.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/util/legUtils.js b/app/util/legUtils.js index 08104dc8a7..b89b14edd5 100644 --- a/app/util/legUtils.js +++ b/app/util/legUtils.js @@ -102,10 +102,6 @@ export function isCallAgencyPickupType(leg) { ); } -export function hasLegMode(leg) { - return getLegMode(leg) === LegMode.Rail; -} - /** * Checks if both of the legs exist and are taken with mode 'BICYCLE'. * From dafbba789e2ea641529a772f6b7641971d6a496a Mon Sep 17 00:00:00 2001 From: Dvun Date: Thu, 16 Nov 2023 15:36:48 +0200 Subject: [PATCH 31/49] fix: updated to more generic --- app/component/TransitLeg.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/app/component/TransitLeg.js b/app/component/TransitLeg.js index 75a48e3202..9dfdae4df5 100644 --- a/app/component/TransitLeg.js +++ b/app/component/TransitLeg.js @@ -551,7 +551,7 @@ class TransitLeg extends React.Component { {leg.fare && leg.fare.isUnknown && shouldShowFareInfo(config) && - (mode === LegMode.Rail && config.modeDisclaimers.rail ? ( + (mode === LegMode.Rail && config.modeDisclaimers[mode] ? (
From f3274b139c87ff39aa3e094e2dc73736c72f05cc Mon Sep 17 00:00:00 2001 From: Dvun Date: Thu, 16 Nov 2023 15:39:36 +0200 Subject: [PATCH 32/49] fix: fix --- app/component/ItineraryTab.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index f69339e1a6..ca7b4d7e52 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -245,7 +245,10 @@ class ItineraryTab extends React.Component { }); } - if (!config.modeDisclaimers[leg.mode] && !showCallAgencyDisclaimer) { + if ( + !(config.modeDisclaimers && config.modeDisclaimers[leg.mode]) && + !showCallAgencyDisclaimer + ) { disclaimers.push({ id: 3, textId: 'separate-ticket-required-disclaimer', From 1c1b6e132472f20e5e62fae775a47eea311b76a4 Mon Sep 17 00:00:00 2001 From: Dvun Date: Thu, 16 Nov 2023 16:24:59 +0200 Subject: [PATCH 33/49] fix: fixed same text pushed many times --- app/component/ItineraryTab.js | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index ca7b4d7e52..e3da8792bb 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -225,37 +225,50 @@ class ItineraryTab extends React.Component { itinerary.legs.forEach(leg => { if (config.modeDisclaimers && config.modeDisclaimers[leg.mode]) { - disclaimers.push({ + const disclaimerItem = { id: 1, textId: 'train-ticket-limited', values: 'appBarLink.name', href: config.modeDisclaimers[leg.mode][currentLanguage].link, linkText: config.modeDisclaimers[leg.mode][currentLanguage].link, - }); + }; + + if (!disclaimers.some(item => item.id === disclaimerItem.id)) { + disclaimers.push(disclaimerItem); + } } if (showCallAgencyDisclaimer) { - disclaimers.push({ + const disclaimerItem = { id: 2, textId: 'separate-ticket-required-for-call-agency-disclaimer', values: `callAgencyInfo.${currentLanguage}.callAgencyInfoLink`, href: config.callAgencyInfo[currentLanguage].callAgencyInfoLink, linkText: config.callAgencyInfo[currentLanguage].callAgencyInfoLinkText, - }); + }; + + if (!disclaimers.some(item => item.id === disclaimerItem.id)) { + disclaimers.push(disclaimerItem); + } } if ( - !(config.modeDisclaimers && config.modeDisclaimers[leg.mode]) && + !config.modeDisclaimers && + !config.modeDisclaimers[leg.mode] && !showCallAgencyDisclaimer ) { - disclaimers.push({ + const disclaimerItem = { id: 3, textId: 'separate-ticket-required-disclaimer', values: 'ticketInformation.primaryAgencyName', href: null, linkText: null, - }); + }; + + if (!disclaimers.some(item => item.id === disclaimerItem.id)) { + disclaimers.push(disclaimerItem); + } } }); From f575303e2794d09ac13001cfbb590fab7aba65ca Mon Sep 17 00:00:00 2001 From: Dvun Date: Thu, 16 Nov 2023 16:33:29 +0200 Subject: [PATCH 34/49] fix: fix code --- app/component/ItineraryTab.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index e3da8792bb..4ecaf8e94d 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -221,6 +221,10 @@ class ItineraryTab extends React.Component { const showCallAgencyDisclaimer = config.callAgencyInfo && itineraryContainsCallLegs; + const showLegModeDisclaimer = itinerary.legs.some(leg => { + return !!(config.modeDisclaimers && config.modeDisclaimers[leg.mode]); + }); + const disclaimers = []; itinerary.legs.forEach(leg => { @@ -253,11 +257,7 @@ class ItineraryTab extends React.Component { } } - if ( - !config.modeDisclaimers && - !config.modeDisclaimers[leg.mode] && - !showCallAgencyDisclaimer - ) { + if (!showLegModeDisclaimer && !showCallAgencyDisclaimer) { const disclaimerItem = { id: 3, textId: 'separate-ticket-required-disclaimer', From 8ee65b8d43c6dc8a11c12262b68a8b9241ec860c Mon Sep 17 00:00:00 2001 From: Dvun Date: Fri, 17 Nov 2023 09:50:47 +0200 Subject: [PATCH 35/49] fix: code fix --- app/component/ItineraryTab.js | 37 ++++++++++++++++------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index 4ecaf8e94d..d69e066507 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -226,49 +226,45 @@ class ItineraryTab extends React.Component { }); const disclaimers = []; + const uniqueMessages = new Set(); + + function pushUniqueMessage(message) { + if (!uniqueMessages.has(JSON.stringify(message))) { + disclaimers.push(message); + uniqueMessages.add(JSON.stringify(message)); + } + } itinerary.legs.forEach(leg => { if (config.modeDisclaimers && config.modeDisclaimers[leg.mode]) { - const disclaimerItem = { - id: 1, + const message = { textId: 'train-ticket-limited', values: 'appBarLink.name', href: config.modeDisclaimers[leg.mode][currentLanguage].link, linkText: config.modeDisclaimers[leg.mode][currentLanguage].link, }; - - if (!disclaimers.some(item => item.id === disclaimerItem.id)) { - disclaimers.push(disclaimerItem); - } + pushUniqueMessage(message); } if (showCallAgencyDisclaimer) { - const disclaimerItem = { - id: 2, + const message = { textId: 'separate-ticket-required-for-call-agency-disclaimer', values: `callAgencyInfo.${currentLanguage}.callAgencyInfoLink`, href: config.callAgencyInfo[currentLanguage].callAgencyInfoLink, linkText: config.callAgencyInfo[currentLanguage].callAgencyInfoLinkText, }; - - if (!disclaimers.some(item => item.id === disclaimerItem.id)) { - disclaimers.push(disclaimerItem); - } + pushUniqueMessage(message); } if (!showLegModeDisclaimer && !showCallAgencyDisclaimer) { - const disclaimerItem = { - id: 3, + const message = { textId: 'separate-ticket-required-disclaimer', values: 'ticketInformation.primaryAgencyName', href: null, linkText: null, }; - - if (!disclaimers.some(item => item.id === disclaimerItem.id)) { - disclaimers.push(disclaimerItem); - } + pushUniqueMessage(message); } }); @@ -365,9 +361,10 @@ class ItineraryTab extends React.Component { > {shouldShowFareInfo(config) && fares.some(fare => fare.isUnknown) && - disclaimers.map(disclaimer => ( + disclaimers.map((disclaimer, index) => ( Date: Fri, 17 Nov 2023 10:36:37 +0200 Subject: [PATCH 36/49] fix: code fix --- app/component/ItineraryTab.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index d69e066507..4737b2d536 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -229,42 +229,44 @@ class ItineraryTab extends React.Component { const uniqueMessages = new Set(); function pushUniqueMessage(message) { - if (!uniqueMessages.has(JSON.stringify(message))) { - disclaimers.push(message); - uniqueMessages.add(JSON.stringify(message)); + const updatedMessage = { ...message }; + updatedMessage.id = (updatedMessage.id || 0) + 1; + if (!uniqueMessages.has(JSON.stringify(updatedMessage))) { + disclaimers.push(updatedMessage); + uniqueMessages.add(JSON.stringify(updatedMessage)); } } itinerary.legs.forEach(leg => { if (config.modeDisclaimers && config.modeDisclaimers[leg.mode]) { - const message = { + const modeDisclaimer = { textId: 'train-ticket-limited', values: 'appBarLink.name', href: config.modeDisclaimers[leg.mode][currentLanguage].link, linkText: config.modeDisclaimers[leg.mode][currentLanguage].link, }; - pushUniqueMessage(message); + pushUniqueMessage(modeDisclaimer); } if (showCallAgencyDisclaimer) { - const message = { + const callAgencyMessage = { textId: 'separate-ticket-required-for-call-agency-disclaimer', values: `callAgencyInfo.${currentLanguage}.callAgencyInfoLink`, href: config.callAgencyInfo[currentLanguage].callAgencyInfoLink, linkText: config.callAgencyInfo[currentLanguage].callAgencyInfoLinkText, }; - pushUniqueMessage(message); + pushUniqueMessage(callAgencyMessage); } if (!showLegModeDisclaimer && !showCallAgencyDisclaimer) { - const message = { + const defaultMessage = { textId: 'separate-ticket-required-disclaimer', values: 'ticketInformation.primaryAgencyName', href: null, linkText: null, }; - pushUniqueMessage(message); + pushUniqueMessage(defaultMessage); } }); @@ -361,10 +363,9 @@ class ItineraryTab extends React.Component { > {shouldShowFareInfo(config) && fares.some(fare => fare.isUnknown) && - disclaimers.map((disclaimer, index) => ( + disclaimers.map(disclaimer => ( Date: Fri, 17 Nov 2023 11:15:20 +0200 Subject: [PATCH 37/49] fix: removed config --- app/component/FareDisclaimer.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/app/component/FareDisclaimer.js b/app/component/FareDisclaimer.js index fb1f3dad30..97c1808698 100644 --- a/app/component/FareDisclaimer.js +++ b/app/component/FareDisclaimer.js @@ -1,23 +1,16 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; -import get from 'lodash/get'; import PropTypes from 'prop-types'; import Icon from './Icon'; -const FareDisclaimer = ( - { textId, values, href = null, linkText = null }, - { config }, -) => { +const FareDisclaimer = ({ textId, values, href = null, linkText = null }) => { return (
- + {href && ( @@ -31,7 +24,7 @@ const FareDisclaimer = ( FareDisclaimer.propTypes = { textId: PropTypes.string.isRequired, - values: PropTypes.string.isRequired, + values: PropTypes.object.isRequired, href: PropTypes.string, linkText: PropTypes.string, }; @@ -41,8 +34,4 @@ FareDisclaimer.defaultProps = { linkText: null, }; -FareDisclaimer.contextTypes = { - config: PropTypes.object.isRequired, -}; - export default FareDisclaimer; From d8faf241098c4938022a37180a8759b54b4104ff Mon Sep 17 00:00:00 2001 From: Dvun Date: Fri, 17 Nov 2023 11:16:16 +0200 Subject: [PATCH 38/49] fix: updated code and config with agencyName coming inside values --- app/component/ItineraryTab.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index 4737b2d536..40a39f3f3f 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -5,6 +5,7 @@ import cx from 'classnames'; import { matchShape, routerShape } from 'found'; import { FormattedMessage, intlShape } from 'react-intl'; import connectToStores from 'fluxible-addons-react/connectToStores'; +import get from 'lodash/get'; import TicketInformation from './TicketInformation'; import RouteInformation from './RouteInformation'; import ItinerarySummary from './ItinerarySummary'; @@ -367,7 +368,7 @@ class ItineraryTab extends React.Component { From a5bec272d0a99d02423e3d6c8d641d543241e0d8 Mon Sep 17 00:00:00 2001 From: Dvun Date: Fri, 17 Nov 2023 13:39:19 +0200 Subject: [PATCH 39/49] fix: removed 'train-ticket-limited' texts --- app/translations.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/translations.js b/app/translations.js index a30974071a..d61a23ecbb 100644 --- a/app/translations.js +++ b/app/translations.js @@ -1601,8 +1601,6 @@ const translations = { 'track-short': 'Track {platformCode}', 'track-short-no-num': 'Track', traficom: 'Traficom', - 'train-ticket-limited': - '{agencyName} tickets are valid on trains in the {agencyName} area with some limitations. Read more on ', tram: 'Tram', 'tram-with-route-number': 'Tram {routeNumber} {headSign}', transfer: 'Transfer', @@ -2765,8 +2763,6 @@ const translations = { 'track-short': 'Raide {platformCode}', 'track-short-no-num': 'Raide', traficom: 'Traficom', - 'train-ticket-limited': - '{agencyName} liput käyvät junaliikenteessä rajoitetusti vain {agencyName}-alueella. Lue lisää ', tram: 'Raitiovaunu', 'tram-with-route-number': 'Raitiovaunu {routeNumber} {headSign}', transfer: 'Vaihto', @@ -4710,8 +4706,6 @@ const translations = { 'track-short': 'Spår {platformCode}', 'track-short-no-num': 'Spår', traficom: 'Traficom', - 'train-ticket-limited': - '{agencyName}-biljetter är giltiga på tåg i {agencyName}-området, med vissa begränsningar. Läs mer på ', tram: 'Spårvagn', 'tram-with-route-number': 'Spårvagn {routeNumber} {headSign}', transfer: 'Byte', From d94c436528aa7f1fbc1feb23baf385ae19eae26a Mon Sep 17 00:00:00 2001 From: Dvun Date: Fri, 17 Nov 2023 13:40:59 +0200 Subject: [PATCH 40/49] fix: update to more generic properties --- app/component/TransitLeg.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/component/TransitLeg.js b/app/component/TransitLeg.js index 9dfdae4df5..d0596f2da5 100644 --- a/app/component/TransitLeg.js +++ b/app/component/TransitLeg.js @@ -6,7 +6,6 @@ import { FormattedMessage, intlShape } from 'react-intl'; import Link from 'found/Link'; import connectToStores from 'fluxible-addons-react/connectToStores'; -import get from 'lodash/get'; import LegAgencyInfo from './LegAgencyInfo'; import Icon from './Icon'; import IntermediateLeg from './IntermediateLeg'; @@ -32,7 +31,6 @@ import { getHeadsignFromRouteLongName, getStopHeadsignFromStoptimes, getZoneLabel, - LegMode, } from '../util/legUtils'; import { shouldShowFareInfo } from '../util/fareUtils'; import { AlertEntityType, AlertSeverityLevelType } from '../constants'; @@ -548,17 +546,13 @@ class TransitLeg extends React.Component { /> )}
- {leg.fare && - leg.fare.isUnknown && + {leg.fare?.isUnknown && shouldShowFareInfo(config) && - (mode === LegMode.Rail && config.modeDisclaimers[mode] ? ( + (config.modeDisclaimers[mode] ? (
Date: Fri, 17 Nov 2023 13:41:35 +0200 Subject: [PATCH 41/49] fix: update to more generic properties --- app/component/ItineraryTab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index 40a39f3f3f..0dac9dbf7b 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -241,8 +241,8 @@ class ItineraryTab extends React.Component { itinerary.legs.forEach(leg => { if (config.modeDisclaimers && config.modeDisclaimers[leg.mode]) { const modeDisclaimer = { - textId: 'train-ticket-limited', - values: 'appBarLink.name', + textId: config.modeDisclaimers[leg.mode][currentLanguage].disclaimer, + values: null, href: config.modeDisclaimers[leg.mode][currentLanguage].link, linkText: config.modeDisclaimers[leg.mode][currentLanguage].link, }; From 125255c0e239b4edf5c70bb8032147f815ec47f2 Mon Sep 17 00:00:00 2001 From: Dvun Date: Fri, 17 Nov 2023 13:42:15 +0200 Subject: [PATCH 42/49] fix: update to more generic properties --- app/component/FareDisclaimer.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/component/FareDisclaimer.js b/app/component/FareDisclaimer.js index 97c1808698..7d579a50e2 100644 --- a/app/component/FareDisclaimer.js +++ b/app/component/FareDisclaimer.js @@ -24,12 +24,15 @@ const FareDisclaimer = ({ textId, values, href = null, linkText = null }) => { FareDisclaimer.propTypes = { textId: PropTypes.string.isRequired, - values: PropTypes.object.isRequired, + values: PropTypes.shape({ + agencyName: PropTypes.string, + }), href: PropTypes.string, linkText: PropTypes.string, }; FareDisclaimer.defaultProps = { + values: null, href: null, linkText: null, }; From bc3c5a5f60a5f824d1ab9e42b49d159c46288420 Mon Sep 17 00:00:00 2001 From: Dvun Date: Fri, 17 Nov 2023 13:42:51 +0200 Subject: [PATCH 43/49] fix: moved texts from translation.js --- app/configurations/config.tampere.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/configurations/config.tampere.js b/app/configurations/config.tampere.js index 00e5dffa5c..bc8f37edf3 100644 --- a/app/configurations/config.tampere.js +++ b/app/configurations/config.tampere.js @@ -98,14 +98,20 @@ export default configMerger(walttiConfig, { modeDisclaimers: { RAIL: { fi: { + disclaimer: + 'Nyssen liput käyvät junaliikenteessä rajoitetusti vain Nysse-alueella. Lue lisää ', link: 'https://www.nysse.fi/junat', text: 'nysse.fi/junat', }, sv: { + disclaimer: + 'Nysse-biljetter är giltiga på tåg i Nysse-området, med vissa begränsningar. Läs mer på ', link: 'https://www.nysse.fi/en/ways-to-get-around/train', text: 'Trains in the Nysse area - Nysse, Tampere regional transport', }, en: { + disclaimer: + 'Nysse tickets are valid on trains in the Nysse area with some limitations. Read more on ', link: 'https://www.nysse.fi/en/ways-to-get-around/train', text: 'Trains in the Nysse area - Nysse, Tampere regional transport', }, From 7b7715853a7d5ed98e0149ed2d89fa499bb3eedd Mon Sep 17 00:00:00 2001 From: Dvun Date: Fri, 17 Nov 2023 13:46:22 +0200 Subject: [PATCH 44/49] fix: fix --- app/component/TransitLeg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/component/TransitLeg.js b/app/component/TransitLeg.js index d0596f2da5..a95b708a7c 100644 --- a/app/component/TransitLeg.js +++ b/app/component/TransitLeg.js @@ -548,7 +548,7 @@ class TransitLeg extends React.Component {
{leg.fare?.isUnknown && shouldShowFareInfo(config) && - (config.modeDisclaimers[mode] ? ( + (config.modeDisclaimers && config.modeDisclaimers[mode] ? (
Date: Fri, 17 Nov 2023 15:44:20 +0200 Subject: [PATCH 45/49] fix: bad update :( --- app/component/ItineraryTab.js | 94 +++++++++++++++++------------------ 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index 0dac9dbf7b..41a6cd55c9 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -227,49 +227,59 @@ class ItineraryTab extends React.Component { }); const disclaimers = []; - const uniqueMessages = new Set(); + const showFareDisclaimer = + shouldShowFareInfo(config) && fares.some(fare => fare.isUnknown); - function pushUniqueMessage(message) { - const updatedMessage = { ...message }; - updatedMessage.id = (updatedMessage.id || 0) + 1; - if (!uniqueMessages.has(JSON.stringify(updatedMessage))) { - disclaimers.push(updatedMessage); - uniqueMessages.add(JSON.stringify(updatedMessage)); - } - } - - itinerary.legs.forEach(leg => { - if (config.modeDisclaimers && config.modeDisclaimers[leg.mode]) { - const modeDisclaimer = { - textId: config.modeDisclaimers[leg.mode][currentLanguage].disclaimer, - values: null, - href: config.modeDisclaimers[leg.mode][currentLanguage].link, - linkText: config.modeDisclaimers[leg.mode][currentLanguage].link, - }; - pushUniqueMessage(modeDisclaimer); - } + if (showFareDisclaimer) { + const found = {}; + itinerary.legs.forEach(leg => { + if ( + config.modeDisclaimers && + config.modeDisclaimers[leg.mode] && + !found[leg.mode] + ) { + found[leg.mode] = true; + const disclaimer = config.modeDisclaimers[leg.mode][currentLanguage]; + disclaimers.push( + , + ); + } + }); if (showCallAgencyDisclaimer) { - const callAgencyMessage = { - textId: 'separate-ticket-required-for-call-agency-disclaimer', - values: `callAgencyInfo.${currentLanguage}.callAgencyInfoLink`, - href: config.callAgencyInfo[currentLanguage].callAgencyInfoLink, - linkText: - config.callAgencyInfo[currentLanguage].callAgencyInfoLinkText, - }; - pushUniqueMessage(callAgencyMessage); + disclaimers.push( + , + ); } if (!showLegModeDisclaimer && !showCallAgencyDisclaimer) { - const defaultMessage = { - textId: 'separate-ticket-required-disclaimer', - values: 'ticketInformation.primaryAgencyName', - href: null, - linkText: null, - }; - pushUniqueMessage(defaultMessage); + disclaimers.push( + , + ); } - }); + } return (
@@ -362,17 +372,7 @@ class ItineraryTab extends React.Component { 'bp-large': breakpoint === 'large', })} > - {shouldShowFareInfo(config) && - fares.some(fare => fare.isUnknown) && - disclaimers.map(disclaimer => ( - - ))} + <>{disclaimers} Date: Fri, 17 Nov 2023 16:26:42 +0200 Subject: [PATCH 46/49] fix: changed propTypes --- app/component/FareDisclaimer.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/component/FareDisclaimer.js b/app/component/FareDisclaimer.js index 7d579a50e2..5b84a4bc7e 100644 --- a/app/component/FareDisclaimer.js +++ b/app/component/FareDisclaimer.js @@ -24,15 +24,18 @@ const FareDisclaimer = ({ textId, values, href = null, linkText = null }) => { FareDisclaimer.propTypes = { textId: PropTypes.string.isRequired, - values: PropTypes.shape({ - agencyName: PropTypes.string, - }), + values: PropTypes.oneOfType([ + PropTypes.shape({ + agencyName: PropTypes.string, + }), + PropTypes.object, + ]), href: PropTypes.string, linkText: PropTypes.string, }; FareDisclaimer.defaultProps = { - values: null, + values: {}, href: null, linkText: null, }; From 8b6c417a85e4b088925274ae5a687ebf04e1a95b Mon Sep 17 00:00:00 2001 From: Dvun Date: Fri, 17 Nov 2023 16:27:06 +0200 Subject: [PATCH 47/49] fix: update --- app/component/ItineraryTab.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index 41a6cd55c9..c908928ae1 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -243,6 +243,7 @@ class ItineraryTab extends React.Component { disclaimers.push( Date: Sat, 18 Nov 2023 12:18:28 +0200 Subject: [PATCH 48/49] chore: remove redundant variables --- app/component/ItineraryTab.js | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index c908928ae1..da36aa6920 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -215,27 +215,14 @@ 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; - const itineraryContainsCallLegs = itinerary.legs.some(leg => - isCallAgencyPickupType(leg), - ); - - const showCallAgencyDisclaimer = - config.callAgencyInfo && itineraryContainsCallLegs; - - const showLegModeDisclaimer = itinerary.legs.some(leg => { - return !!(config.modeDisclaimers && config.modeDisclaimers[leg.mode]); - }); const disclaimers = []; - const showFareDisclaimer = - shouldShowFareInfo(config) && fares.some(fare => fare.isUnknown); - if (showFareDisclaimer) { + if (shouldShowFareInfo(config) && fares.some(fare => fare.isUnknown)) { const found = {}; itinerary.legs.forEach(leg => { if ( - config.modeDisclaimers && - config.modeDisclaimers[leg.mode] && + config.modeDisclaimers?.[leg.mode] && !found[leg.mode] ) { found[leg.mode] = true; @@ -252,7 +239,7 @@ class ItineraryTab extends React.Component { } }); - if (showCallAgencyDisclaimer) { + if (config.callAgencyInfo && itinerary.legs.some(leg => isCallAgencyPickupType(leg))) { disclaimers.push( Date: Mon, 20 Nov 2023 08:36:51 +0200 Subject: [PATCH 49/49] fix: incorrect message id --- app/component/ItineraryTab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/component/ItineraryTab.js b/app/component/ItineraryTab.js index da36aa6920..26a1ab4b15 100644 --- a/app/component/ItineraryTab.js +++ b/app/component/ItineraryTab.js @@ -260,7 +260,7 @@ class ItineraryTab extends React.Component { if (!disclaimers.length) { disclaimers.push(