From aa2defef3f05412a556cb9855e7d3afca3b9e816 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 22 Nov 2024 11:26:57 +0200 Subject: [PATCH 01/13] feat: epoch time to RFC3339 util --- app/util/timeUtils.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/util/timeUtils.js b/app/util/timeUtils.js index 34a138d20b..7afe8c7c98 100644 --- a/app/util/timeUtils.js +++ b/app/util/timeUtils.js @@ -161,3 +161,14 @@ export function timeStr(dateTime) { const time = parts[1].split(':'); return `${time[0]}:${time[1]}`; } + +/** + * Epoch ms to ISO-8601/RFC3339 datetime str + */ +export function epochToIso(ms) { + const date = new Date(ms); + let iso = date.toISOLocaleString(); + const msSeparator = iso.indexOf('.'); + iso = iso.subString(0, msSeparator); + return iso + date.getISOTimezoneOffset(); +} From 8558a389104e2b8b326ce7ed54b7a79af91a1734 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 22 Nov 2024 11:28:01 +0200 Subject: [PATCH 02/13] fix: fit non-transit legs with realtime transit legs Non transit legs of original itinerary will not work in navigation, when transit leg times change. Legs start to overlap or unexpected gaps appear. This change fits the non-transit legs into modified trasit legs and also scales transfers to make them possible. --- .../navigator/hooks/useRealtimeLegs.js | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/app/component/itinerary/navigator/hooks/useRealtimeLegs.js b/app/component/itinerary/navigator/hooks/useRealtimeLegs.js index f43dada24e..cf14266d34 100644 --- a/app/component/itinerary/navigator/hooks/useRealtimeLegs.js +++ b/app/component/itinerary/navigator/hooks/useRealtimeLegs.js @@ -2,6 +2,89 @@ import { useCallback, useEffect, useState } from 'react'; import { fetchQuery } from 'react-relay'; import { checkPositioningPermission } from '../../../../action/PositionActions'; import { legQuery } from '../../queries/LegQuery'; +import { legTime } from '../../../../util/legUtils'; +import { epochToIso } from '../../../../util/timeUtils'; + +function nextTransitIndex(legs, i) { + for (let j = i; j < legs.length; j++) { + if (legs[j].isTransitLeg) { + return j; + } + } + // negative indicates not found + return -1; +} + +function getLegGap(legs, index) { + return legTime(legs[index].end) - legTime(legs[index + 1].start); +} + +// change non-transit legs' scheduled times +function shiftLegs(legs, i1, i2, gap) { + for (let j = i1; j <= i2; j++) { + const leg = legs[j]; + leg.start.scheduledTime = epochToIso(legTime(leg.start) + gap); + leg.end.scheduledTime = epochToIso(legTime(leg.end) + gap); + } +} + +// scale non-transit legs' scheduled times +function scaleLegs(legs, i1, i2, k) { + const base = legTime(legs[i1].start); + for (let j = i1; j <= i2; j++) { + const leg = legs[j]; + const s = legTime(leg.start); + const e = legTime(leg.end); + leg.start.scheduledTime = epochToIso(s + k * (s - base)); + leg.end.scheduledTime = epochToIso(e + k * (e - base)); + } +} + +function matchLegEnds(legs) { + if (legs.length < 2) { + return; + } + let transit; + let gap; + + // shift first legs to match transit start + transit = nextTransitIndex(legs, 0); + if (transit > 0) { + gap = getLegGap(legs, transit - 1); + if (gap) { + shiftLegs(legs, 0, transit - 1, gap); + } + } + + // shift transfers and legs after transit end + while (transit > 0) { + const walk = transit + 1; // first leg after transit + const nextTransit = nextTransitIndex(legs, walk); + const shiftEnd = nextTransit > 0 ? nextTransit - 1 : legs.length - 1; + if (shiftEnd > transit) { + gap = getLegGap(legs, transit); + if (gap) { + shiftLegs(legs, walk, shiftEnd, -gap); + } + } + if (nextTransit > walk) { + // check if transfer needs scaling + gap = getLegGap(legs, nextTransit - 1); + if (gap < 0) { + // transfer overlaps next transit leg, so we must make it shorter + const transferDuration = + legTime(legs[shiftEnd].end) - legTime(legs[walk].start); + scaleLegs( + legs, + walk, + shiftEnd, + (transferDuration + gap) / transferDuration, + ); + } + } + transit = nextTransit; + } +} const useRealtimeLegs = (initialLegs, mapRef, relayEnvironment) => { const [isPositioningAllowed, setPositioningAllowed] = useState(false); @@ -62,6 +145,9 @@ const useRealtimeLegs = (initialLegs, mapRef, relayEnvironment) => { } return { ...l }; }); + // shift non-transit-legs to match possibly changed transit legs + matchLegEnds(rtLegs); + setRealTimeLegs(rtLegs); }, [initialLegs, queryAndMapRealtimeLegs]); From a9f272ec56aa81acaa31a88f6fe7c79169b3e571 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 22 Nov 2024 12:09:37 +0200 Subject: [PATCH 03/13] fix: proper time ocnversion --- app/util/timeUtils.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/util/timeUtils.js b/app/util/timeUtils.js index 7afe8c7c98..9e9eeaea48 100644 --- a/app/util/timeUtils.js +++ b/app/util/timeUtils.js @@ -166,9 +166,5 @@ export function timeStr(dateTime) { * Epoch ms to ISO-8601/RFC3339 datetime str */ export function epochToIso(ms) { - const date = new Date(ms); - let iso = date.toISOLocaleString(); - const msSeparator = iso.indexOf('.'); - iso = iso.subString(0, msSeparator); - return iso + date.getISOTimezoneOffset(); + return moment(ms).format(); } From 252521c1da5b6162940e40df2693e8ce1ad73fc1 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 22 Nov 2024 12:10:18 +0200 Subject: [PATCH 04/13] fix: correct transitLeg flag --- app/component/itinerary/navigator/hooks/useRealtimeLegs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/component/itinerary/navigator/hooks/useRealtimeLegs.js b/app/component/itinerary/navigator/hooks/useRealtimeLegs.js index cf14266d34..daa1d81e45 100644 --- a/app/component/itinerary/navigator/hooks/useRealtimeLegs.js +++ b/app/component/itinerary/navigator/hooks/useRealtimeLegs.js @@ -7,7 +7,7 @@ import { epochToIso } from '../../../../util/timeUtils'; function nextTransitIndex(legs, i) { for (let j = i; j < legs.length; j++) { - if (legs[j].isTransitLeg) { + if (legs[j].transitLeg) { return j; } } From fb77a390b30a5377a26673c9c6fa1ae91fd8ecc6 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 22 Nov 2024 12:17:39 +0200 Subject: [PATCH 05/13] fix: use deeper copy of non-transit legs Realtime correction should work on original leg times --- app/component/itinerary/navigator/hooks/useRealtimeLegs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/component/itinerary/navigator/hooks/useRealtimeLegs.js b/app/component/itinerary/navigator/hooks/useRealtimeLegs.js index daa1d81e45..609e647905 100644 --- a/app/component/itinerary/navigator/hooks/useRealtimeLegs.js +++ b/app/component/itinerary/navigator/hooks/useRealtimeLegs.js @@ -143,7 +143,7 @@ const useRealtimeLegs = (initialLegs, mapRef, relayEnvironment) => { }, }; } - return { ...l }; + return { ...l, start: { ...l.start }, end: { ...l.end } }; }); // shift non-transit-legs to match possibly changed transit legs matchLegEnds(rtLegs); From 1002832d1d7d12fc4762da5ab91f8b34ccd86e2d Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 22 Nov 2024 15:02:39 +0200 Subject: [PATCH 06/13] feat: epoch time string formatter with seconds --- app/util/legUtils.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/util/legUtils.js b/app/util/legUtils.js index a7758f7cbc..50c3b1e064 100644 --- a/app/util/legUtils.js +++ b/app/util/legUtils.js @@ -21,6 +21,15 @@ export function legTimeStr(lt) { return `${time[0]}:${time[1]}`; } +/** + * Get time as 'hh:mm:ss' + */ +export function legTimeAcc(lt) { + const t = lt.estimated?.time || lt.scheduledTime; + const parts = t.split('T')[1].split('+'); + return parts[0]; +} + function filterLegStops(leg, filter) { if (leg.from.stop && leg.to.stop && leg.trip) { const stops = [leg.from.stop.gtfsId, leg.to.stop.gtfsId]; From 318d65bf1152940044b5f354767d1ee242ebdd5f Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 22 Nov 2024 15:03:21 +0200 Subject: [PATCH 07/13] fix: correct order for leg gap computation --- app/component/itinerary/navigator/hooks/useRealtimeLegs.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/component/itinerary/navigator/hooks/useRealtimeLegs.js b/app/component/itinerary/navigator/hooks/useRealtimeLegs.js index 609e647905..167a49d801 100644 --- a/app/component/itinerary/navigator/hooks/useRealtimeLegs.js +++ b/app/component/itinerary/navigator/hooks/useRealtimeLegs.js @@ -16,7 +16,7 @@ function nextTransitIndex(legs, i) { } function getLegGap(legs, index) { - return legTime(legs[index].end) - legTime(legs[index + 1].start); + return legTime(legs[index + 1].start) - legTime(legs[index].end); } // change non-transit legs' scheduled times @@ -147,7 +147,6 @@ const useRealtimeLegs = (initialLegs, mapRef, relayEnvironment) => { }); // shift non-transit-legs to match possibly changed transit legs matchLegEnds(rtLegs); - setRealTimeLegs(rtLegs); }, [initialLegs, queryAndMapRealtimeLegs]); From 4bdb9e56ead824394bc9975ce107302520ba3720 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 22 Nov 2024 16:31:12 +0200 Subject: [PATCH 08/13] feat: move stop page components to a sub folder --- app/component/{ => itinerary}/StopInfo.js | 8 ++--- app/component/itinerary/TransitLeg.js | 2 +- .../{ => stop}/FilterTimeTableModal.js | 12 +++---- app/component/{ => stop}/StopAlerts.js | 12 +++---- .../{ => stop}/StopAlertsContainer.js | 2 +- app/component/{ => stop}/StopCardHeader.js | 14 ++++---- .../{ => stop}/StopCardHeaderContainer.js | 0 .../{ => stop}/StopPageContentContainer.js | 19 +++++++---- app/component/{ => stop}/StopPageHeader.js | 2 +- .../{ => stop}/StopPageHeaderContainer.js | 0 .../{ => stop}/StopPageMapContainer.js | 4 +-- app/component/{ => stop}/StopPageMeta.js | 4 +-- .../{ => stop}/StopPageTabContainer.js | 2 +- app/component/{ => stop}/StopPageTabs.js | 16 +++++----- app/component/{ => stop}/StopTimetablePage.js | 6 ++-- app/component/{ => stop}/StopTitle.js | 0 .../{ => stop}/TerminalAlertsContainer.js | 2 +- .../TerminalPageContentContainer.js | 14 ++++---- .../{ => stop}/TerminalPageHeaderContainer.js | 0 .../{ => stop}/TerminalPageMapContainer.js | 4 +-- app/component/{ => stop}/TerminalPageMeta.js | 4 +-- .../{ => stop}/TerminalPageTabContainer.js | 2 +- .../{ => stop}/TerminalTimetablePage.js | 6 ++-- app/component/{ => stop}/TerminalTitle.js | 0 .../{ => stop}/TimeTableOptionsPanel.js | 8 ++--- app/component/{ => stop}/Timetable.js | 20 ++++++------ .../{ => stop}/TimetableContainer.js | 0 app/component/{ => stop}/TimetableRow.js | 0 app/stopRoutes.js | 32 +++++++++---------- test/unit/component/StopAlerts.test.js | 2 +- test/unit/component/StopCardHeader.test.js | 2 +- .../StopPageContentContainer.test.js | 2 +- test/unit/component/StopPageTabs.test.js | 2 +- test/unit/component/Timetable.test.js | 4 +-- test/unit/component/TimetableRow.test.js | 2 +- 35 files changed, 107 insertions(+), 102 deletions(-) rename app/component/{ => itinerary}/StopInfo.js (91%) rename app/component/{ => stop}/FilterTimeTableModal.js (96%) rename app/component/{ => stop}/StopAlerts.js (91%) rename app/component/{ => stop}/StopAlertsContainer.js (97%) rename app/component/{ => stop}/StopCardHeader.js (91%) rename app/component/{ => stop}/StopCardHeaderContainer.js (100%) rename app/component/{ => stop}/StopPageContentContainer.js (92%) rename app/component/{ => stop}/StopPageHeader.js (92%) rename app/component/{ => stop}/StopPageHeaderContainer.js (100%) rename app/component/{ => stop}/StopPageMapContainer.js (90%) rename app/component/{ => stop}/StopPageMeta.js (90%) rename app/component/{ => stop}/StopPageTabContainer.js (97%) rename app/component/{ => stop}/StopPageTabs.js (94%) rename app/component/{ => stop}/StopTimetablePage.js (89%) rename app/component/{ => stop}/StopTitle.js (100%) rename app/component/{ => stop}/TerminalAlertsContainer.js (97%) rename app/component/{ => stop}/TerminalPageContentContainer.js (93%) rename app/component/{ => stop}/TerminalPageHeaderContainer.js (100%) rename app/component/{ => stop}/TerminalPageMapContainer.js (91%) rename app/component/{ => stop}/TerminalPageMeta.js (91%) rename app/component/{ => stop}/TerminalPageTabContainer.js (97%) rename app/component/{ => stop}/TerminalTimetablePage.js (90%) rename app/component/{ => stop}/TerminalTitle.js (100%) rename app/component/{ => stop}/TimeTableOptionsPanel.js (94%) rename app/component/{ => stop}/Timetable.js (97%) rename app/component/{ => stop}/TimetableContainer.js (100%) rename app/component/{ => stop}/TimetableRow.js (100%) diff --git a/app/component/StopInfo.js b/app/component/itinerary/StopInfo.js similarity index 91% rename from app/component/StopInfo.js rename to app/component/itinerary/StopInfo.js index 26c9883d3a..4f77b99e5a 100644 --- a/app/component/StopInfo.js +++ b/app/component/itinerary/StopInfo.js @@ -2,10 +2,10 @@ import React from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; import { FormattedMessage } from 'react-intl'; -import { configShape } from '../util/shapes'; -import { durationToString } from '../util/timeUtils'; -import { isKeyboardSelectionEvent } from '../util/browser'; -import Icon from './Icon'; +import { configShape } from '../../util/shapes'; +import { durationToString } from '../../util/timeUtils'; +import { isKeyboardSelectionEvent } from '../../util/browser'; +import Icon from '../Icon'; export default function StopInfo( { intermediateStopCount, toggleFunction, duration, showIntermediateStops }, diff --git a/app/component/itinerary/TransitLeg.js b/app/component/itinerary/TransitLeg.js index 3a83cd6134..5577382ed3 100644 --- a/app/component/itinerary/TransitLeg.js +++ b/app/component/itinerary/TransitLeg.js @@ -41,7 +41,7 @@ import { shouldShowFareInfo } from '../../util/fareUtils'; import { AlertEntityType, AlertSeverityLevelType } from '../../constants'; import { legShape, configShape } from '../../util/shapes'; import ZoneIcon from '../ZoneIcon'; -import StopInfo from '../StopInfo'; +import StopInfo from './StopInfo'; import InterlineInfo from './InterlineInfo'; import AlternativeLegsInfo from './AlternativeLegsInfo'; import LegInfo from './LegInfo'; diff --git a/app/component/FilterTimeTableModal.js b/app/component/stop/FilterTimeTableModal.js similarity index 96% rename from app/component/FilterTimeTableModal.js rename to app/component/stop/FilterTimeTableModal.js index 97f29a919f..6fcd147ec4 100644 --- a/app/component/FilterTimeTableModal.js +++ b/app/component/stop/FilterTimeTableModal.js @@ -4,12 +4,12 @@ import intersection from 'lodash/intersection'; import { FormattedMessage, intlShape } from 'react-intl'; import cx from 'classnames'; import Modal from '@hsl-fi/modal'; -import Icon from './Icon'; -import routeCompare from '../util/route-compare'; -import withBreakpoint from '../util/withBreakpoint'; -import { isKeyboardSelectionEvent } from '../util/browser'; -import { getRouteMode } from '../util/modeUtils'; -import { stopShape } from '../util/shapes'; +import Icon from '../Icon'; +import routeCompare from '../../util/route-compare'; +import withBreakpoint from '../../util/withBreakpoint'; +import { isKeyboardSelectionEvent } from '../../util/browser'; +import { getRouteMode } from '../../util/modeUtils'; +import { stopShape } from '../../util/shapes'; class FilterTimeTableModal extends React.Component { static propTypes = { diff --git a/app/component/StopAlerts.js b/app/component/stop/StopAlerts.js similarity index 91% rename from app/component/StopAlerts.js rename to app/component/stop/StopAlerts.js index 15c423801d..d91a8b0c3d 100644 --- a/app/component/StopAlerts.js +++ b/app/component/stop/StopAlerts.js @@ -1,16 +1,16 @@ import React from 'react'; import { intlShape } from 'react-intl'; import { uniq } from 'lodash'; -import AlertList from './AlertList'; +import AlertList from '../AlertList'; import { getCancelationsForStop, getAlertsForObject, getServiceAlertsForStation, -} from '../util/alertUtils'; -import { getRouteMode } from '../util/modeUtils'; -import { epochToTime } from '../util/timeUtils'; -import { stopShape, configShape } from '../util/shapes'; -import { AlertSeverityLevelType, AlertEntityType } from '../constants'; +} from '../../util/alertUtils'; +import { getRouteMode } from '../../util/modeUtils'; +import { epochToTime } from '../../util/timeUtils'; +import { stopShape, configShape } from '../../util/shapes'; +import { AlertSeverityLevelType, AlertEntityType } from '../../constants'; export const isRelevantEntity = (entity, stopIds, routeIds) => // eslint-disable-next-line no-underscore-dangle diff --git a/app/component/StopAlertsContainer.js b/app/component/stop/StopAlertsContainer.js similarity index 97% rename from app/component/StopAlertsContainer.js rename to app/component/stop/StopAlertsContainer.js index 7e2e466c4d..da446cc1f1 100644 --- a/app/component/StopAlertsContainer.js +++ b/app/component/stop/StopAlertsContainer.js @@ -1,6 +1,6 @@ import React from 'react'; import { createFragmentContainer, graphql } from 'react-relay'; -import { stopShape } from '../util/shapes'; +import { stopShape } from '../../util/shapes'; import StopAlerts from './StopAlerts'; const StopAlertsContainer = ({ stop }) => { diff --git a/app/component/StopCardHeader.js b/app/component/stop/StopCardHeader.js similarity index 91% rename from app/component/StopCardHeader.js rename to app/component/stop/StopCardHeader.js index 097b715cbd..dd12e0ddeb 100644 --- a/app/component/StopCardHeader.js +++ b/app/component/stop/StopCardHeader.js @@ -2,15 +2,15 @@ import PropTypes from 'prop-types'; import React from 'react'; import { intlShape } from 'react-intl'; import { matchShape } from 'found'; -import { stopShape, stationShape } from '../util/shapes'; -import CardHeader from './CardHeader'; -import { getJson } from '../util/xhrPromise'; -import { saveSearch } from '../action/SearchActions'; -import { isIOS } from '../util/browser'; -import LazilyLoad, { importLazy } from './LazilyLoad'; +import { stopShape, stationShape } from '../../util/shapes'; +import CardHeader from '../CardHeader'; +import { getJson } from '../../util/xhrPromise'; +import { saveSearch } from '../../action/SearchActions'; +import { isIOS } from '../../util/browser'; +import LazilyLoad, { importLazy } from '../LazilyLoad'; const modules = { - FavouriteStopContainer: () => importLazy(import('./FavouriteStopContainer')), + FavouriteStopContainer: () => importLazy(import('../FavouriteStopContainer')), }; class StopCardHeader extends React.Component { diff --git a/app/component/StopCardHeaderContainer.js b/app/component/stop/StopCardHeaderContainer.js similarity index 100% rename from app/component/StopCardHeaderContainer.js rename to app/component/stop/StopCardHeaderContainer.js diff --git a/app/component/StopPageContentContainer.js b/app/component/stop/StopPageContentContainer.js similarity index 92% rename from app/component/StopPageContentContainer.js rename to app/component/stop/StopPageContentContainer.js index 0b7049b800..8d6991714c 100644 --- a/app/component/StopPageContentContainer.js +++ b/app/component/stop/StopPageContentContainer.js @@ -4,13 +4,18 @@ import { createRefetchContainer, graphql } from 'react-relay'; import connectToStores from 'fluxible-addons-react/connectToStores'; import { FormattedMessage, intlShape } from 'react-intl'; import { matchShape, routerShape, RedirectException } from 'found'; -import { configShape, errorShape, relayShape, stopShape } from '../util/shapes'; -import DepartureListContainer from './DepartureListContainer'; -import Loading from './Loading'; -import Icon from './Icon'; -import ScrollableWrapper from './ScrollableWrapper'; -import { isBrowser } from '../util/browser'; -import { PREFIX_STOPS } from '../util/path'; +import { + configShape, + errorShape, + relayShape, + stopShape, +} from '../../util/shapes'; +import DepartureListContainer from '../DepartureListContainer'; +import Loading from '../Loading'; +import Icon from '../Icon'; +import ScrollableWrapper from '../ScrollableWrapper'; +import { isBrowser } from '../../util/browser'; +import { PREFIX_STOPS } from '../../util/path'; class StopPageContent extends React.Component { static propTypes = { diff --git a/app/component/StopPageHeader.js b/app/component/stop/StopPageHeader.js similarity index 92% rename from app/component/StopPageHeader.js rename to app/component/stop/StopPageHeader.js index 68ee8c2cff..b4440395da 100644 --- a/app/component/StopPageHeader.js +++ b/app/component/stop/StopPageHeader.js @@ -4,7 +4,7 @@ import getContext from 'recompose/getContext'; import compose from 'recompose/compose'; import StopCardHeaderContainer from './StopCardHeaderContainer'; -import withBreakpoint from '../util/withBreakpoint'; +import withBreakpoint from '../../util/withBreakpoint'; const StopPageHeader = compose( withBreakpoint, diff --git a/app/component/StopPageHeaderContainer.js b/app/component/stop/StopPageHeaderContainer.js similarity index 100% rename from app/component/StopPageHeaderContainer.js rename to app/component/stop/StopPageHeaderContainer.js diff --git a/app/component/StopPageMapContainer.js b/app/component/stop/StopPageMapContainer.js similarity index 90% rename from app/component/StopPageMapContainer.js rename to app/component/stop/StopPageMapContainer.js index a10931d8c2..ce26e3106a 100644 --- a/app/component/StopPageMapContainer.js +++ b/app/component/stop/StopPageMapContainer.js @@ -1,8 +1,8 @@ import PropTypes from 'prop-types'; import React from 'react'; import { createFragmentContainer, graphql } from 'react-relay'; -import { configShape } from '../util/shapes'; -import StopPageMap from './map/StopPageMap'; +import { configShape } from '../../util/shapes'; +import StopPageMap from '../map/StopPageMap'; function StopPageMapContainer({ stop }) { if (!stop) { diff --git a/app/component/StopPageMeta.js b/app/component/stop/StopPageMeta.js similarity index 90% rename from app/component/StopPageMeta.js rename to app/component/stop/StopPageMeta.js index ce0bd1ceef..9ca73894bf 100644 --- a/app/component/StopPageMeta.js +++ b/app/component/stop/StopPageMeta.js @@ -4,9 +4,9 @@ import { createFragmentContainer, graphql } from 'react-relay'; import compose from 'recompose/compose'; import getContext from 'recompose/getContext'; import mapProps from 'recompose/mapProps'; -import { configShape } from '../util/shapes'; +import { configShape } from '../../util/shapes'; -import { generateMetaData } from '../util/metaUtils'; +import { generateMetaData } from '../../util/metaUtils'; const StopPageMeta = compose( getContext({ config: configShape, intl: intlShape }), diff --git a/app/component/StopPageTabContainer.js b/app/component/stop/StopPageTabContainer.js similarity index 97% rename from app/component/StopPageTabContainer.js rename to app/component/stop/StopPageTabContainer.js index c0fe5578e1..2d9351d971 100644 --- a/app/component/StopPageTabContainer.js +++ b/app/component/stop/StopPageTabContainer.js @@ -1,7 +1,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import { createFragmentContainer, graphql } from 'react-relay'; -import { alertShape } from '../util/shapes'; +import { alertShape } from '../../util/shapes'; import StopPageTabs from './StopPageTabs'; function StopPageTabContainer({ children, stop }) { diff --git a/app/component/StopPageTabs.js b/app/component/stop/StopPageTabs.js similarity index 94% rename from app/component/StopPageTabs.js rename to app/component/stop/StopPageTabs.js index b565690d89..bac03d96c2 100644 --- a/app/component/StopPageTabs.js +++ b/app/component/stop/StopPageTabs.js @@ -2,25 +2,25 @@ import cx from 'classnames'; import React, { useState, useRef } from 'react'; import { FormattedMessage } from 'react-intl'; import { matchShape } from 'found'; -import { stopShape } from '../util/shapes'; -import { AlertSeverityLevelType } from '../constants'; +import { stopShape } from '../../util/shapes'; +import { AlertSeverityLevelType } from '../../constants'; import { getCancelationsForStop, getAlertsForObject, getServiceAlertsForStation, getActiveAlertSeverityLevel, -} from '../util/alertUtils'; -import withBreakpoint from '../util/withBreakpoint'; -import { addAnalyticsEvent } from '../util/analyticsUtils'; -import { unixTime } from '../util/timeUtils'; +} from '../../util/alertUtils'; +import withBreakpoint from '../../util/withBreakpoint'; +import { addAnalyticsEvent } from '../../util/analyticsUtils'; +import { unixTime } from '../../util/timeUtils'; import { PREFIX_DISRUPTION, PREFIX_ROUTES, PREFIX_STOPS, PREFIX_TERMINALS, PREFIX_TIMETABLE, -} from '../util/path'; -import Icon from './Icon'; +} from '../../util/path'; +import Icon from '../Icon'; const Tab = { Disruptions: PREFIX_DISRUPTION, diff --git a/app/component/StopTimetablePage.js b/app/component/stop/StopTimetablePage.js similarity index 89% rename from app/component/StopTimetablePage.js rename to app/component/stop/StopTimetablePage.js index 75fb1983dd..3606dc6d29 100644 --- a/app/component/StopTimetablePage.js +++ b/app/component/stop/StopTimetablePage.js @@ -2,9 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import { createRefetchContainer, graphql } from 'react-relay'; import { matchShape, routerShape } from 'found'; -import { unixTime, unixToYYYYMMDD } from '../util/timeUtils'; -import { configShape, relayShape } from '../util/shapes'; -import { prepareServiceDay } from '../util/dateParamUtils'; +import { unixTime, unixToYYYYMMDD } from '../../util/timeUtils'; +import { configShape, relayShape } from '../../util/shapes'; +import { prepareServiceDay } from '../../util/dateParamUtils'; import TimetableContainer from './TimetableContainer'; class StopTimetablePage extends React.Component { diff --git a/app/component/StopTitle.js b/app/component/stop/StopTitle.js similarity index 100% rename from app/component/StopTitle.js rename to app/component/stop/StopTitle.js diff --git a/app/component/TerminalAlertsContainer.js b/app/component/stop/TerminalAlertsContainer.js similarity index 97% rename from app/component/TerminalAlertsContainer.js rename to app/component/stop/TerminalAlertsContainer.js index 781ea51594..70b8679ff8 100644 --- a/app/component/TerminalAlertsContainer.js +++ b/app/component/stop/TerminalAlertsContainer.js @@ -1,6 +1,6 @@ import React from 'react'; import { createFragmentContainer, graphql } from 'react-relay'; -import { stationShape } from '../util/shapes'; +import { stationShape } from '../../util/shapes'; import StopAlerts from './StopAlerts'; const TerminalAlertsContainer = ({ station }) => { diff --git a/app/component/TerminalPageContentContainer.js b/app/component/stop/TerminalPageContentContainer.js similarity index 93% rename from app/component/TerminalPageContentContainer.js rename to app/component/stop/TerminalPageContentContainer.js index 4d27c623e7..114fd55668 100644 --- a/app/component/TerminalPageContentContainer.js +++ b/app/component/stop/TerminalPageContentContainer.js @@ -4,13 +4,13 @@ import { createRefetchContainer, graphql } from 'react-relay'; import connectToStores from 'fluxible-addons-react/connectToStores'; import { FormattedMessage } from 'react-intl'; import { routerShape, RedirectException } from 'found'; -import DepartureListContainer from './DepartureListContainer'; -import Loading from './Loading'; -import Icon from './Icon'; -import ScrollableWrapper from './ScrollableWrapper'; -import { isBrowser } from '../util/browser'; -import { PREFIX_TERMINALS } from '../util/path'; -import { stationShape, errorShape, relayShape } from '../util/shapes'; +import DepartureListContainer from '../DepartureListContainer'; +import Loading from '../Loading'; +import Icon from '../Icon'; +import ScrollableWrapper from '../ScrollableWrapper'; +import { isBrowser } from '../../util/browser'; +import { PREFIX_TERMINALS } from '../../util/path'; +import { stationShape, errorShape, relayShape } from '../../util/shapes'; class TerminalPageContent extends React.Component { static propTypes = { diff --git a/app/component/TerminalPageHeaderContainer.js b/app/component/stop/TerminalPageHeaderContainer.js similarity index 100% rename from app/component/TerminalPageHeaderContainer.js rename to app/component/stop/TerminalPageHeaderContainer.js diff --git a/app/component/TerminalPageMapContainer.js b/app/component/stop/TerminalPageMapContainer.js similarity index 91% rename from app/component/TerminalPageMapContainer.js rename to app/component/stop/TerminalPageMapContainer.js index efcfd85f34..79b89dd628 100644 --- a/app/component/TerminalPageMapContainer.js +++ b/app/component/stop/TerminalPageMapContainer.js @@ -1,8 +1,8 @@ import PropTypes from 'prop-types'; import React from 'react'; import { createFragmentContainer, graphql } from 'react-relay'; -import { configShape } from '../util/shapes'; -import StopPageMap from './map/StopPageMap'; +import { configShape } from '../../util/shapes'; +import StopPageMap from '../map/StopPageMap'; const TerminalPageMapContainer = ({ station }) => { if (!station) { diff --git a/app/component/TerminalPageMeta.js b/app/component/stop/TerminalPageMeta.js similarity index 91% rename from app/component/TerminalPageMeta.js rename to app/component/stop/TerminalPageMeta.js index c0a55d9b81..9d7e94aa39 100644 --- a/app/component/TerminalPageMeta.js +++ b/app/component/stop/TerminalPageMeta.js @@ -4,9 +4,9 @@ import { createFragmentContainer, graphql } from 'react-relay'; import compose from 'recompose/compose'; import getContext from 'recompose/getContext'; import mapProps from 'recompose/mapProps'; -import { configShape } from '../util/shapes'; +import { configShape } from '../../util/shapes'; -import { generateMetaData } from '../util/metaUtils'; +import { generateMetaData } from '../../util/metaUtils'; const TerminalPageMeta = compose( getContext({ config: configShape, intl: intlShape }), diff --git a/app/component/TerminalPageTabContainer.js b/app/component/stop/TerminalPageTabContainer.js similarity index 97% rename from app/component/TerminalPageTabContainer.js rename to app/component/stop/TerminalPageTabContainer.js index 3582915098..ceb68b6224 100644 --- a/app/component/TerminalPageTabContainer.js +++ b/app/component/stop/TerminalPageTabContainer.js @@ -1,7 +1,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import { createFragmentContainer, graphql } from 'react-relay'; -import { alertShape } from '../util/shapes'; +import { alertShape } from '../../util/shapes'; import StopPageTabs from './StopPageTabs'; function TerminalPageTabContainer({ children, station }) { diff --git a/app/component/TerminalTimetablePage.js b/app/component/stop/TerminalTimetablePage.js similarity index 90% rename from app/component/TerminalTimetablePage.js rename to app/component/stop/TerminalTimetablePage.js index 249ce062d7..4f95d98d17 100644 --- a/app/component/TerminalTimetablePage.js +++ b/app/component/stop/TerminalTimetablePage.js @@ -2,9 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import { createRefetchContainer, graphql } from 'react-relay'; import { matchShape, routerShape } from 'found'; -import { configShape, relayShape } from '../util/shapes'; -import { unixTime, unixToYYYYMMDD } from '../util/timeUtils'; -import { prepareServiceDay } from '../util/dateParamUtils'; +import { configShape, relayShape } from '../../util/shapes'; +import { unixTime, unixToYYYYMMDD } from '../../util/timeUtils'; +import { prepareServiceDay } from '../../util/dateParamUtils'; import TimetableContainer from './TimetableContainer'; class TerminalTimetablePage extends React.Component { diff --git a/app/component/TerminalTitle.js b/app/component/stop/TerminalTitle.js similarity index 100% rename from app/component/TerminalTitle.js rename to app/component/stop/TerminalTitle.js diff --git a/app/component/TimeTableOptionsPanel.js b/app/component/stop/TimeTableOptionsPanel.js similarity index 94% rename from app/component/TimeTableOptionsPanel.js rename to app/component/stop/TimeTableOptionsPanel.js index 16f6a0e088..4d1d4082f8 100644 --- a/app/component/TimeTableOptionsPanel.js +++ b/app/component/stop/TimeTableOptionsPanel.js @@ -2,10 +2,10 @@ import PropTypes from 'prop-types'; import React from 'react'; import { FormattedMessage } from 'react-intl'; import uniqBy from 'lodash/uniqBy'; -import Icon from './Icon'; -import { ExtendedRouteTypes } from '../constants'; -import { addAnalyticsEvent } from '../util/analyticsUtils'; -import { stopShape } from '../util/shapes'; +import Icon from '../Icon'; +import { ExtendedRouteTypes } from '../../constants'; +import { addAnalyticsEvent } from '../../util/analyticsUtils'; +import { stopShape } from '../../util/shapes'; const MAX_ROUTEFILTER_LEN = 13; diff --git a/app/component/Timetable.js b/app/component/stop/Timetable.js similarity index 97% rename from app/component/Timetable.js rename to app/component/stop/Timetable.js index 22c212ae06..9d9d7a80e3 100644 --- a/app/component/Timetable.js +++ b/app/component/stop/Timetable.js @@ -8,19 +8,19 @@ import padStart from 'lodash/padStart'; import { FormattedMessage, intlShape } from 'react-intl'; import { matchShape, routerShape, RedirectException } from 'found'; import cx from 'classnames'; -import { configShape } from '../util/shapes'; -import Icon from './Icon'; +import { configShape } from '../../util/shapes'; +import Icon from '../Icon'; import FilterTimeTableModal from './FilterTimeTableModal'; import TimeTableOptionsPanel from './TimeTableOptionsPanel'; import TimetableRow from './TimetableRow'; -import { RealtimeStateType } from '../constants'; -import SecondaryButton from './SecondaryButton'; -import { addAnalyticsEvent } from '../util/analyticsUtils'; -import DateSelect from './DateSelect'; -import ScrollableWrapper from './ScrollableWrapper'; -import { replaceQueryParams } from '../util/queryUtils'; -import { isBrowser } from '../util/browser'; -import { PREFIX_STOPS } from '../util/path'; +import { RealtimeStateType } from '../../constants'; +import SecondaryButton from '../SecondaryButton'; +import { addAnalyticsEvent } from '../../util/analyticsUtils'; +import DateSelect from '../DateSelect'; +import ScrollableWrapper from '../ScrollableWrapper'; +import { replaceQueryParams } from '../../util/queryUtils'; +import { isBrowser } from '../../util/browser'; +import { PREFIX_STOPS } from '../../util/path'; const mapStopTimes = stoptimesObject => stoptimesObject diff --git a/app/component/TimetableContainer.js b/app/component/stop/TimetableContainer.js similarity index 100% rename from app/component/TimetableContainer.js rename to app/component/stop/TimetableContainer.js diff --git a/app/component/TimetableRow.js b/app/component/stop/TimetableRow.js similarity index 100% rename from app/component/TimetableRow.js rename to app/component/stop/TimetableRow.js diff --git a/app/stopRoutes.js b/app/stopRoutes.js index 59fa19ad05..ca4482673a 100644 --- a/app/stopRoutes.js +++ b/app/stopRoutes.js @@ -151,10 +151,10 @@ export default function getStopRoutes(isTerminal = false) { getComponent={() => { return isTerminal ? import( - /* webpackChunkName: "stop" */ './component/TerminalTitle' + /* webpackChunkName: "stop" */ './component/stop/TerminalTitle' ).then(getDefault) : import( - /* webpackChunkName: "stop" */ './component/StopTitle' + /* webpackChunkName: "stop" */ './component/stop/StopTitle' ).then(getDefault); }} render={getComponentOrNullRenderer} @@ -166,10 +166,10 @@ export default function getStopRoutes(isTerminal = false) { getComponent={() => { return isTerminal ? import( - /* webpackChunkName: "stop" */ './component/TerminalPageHeaderContainer' + /* webpackChunkName: "stop" */ './component/stop/TerminalPageHeaderContainer' ).then(getDefault) : import( - /* webpackChunkName: "stop" */ './component/StopPageHeaderContainer' + /* webpackChunkName: "stop" */ './component/stop/StopPageHeaderContainer' ).then(getDefault); }} query={queryMap.pageHeader} @@ -181,10 +181,10 @@ export default function getStopRoutes(isTerminal = false) { getComponent={() => { return isTerminal ? import( - /* webpackChunkName: "stop" */ './component/TerminalPageTabContainer' + /* webpackChunkName: "stop" */ './component/stop/TerminalPageTabContainer' ).then(getDefault) : import( - /* webpackChunkName: "stop" */ './component/StopPageTabContainer' + /* webpackChunkName: "stop" */ './component/stop/StopPageTabContainer' ).then(getDefault); }} query={queryMap.pageTab} @@ -194,12 +194,12 @@ export default function getStopRoutes(isTerminal = false) { getComponent={() => { return isTerminal ? import( - /* webpackChunkName: "stop" */ './component/TerminalPageContentContainer' + /* webpackChunkName: "stop" */ './component/stop/TerminalPageContentContainer' ) .then(getDefault) .catch(errorLoading) : import( - /* webpackChunkName: "stop" */ './component/StopPageContentContainer' + /* webpackChunkName: "stop" */ './component/stop/StopPageContentContainer' ) .then(getDefault) .catch(errorLoading); @@ -217,12 +217,12 @@ export default function getStopRoutes(isTerminal = false) { getComponent={() => { return isTerminal ? import( - /* webpackChunkName: "stop" */ './component/TerminalTimetablePage' + /* webpackChunkName: "stop" */ './component/stop/TerminalTimetablePage' ) .then(getDefault) .catch(errorLoading) : import( - /* webpackChunkName: "stop" */ './component/StopTimetablePage' + /* webpackChunkName: "stop" */ './component/stop/StopTimetablePage' ) .then(getDefault) .catch(errorLoading); @@ -242,12 +242,12 @@ export default function getStopRoutes(isTerminal = false) { getComponent={() => { return isTerminal ? import( - /* webpackChunkName: "stop" */ './component/TerminalAlertsContainer' + /* webpackChunkName: "stop" */ './component/stop/TerminalAlertsContainer' ) .then(getDefault) .catch(errorLoading) : import( - /* webpackChunkName: "stop" */ './component/StopAlertsContainer' + /* webpackChunkName: "stop" */ './component/stop/StopAlertsContainer' ) .then(getDefault) .catch(errorLoading); @@ -265,10 +265,10 @@ export default function getStopRoutes(isTerminal = false) { // eslint-disable-next-line no-nested-ternary return isTerminal ? import( - /* webpackChunkName: "stop" */ './component/TerminalPageMapContainer' + /* webpackChunkName: "stop" */ './component/stop/TerminalPageMapContainer' ).then(getDefault) : import( - /* webpackChunkName: "stop" */ './component/StopPageMapContainer' + /* webpackChunkName: "stop" */ './component/stop/StopPageMapContainer' ).then(getDefault); }} query={queryMap.pageMap} @@ -281,10 +281,10 @@ export default function getStopRoutes(isTerminal = false) { getComponent={() => { return isTerminal ? import( - /* webpackChunkName: "stop" */ './component/TerminalPageMeta' + /* webpackChunkName: "stop" */ './component/stop/TerminalPageMeta' ).then(getDefault) : import( - /* webpackChunkName: "stop" */ './component/StopPageMeta' + /* webpackChunkName: "stop" */ './component/stop/StopPageMeta' ).then(getDefault); }} query={queryMap.pageMeta} diff --git a/test/unit/component/StopAlerts.test.js b/test/unit/component/StopAlerts.test.js index 75a9e8d181..faa0568043 100644 --- a/test/unit/component/StopAlerts.test.js +++ b/test/unit/component/StopAlerts.test.js @@ -8,7 +8,7 @@ import { AlertEntityType, } from '../../../app/constants'; import AlertList from '../../../app/component/AlertList'; -import StopAlerts from '../../../app/component/StopAlerts'; +import StopAlerts from '../../../app/component/stop/StopAlerts'; describe('', () => { it("should indicate that there are no alerts if the stop's routes have no alerts and the stop has no canceled stoptimes", () => { diff --git a/test/unit/component/StopCardHeader.test.js b/test/unit/component/StopCardHeader.test.js index 3609a0ca25..55bb9638ef 100644 --- a/test/unit/component/StopCardHeader.test.js +++ b/test/unit/component/StopCardHeader.test.js @@ -3,7 +3,7 @@ import React from 'react'; import { shallowWithIntl } from '../helpers/mock-intl-enzyme'; import ZoneIcon from '../../../app/component/ZoneIcon'; -import StopCardHeader from '../../../app/component/StopCardHeader'; +import StopCardHeader from '../../../app/component/stop/StopCardHeader'; import ExternalLink from '../../../app/component/ExternalLink'; import { mockContext, mockChildContextTypes } from '../helpers/mock-context'; diff --git a/test/unit/component/StopPageContentContainer.test.js b/test/unit/component/StopPageContentContainer.test.js index f4ca105331..9c036e4948 100644 --- a/test/unit/component/StopPageContentContainer.test.js +++ b/test/unit/component/StopPageContentContainer.test.js @@ -4,7 +4,7 @@ import { describe, it } from 'mocha'; import { mockMatch, mockRouter } from '../helpers/mock-router'; import { shallowWithIntl } from '../helpers/mock-intl-enzyme'; -import { Component as StopPageContentContainer } from '../../../app/component/StopPageContentContainer'; +import { Component as StopPageContentContainer } from '../../../app/component/stop/StopPageContentContainer'; describe('', () => { it("should show a 'no departures' indicator", () => { diff --git a/test/unit/component/StopPageTabs.test.js b/test/unit/component/StopPageTabs.test.js index ea50956489..b067b79889 100644 --- a/test/unit/component/StopPageTabs.test.js +++ b/test/unit/component/StopPageTabs.test.js @@ -3,7 +3,7 @@ import { describe, it } from 'mocha'; import React from 'react'; import { shallowWithIntl } from '../helpers/mock-intl-enzyme'; -import { Component as StopPageTabs } from '../../../app/component/StopPageTabs'; +import { Component as StopPageTabs } from '../../../app/component/stop/StopPageTabs'; const context = { match: { diff --git a/test/unit/component/Timetable.test.js b/test/unit/component/Timetable.test.js index 45290d2128..4bf5bb9a35 100644 --- a/test/unit/component/Timetable.test.js +++ b/test/unit/component/Timetable.test.js @@ -3,8 +3,8 @@ import { describe, it } from 'mocha'; import React from 'react'; import { mockContext } from '../helpers/mock-context'; -import Timetable from '../../../app/component/Timetable'; -import TimetableRow from '../../../app/component/TimetableRow'; +import Timetable from '../../../app/component/stop/Timetable'; +import TimetableRow from '../../../app/component/stop/TimetableRow'; import SecondaryButton from '../../../app/component/SecondaryButton'; import { shallowWithIntl } from '../helpers/mock-intl-enzyme'; import * as timetables from '../../../app/configurations/timetableConfigUtils'; diff --git a/test/unit/component/TimetableRow.test.js b/test/unit/component/TimetableRow.test.js index c92bab5ce8..36287b9d33 100644 --- a/test/unit/component/TimetableRow.test.js +++ b/test/unit/component/TimetableRow.test.js @@ -3,7 +3,7 @@ import { expect } from 'chai'; import { describe, it } from 'mocha'; import { shallowWithIntl } from '../helpers/mock-intl-enzyme'; -import TimetableRow from '../../../app/component/TimetableRow'; +import TimetableRow from '../../../app/component/stop/TimetableRow'; import data from '../test-data/dt2720'; From 9e9d5624b12583c7d4bc3fce692413287ae735a3 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 22 Nov 2024 16:32:59 +0200 Subject: [PATCH 09/13] chore: move stop styles as well --- app/component/{ => stop}/stop-cards.scss | 0 app/component/{ => stop}/stop.scss | 0 sass/_main.scss | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename app/component/{ => stop}/stop-cards.scss (100%) rename app/component/{ => stop}/stop.scss (100%) diff --git a/app/component/stop-cards.scss b/app/component/stop/stop-cards.scss similarity index 100% rename from app/component/stop-cards.scss rename to app/component/stop/stop-cards.scss diff --git a/app/component/stop.scss b/app/component/stop/stop.scss similarity index 100% rename from app/component/stop.scss rename to app/component/stop/stop.scss diff --git a/sass/_main.scss b/sass/_main.scss index d105087366..64b7b0246f 100644 --- a/sass/_main.scss +++ b/sass/_main.scss @@ -16,7 +16,7 @@ $body-font-weight: $font-weight-medium; // Some of these files override sass variables Foundation uses, // so they must be loaded before the relevant foundation modules -@import '../app/component/stop-cards'; +@import '../app/component/stop/stop-cards'; @import '../app/component/alert-banner'; @import '../app/component/map/map'; @import '../app/component/map/popups/marker-popup'; @@ -30,7 +30,7 @@ $body-font-weight: $font-weight-medium; @import '../app/component/nearyou/stops-near-you'; @import '../app/component/disruption'; @import '../app/component/departure'; -@import '../app/component/stop'; +@import '../app/component/stop/stop'; @import '../app/component/util'; @import '../app/component/city-bike'; @import '../app/component/favourite-icon-table'; From cb7f62e081b36aca62fb62a1bca80b4985d73d2b Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 22 Nov 2024 18:34:22 +0200 Subject: [PATCH 10/13] chore: move DateSelect as well --- app/component/{ => stop}/DateSelect.js | 2 +- app/component/stop/Timetable.js | 2 +- test/unit/component/DateSelect.test.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename app/component/{ => stop}/DateSelect.js (99%) diff --git a/app/component/DateSelect.js b/app/component/stop/DateSelect.js similarity index 99% rename from app/component/DateSelect.js rename to app/component/stop/DateSelect.js index 5da48dbaea..94ca002d4c 100644 --- a/app/component/DateSelect.js +++ b/app/component/stop/DateSelect.js @@ -4,7 +4,7 @@ import moment from 'moment'; import { intlShape } from 'react-intl'; import Select from 'react-select'; -import Icon from './Icon'; +import Icon from '../Icon'; function DateSelect(props, context) { const [isMenuOpen, setIsMenuOpen] = useState(false); diff --git a/app/component/stop/Timetable.js b/app/component/stop/Timetable.js index 9d9d7a80e3..107a53c76c 100644 --- a/app/component/stop/Timetable.js +++ b/app/component/stop/Timetable.js @@ -16,7 +16,7 @@ import TimetableRow from './TimetableRow'; import { RealtimeStateType } from '../../constants'; import SecondaryButton from '../SecondaryButton'; import { addAnalyticsEvent } from '../../util/analyticsUtils'; -import DateSelect from '../DateSelect'; +import DateSelect from './DateSelect'; import ScrollableWrapper from '../ScrollableWrapper'; import { replaceQueryParams } from '../../util/queryUtils'; import { isBrowser } from '../../util/browser'; diff --git a/test/unit/component/DateSelect.test.js b/test/unit/component/DateSelect.test.js index 7f57b5567d..920eb4086d 100644 --- a/test/unit/component/DateSelect.test.js +++ b/test/unit/component/DateSelect.test.js @@ -6,7 +6,7 @@ import Select from 'react-select'; import { mountWithIntl, shallowWithIntl } from '../helpers/mock-intl-enzyme'; import configureMoment from '../../../app/util/configure-moment'; -import DateSelect from '../../../app/component/DateSelect'; +import DateSelect from '../../../app/component/stop/DateSelect'; describe('', () => { const defaultProps = { From 2855c80b0ba043768788519558e380da5c2d241b Mon Sep 17 00:00:00 2001 From: sharhio Date: Mon, 25 Nov 2024 10:43:13 +0200 Subject: [PATCH 11/13] DT-6549 accessible realtime green --- sass/themes/default/_theme.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sass/themes/default/_theme.scss b/sass/themes/default/_theme.scss index 4ebcc77e15..cb7ae52c29 100644 --- a/sass/themes/default/_theme.scss +++ b/sass/themes/default/_theme.scss @@ -37,7 +37,7 @@ $cancelation-black: #666; $cancelation-background: #fbe0ea; $disruption-color: $cancelation-red; $banner-disruption-color: $disruption-color; -$realtime-color: #46850e; +$realtime-color: #3b7f00; $visited-link-color: #8c4799; $current-location-color: $primary-color; $desktop-title-color: $primary-color; From 885e8ebbf3bfa8d5f972844cd0e75a54a1c8054e Mon Sep 17 00:00:00 2001 From: sharhio Date: Mon, 25 Nov 2024 10:52:37 +0200 Subject: [PATCH 12/13] HSL blue accessible shade by default --- app/component/itinerary/customize-search.scss | 2 +- sass/themes/apphsl/_theme.scss | 2 +- sass/themes/default/_theme.scss | 1 - sass/themes/hsl/_theme.scss | 4 +--- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/component/itinerary/customize-search.scss b/app/component/itinerary/customize-search.scss index 3092bee50c..d51f352359 100644 --- a/app/component/itinerary/customize-search.scss +++ b/app/component/itinerary/customize-search.scss @@ -515,7 +515,7 @@ } .external-link { - color: $link-color-accessible; + color: $link-color; text-decoration: none; font-weight: $font-weight-medium; diff --git a/sass/themes/apphsl/_theme.scss b/sass/themes/apphsl/_theme.scss index 8958549ea6..55ce9d83d5 100644 --- a/sass/themes/apphsl/_theme.scss +++ b/sass/themes/apphsl/_theme.scss @@ -4,7 +4,7 @@ @import '../default/theme'; /* Operator palette */ -$hsl-blue: #007ac9; +$hsl-blue: #0074bf; $hsl-dark-blue: #0062a1; $hsl-pink: #f092cd; $hsl-alert: #dc0451; diff --git a/sass/themes/default/_theme.scss b/sass/themes/default/_theme.scss index cb7ae52c29..b53cdc8a09 100644 --- a/sass/themes/default/_theme.scss +++ b/sass/themes/default/_theme.scss @@ -64,7 +64,6 @@ $top-bar-color: $primary-color; $nav-content-color: false; $disclaimer-background-color: rgba(254, 209, 0, 0.1); $disclaimer-border-color: #fed100; -$link-color-accessible: $primary-color; /* Vehicle palette */ $airplane-color: $livi-airplane-blue; diff --git a/sass/themes/hsl/_theme.scss b/sass/themes/hsl/_theme.scss index ef98062cee..b1b5aef436 100644 --- a/sass/themes/hsl/_theme.scss +++ b/sass/themes/hsl/_theme.scss @@ -4,7 +4,7 @@ @import '../default/theme'; /* Operator palette */ -$hsl-blue: #007ac9; +$hsl-blue: #0074bf; $hsl-dark-blue: #0062a1; $hsl-pink: #f092cd; $hsl-alert: #dc0451; @@ -13,7 +13,6 @@ $hsl-metro-orange: #ca4000; $hsl-bus-express: #ca4000; $hsl-rail-red: #8c4799; $hsl-ferry-blue: #007a97; -$hsl-blue-accessible: #0074bf; /* Application palette */ $primary-color: $hsl-blue; @@ -34,7 +33,6 @@ $desktop-title-arrow-icon-color: $secondary-color; $top-bar-color: $primary-color; $disclaimer-background-color: #e5f2fa; $disclaimer-border-color: #e5f2fa; -$link-color-accessible: $hsl-blue-accessible; /* Vehicle palette */ $airplane-color: #0046ad; From 507fbfa21ddb738332134ca7553d8a644d1afeb0 Mon Sep 17 00:00:00 2001 From: sharhio Date: Mon, 25 Nov 2024 13:46:41 +0200 Subject: [PATCH 13/13] use color configs & hsl primary color updated --- app/component/bike-park-rental-station.scss | 2 +- app/component/itinerary/BicycleLeg.js | 1 - app/component/itinerary/ScooterLinkContainer.js | 7 +------ app/component/itinerary/VehicleRentalLeg.js | 1 - app/component/itinerary/itinerary.scss | 1 + app/component/rental-vehicle-content.scss | 3 ++- app/configurations/config.hsl.js | 2 +- 7 files changed, 6 insertions(+), 11 deletions(-) diff --git a/app/component/bike-park-rental-station.scss b/app/component/bike-park-rental-station.scss index 51b4cff0e7..f3dd62239a 100644 --- a/app/component/bike-park-rental-station.scss +++ b/app/component/bike-park-rental-station.scss @@ -157,7 +157,7 @@ } .external-link { - color: #007ac9; + color: $link-color; text-decoration: none; font-weight: $font-weight-medium; diff --git a/app/component/itinerary/BicycleLeg.js b/app/component/itinerary/BicycleLeg.js index 4be92094c7..d5cd261012 100644 --- a/app/component/itinerary/BicycleLeg.js +++ b/app/component/itinerary/BicycleLeg.js @@ -394,7 +394,6 @@ export default function BicycleLeg(
diff --git a/app/component/itinerary/ScooterLinkContainer.js b/app/component/itinerary/ScooterLinkContainer.js index 1cf967c8cb..db1217b409 100644 --- a/app/component/itinerary/ScooterLinkContainer.js +++ b/app/component/itinerary/ScooterLinkContainer.js @@ -67,12 +67,7 @@ function ScooterLinkContainer( href={rentalVehicleLink} onClick={onClick} > - +
diff --git a/app/component/itinerary/VehicleRentalLeg.js b/app/component/itinerary/VehicleRentalLeg.js index be2f287f4c..795cf28500 100644 --- a/app/component/itinerary/VehicleRentalLeg.js +++ b/app/component/itinerary/VehicleRentalLeg.js @@ -145,7 +145,6 @@ function VehicleRentalLeg( diff --git a/app/component/itinerary/itinerary.scss b/app/component/itinerary/itinerary.scss index 5952020926..9d8af2cd7c 100644 --- a/app/component/itinerary/itinerary.scss +++ b/app/component/itinerary/itinerary.scss @@ -1670,6 +1670,7 @@ $itinerary-tab-switch-height: 48px; .link-to-e-scooter-operator { margin: auto 10px auto auto; + color: $link-color; } .citybike-itinerary { diff --git a/app/component/rental-vehicle-content.scss b/app/component/rental-vehicle-content.scss index 08e01a6c92..b48c121692 100644 --- a/app/component/rental-vehicle-content.scss +++ b/app/component/rental-vehicle-content.scss @@ -108,6 +108,7 @@ .link-to-e-scooter-operator { margin: auto 10px auto auto; + color: $link-color; } .citybike-itinerary { @@ -201,7 +202,7 @@ } .external-link { - color: #007ac9; + color: $link-color; text-decoration: none; font-weight: $font-weight-medium; diff --git a/app/configurations/config.hsl.js b/app/configurations/config.hsl.js index 50f3921a66..151cba6367 100644 --- a/app/configurations/config.hsl.js +++ b/app/configurations/config.hsl.js @@ -121,7 +121,7 @@ export default { mergeStopsByCode: true, useExtendedRouteTypes: true, colors: { - primary: '#007ac9', + primary: '#0074bf', accessiblePrimary: '#0074be', hover: '#0062a1', iconColors: {