From 10a3f13efe8d24c34c78d86d1508a5b2e88615e0 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 18 Nov 2025 10:57:42 +0200 Subject: [PATCH 001/129] fix: location prop name for search --- app/component/nearyou/NearYouPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 371c58693b..85608a474a 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -483,7 +483,7 @@ class NearYouPage extends React.Component { mode={nearByStopMode} breakpoint={this.props.breakpoint} lang={this.props.lang} - origin={this.state.searchPosition} + originLocation={this.state.searchPosition} /> )} {this.state.showCityBikeTeaser && From 5652a79c6f7f6cc708521e137683f5bb93eeb155 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 27 Nov 2025 12:35:06 +0200 Subject: [PATCH 002/129] fix: remove unnecessary div with nonexistent style class --- app/component/nearyou/StopsNearYouSearch.js | 48 ++++++++++----------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/app/component/nearyou/StopsNearYouSearch.js b/app/component/nearyou/StopsNearYouSearch.js index 1132350c56..7eb58bbdff 100644 --- a/app/component/nearyou/StopsNearYouSearch.js +++ b/app/component/nearyou/StopsNearYouSearch.js @@ -28,31 +28,29 @@ function StopsNearYouSearch( }; return (
-
- -
+
); } From 40c5a7b4c39b3426e09a0b328288076b20f98b21 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 27 Nov 2025 13:12:49 +0200 Subject: [PATCH 003/129] chore: rename variables --- app/component/nearyou/StopsNearYouContainer.js | 4 ++-- app/component/nearyou/StopsNearYouFavouritesContainer.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/component/nearyou/StopsNearYouContainer.js b/app/component/nearyou/StopsNearYouContainer.js index 65aaa31175..f688b6b213 100644 --- a/app/component/nearyou/StopsNearYouContainer.js +++ b/app/component/nearyou/StopsNearYouContainer.js @@ -11,7 +11,7 @@ import { sortNearbyRentalStations, sortNearbyStops, } from '../../util/sortUtils'; -import CityBikeStopNearYou from './VehicleRentalStationNearYou'; +import VehicleRentalStationNearYou from './VehicleRentalStationNearYou'; import Loading from '../Loading'; import Icon from '../Icon'; import { getDefaultNetworks } from '../../util/vehicleRentalUtils'; @@ -236,7 +236,7 @@ class StopsNearYouContainer extends React.Component { break; case 'VehicleRentalStation': return ( - ); case 'vehicleRentalStation': - return ; + return ; default: return null; } From dcaab48baca19bdf657c61b3fd73fbce3b417682 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 27 Nov 2025 13:15:10 +0200 Subject: [PATCH 004/129] chore: refactor DepartureRow --- app/component/DepartureRow.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/component/DepartureRow.js b/app/component/DepartureRow.js index d015484402..64db196dc0 100644 --- a/app/component/DepartureRow.js +++ b/app/component/DepartureRow.js @@ -47,7 +47,7 @@ export default function DepartureRow( let backgroundShape; let sr; if ( - route?.alerts?.filter(alert => isAlertValid(alert, props.currentTime)) + route.alerts?.filter(alert => isAlertValid(alert, props.currentTime)) ?.length > 0 ) { const alert = getMostSevereAlert(route); @@ -69,7 +69,7 @@ export default function DepartureRow( const headsign = departure.headsign || trip.tripHeadsign || - getHeadsignFromRouteLongName(trip.route); + getHeadsignFromRouteLongName(route); let shownTime; if (timeDiffInMinutes <= 0) { shownTime = intl.formatMessage({ @@ -87,7 +87,7 @@ export default function DepartureRow( { minutes: timeDiffInMinutes }, ); } - const { shortName } = trip.route; + const { shortName } = route; const lowerCaseShortName = shortName?.toLowerCase(); const nameOrIcon = shortName?.length > 6 || !shortName?.length ? ( @@ -160,7 +160,7 @@ export default function DepartureRow( className={cx('route-number-container', { long: shortName && shortName.length <= 6 && shortName.length >= 5, })} - style={{ backgroundColor: `#${trip.route.color}` }} + style={{ backgroundColor: `#${route.color}` }} > ); } diff --git a/app/component/nearyou/StopsNearYouFavorites.js b/app/component/nearyou/StopsNearYouFavorites.js index 75fa51d2a9..79a70f0ab9 100644 --- a/app/component/nearyou/StopsNearYouFavorites.js +++ b/app/component/nearyou/StopsNearYouFavorites.js @@ -21,12 +21,8 @@ function StopsNearYouFavorites({ searchPosition, breakpoint, noFavorites, - favouritesFetched, isParentTabActive, }) { - if (!favouritesFetched) { - return ; - } if (noFavorites) { return (
@@ -104,7 +100,6 @@ StopsNearYouFavorites.propTypes = { vehicleStations: PropTypes.arrayOf(vehicleRentalStationShape), breakpoint: PropTypes.string, noFavorites: PropTypes.bool, - favouritesFetched: PropTypes.bool, isParentTabActive: PropTypes.bool, }; @@ -117,7 +112,6 @@ StopsNearYouFavorites.defaultProps = { vehicleStations: undefined, breakpoint: undefined, noFavorites: false, - favouritesFetched: false, isParentTabActive: false, }; From 2c8688979e3af3d7b328ca73fd8443a628adf810 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 27 Nov 2025 14:43:30 +0200 Subject: [PATCH 007/129] chore: use consistently favourite (not favorite) --- app/component/nearyou/NearYouPage.js | 32 +++++----- ...Favorites.js => StopsNearYouFavourites.js} | 58 +++++++++---------- ... => StopsNearYouFavouritesMapContainer.js} | 16 ++--- app/component/nearyou/stops-near-you.scss | 10 ++-- 4 files changed, 58 insertions(+), 58 deletions(-) rename app/component/nearyou/{StopsNearYouFavorites.js => StopsNearYouFavourites.js} (65%) rename app/component/nearyou/{StopsNearYouFavoritesMapContainer.js => StopsNearYouFavouritesMapContainer.js} (88%) diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 391176235d..6eb2e14500 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -35,9 +35,9 @@ import { import { PREFIX_NEARYOU } from '../../util/path'; import StopsNearYouContainer from './StopsNearYouContainer'; import SwipeableTabs from '../SwipeableTabs'; -import StopsNearYouFavorites from './StopsNearYouFavorites'; +import StopsNearYouFavourites from './StopsNearYouFavourites'; import StopsNearYouMapContainer from './StopsNearYouMapContainer'; -import StopsNearYouFavoritesMapContainer from './StopsNearYouFavoritesMapContainer'; +import StopsNearYouFavouritesMapContainer from './StopsNearYouFavouritesMapContainer'; import { mapLayerShape } from '../../store/MapLayerStore'; import { getRentalNetworkConfig, @@ -366,7 +366,7 @@ class NearYouPage extends React.Component { ); }; - noFavorites = () => { + noFavourites = () => { return ( !this.props.favouriteStopIds.length && !this.props.favouriteStationIds.length && @@ -384,8 +384,8 @@ class NearYouPage extends React.Component { renderContent = () => { const { centerOfMapChanged } = this.state; const { mode } = this.props.match.params; - const noFavorites = mode === 'FAVORITE' && this.noFavorites(); - const renderRefetchButton = centerOfMapChanged && !noFavorites; + const noFavourites = mode === 'FAVORITE' && this.noFavourites(); + const renderRefetchButton = centerOfMapChanged && !noFavourites; const nearByStopModes = this.modes; const index = nearByStopModes.indexOf(mode); const { config } = this.context; @@ -395,7 +395,7 @@ class NearYouPage extends React.Component { const renderDisruptionBanner = nearByStopMode !== 'CITYBIKE'; const isActive = nearByStopMode === mode; if (nearByStopMode === 'FAVORITE') { - const noFavs = this.noFavorites(); + const noFavs = this.noFavourites(); return (
{renderRefetchButton && this.refetchButton()} {this.props.favouritesFetched ? ( - ) : ( @@ -651,21 +651,21 @@ class NearYouPage extends React.Component { return ( { if (props) { return ( - +
{breakpoint !== 'large' && ( -
- +
+
)} -
- +
+
Käyttöohje - +
); } return ( { @@ -89,38 +89,38 @@ function StopsNearYouFavorites({ /> ); } -StopsNearYouFavorites.propTypes = { - favoriteStops: PropTypes.arrayOf(PropTypes.string), - favoriteStations: PropTypes.arrayOf(PropTypes.string), - favoriteVehicleRentalStationIds: PropTypes.arrayOf(PropTypes.string), +StopsNearYouFavourites.propTypes = { + favouriteStops: PropTypes.arrayOf(PropTypes.string), + favouriteStations: PropTypes.arrayOf(PropTypes.string), + favouriteVehicleRentalStationIds: PropTypes.arrayOf(PropTypes.string), relayEnvironment: relayShape.isRequired, searchPosition: locationShape.isRequired, stops: PropTypes.arrayOf(stopShape), stations: PropTypes.arrayOf(stationShape), vehicleStations: PropTypes.arrayOf(vehicleRentalStationShape), breakpoint: PropTypes.string, - noFavorites: PropTypes.bool, + noFavourites: PropTypes.bool, isParentTabActive: PropTypes.bool, }; -StopsNearYouFavorites.defaultProps = { - favoriteStops: undefined, - favoriteStations: undefined, - favoriteVehicleRentalStationIds: undefined, +StopsNearYouFavourites.defaultProps = { + favouriteStops: undefined, + favouriteStations: undefined, + favouriteVehicleRentalStationIds: undefined, stops: undefined, stations: undefined, vehicleStations: undefined, breakpoint: undefined, - noFavorites: false, + noFavourites: false, isParentTabActive: false, }; -const StopsNearYouFavoritesWithBreakpoint = withBreakpoint(props => ( +const StopsNearYouFavouritesWithBreakpoint = withBreakpoint(props => ( {({ environment }) => ( - + )} )); -export default StopsNearYouFavoritesWithBreakpoint; +export default StopsNearYouFavouritesWithBreakpoint; diff --git a/app/component/nearyou/StopsNearYouFavoritesMapContainer.js b/app/component/nearyou/StopsNearYouFavouritesMapContainer.js similarity index 88% rename from app/component/nearyou/StopsNearYouFavoritesMapContainer.js rename to app/component/nearyou/StopsNearYouFavouritesMapContainer.js index e6f5ea7652..6c040a4b47 100644 --- a/app/component/nearyou/StopsNearYouFavoritesMapContainer.js +++ b/app/component/nearyou/StopsNearYouFavouritesMapContainer.js @@ -13,7 +13,7 @@ import { locationShape, } from '../../util/shapes'; -function StopsNearYouFavoritesMapContainer(props) { +function StopsNearYouFavouritesMapContainer(props) { const { stops, stations, vehicleStations, position } = props; const stopList = []; stopList.push( @@ -68,21 +68,21 @@ function StopsNearYouFavoritesMapContainer(props) { return ; } -StopsNearYouFavoritesMapContainer.propTypes = { +StopsNearYouFavouritesMapContainer.propTypes = { stops: PropTypes.arrayOf(stopShape), stations: PropTypes.arrayOf(stationShape), vehicleStations: PropTypes.arrayOf(vehicleRentalStationShape), position: locationShape.isRequired, }; -StopsNearYouFavoritesMapContainer.defaultProps = { +StopsNearYouFavouritesMapContainer.defaultProps = { stops: undefined, stations: undefined, vehicleStations: undefined, }; const StopsNearYouMapWithStores = connectToStores( - StopsNearYouFavoritesMapContainer, + StopsNearYouFavouritesMapContainer, [PreferencesStore, FavouriteStore], ({ getStore }) => { const language = getStore(PreferencesStore).getLanguage(); @@ -92,7 +92,7 @@ const StopsNearYouMapWithStores = connectToStores( const containerComponent = createFragmentContainer(StopsNearYouMapWithStores, { stops: graphql` - fragment StopsNearYouFavoritesMapContainer_stops on Stop + fragment StopsNearYouFavouritesMapContainer_stops on Stop @relay(plural: true) @argumentDefinitions(startTime: { type: "Long!", defaultValue: 0 }) { gtfsId @@ -117,7 +117,7 @@ const containerComponent = createFragmentContainer(StopsNearYouMapWithStores, { } `, stations: graphql` - fragment StopsNearYouFavoritesMapContainer_stations on Stop + fragment StopsNearYouFavouritesMapContainer_stations on Stop @relay(plural: true) @argumentDefinitions(startTime: { type: "Long!", defaultValue: 0 }) { gtfsId @@ -144,7 +144,7 @@ const containerComponent = createFragmentContainer(StopsNearYouMapWithStores, { } `, vehicleStations: graphql` - fragment StopsNearYouFavoritesMapContainer_vehicleStations on VehicleRentalStation + fragment StopsNearYouFavouritesMapContainer_vehicleStations on VehicleRentalStation @relay(plural: true) { name lat @@ -156,5 +156,5 @@ const containerComponent = createFragmentContainer(StopsNearYouMapWithStores, { export { containerComponent as default, - StopsNearYouFavoritesMapContainer as Component, + StopsNearYouFavouritesMapContainer as Component, }; diff --git a/app/component/nearyou/stops-near-you.scss b/app/component/nearyou/stops-near-you.scss index e22811e969..d08825e423 100644 --- a/app/component/nearyou/stops-near-you.scss +++ b/app/component/nearyou/stops-near-you.scss @@ -143,19 +143,19 @@ } } - .no-favorites-container { + .no-favourites-container { display: flex; flex-direction: column; text-align: center; padding: 3em 2.5em; border-top: 1px solid #ddd; - .no-favorites-header { + .no-favourites-header { font-size: 0.9375em; margin-bottom: 8px; } - .no-favorites-content { + .no-favourites-content { color: #666; font-size: 0.9375em; padding: 0 2em; @@ -575,12 +575,12 @@ } } - .no-favorites-container { + .no-favourites-container { padding-top: 14px; font-size: 16px; border-top: none; - .no-favorites-content { + .no-favourites-content { padding: 0; } From ca95d578e57fdf3f9f6c3f2a18b74824da83e854 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 27 Nov 2025 15:05:46 +0200 Subject: [PATCH 008/129] chore: rename more components It does not make sense to prefix everything with 'Stop' --- ...earYouContainer.js => NearYouContainer.js} | 18 ++-- ...rYouFavourites.js => NearYouFavourites.js} | 24 ++--- ...ainer.js => NearYouFavouritesContainer.js} | 90 +++++++++---------- ...er.js => NearYouFavouritesMapContainer.js} | 20 ++--- ...{StopNearYouHeader.js => NearYouHeader.js} | 13 ++- ...MapContainer.js => NearYouMapContainer.js} | 15 ++-- app/component/nearyou/NearYouPage.js | 32 +++---- ...StopsNearYouSearch.js => NearYouSearch.js} | 10 +-- app/component/nearyou/StopNearYou.js | 4 +- 9 files changed, 106 insertions(+), 120 deletions(-) rename app/component/nearyou/{StopsNearYouContainer.js => NearYouContainer.js} (96%) rename app/component/nearyou/{StopsNearYouFavourites.js => NearYouFavourites.js} (83%) rename app/component/nearyou/{StopsNearYouFavouritesContainer.js => NearYouFavouritesContainer.js} (64%) rename app/component/nearyou/{StopsNearYouFavouritesMapContainer.js => NearYouFavouritesMapContainer.js} (84%) rename app/component/nearyou/{StopNearYouHeader.js => NearYouHeader.js} (88%) rename app/component/nearyou/{StopsNearYouMapContainer.js => NearYouMapContainer.js} (93%) rename app/component/nearyou/{StopsNearYouSearch.js => NearYouSearch.js} (92%) diff --git a/app/component/nearyou/StopsNearYouContainer.js b/app/component/nearyou/NearYouContainer.js similarity index 96% rename from app/component/nearyou/StopsNearYouContainer.js rename to app/component/nearyou/NearYouContainer.js index f40a570767..4d4a4b383c 100644 --- a/app/component/nearyou/StopsNearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -17,7 +17,7 @@ import Icon from '../Icon'; import { getDefaultNetworks } from '../../util/vehicleRentalUtils'; import DisruptionBanner from '../DisruptionBanner'; -class StopsNearYouContainer extends React.Component { +class NearYouContainer extends React.Component { static propTypes = { // eslint-disable-next-line stopPatterns: PropTypes.object, @@ -323,12 +323,10 @@ class StopsNearYouContainer extends React.Component { ); } } -const StopsNearYouContainerWithBreakpoint = withBreakpoint( - StopsNearYouContainer, -); +const NearYouContainerWithBreakpoint = withBreakpoint(NearYouContainer); const connectedContainer = connectToStores( - StopsNearYouContainerWithBreakpoint, + NearYouContainerWithBreakpoint, ['TimeStore', 'FavouriteStore'], ({ getStore }, { match }) => { const favouriteIds = @@ -354,7 +352,7 @@ const refetchContainer = createPaginationContainer( connectedContainer, { stopPatterns: graphql` - fragment StopsNearYouContainer_stopPatterns on QueryType + fragment NearYouContainer_stopPatterns on QueryType @argumentDefinitions( startTime: { type: "Long!", defaultValue: 0 } omitNonPickups: { type: "Boolean!", defaultValue: false } @@ -378,7 +376,7 @@ const refetchContainer = createPaginationContainer( maxResults: $maxResults maxDistance: $maxDistance filterByNetwork: $filterByNetwork - ) @connection(key: "StopsNearYouContainer_nearest") { + ) @connection(key: "NearYouContainer_nearest") { edges { node { distance @@ -455,7 +453,7 @@ const refetchContainer = createPaginationContainer( }; }, query: graphql` - query StopsNearYouContainerRefetchQuery( + query NearYouContainerRefetchQuery( $lat: Float! $lon: Float! $filterByPlaceTypes: [FilterPlaceType] @@ -469,7 +467,7 @@ const refetchContainer = createPaginationContainer( $filterByNetwork: [String!] ) { viewer { - ...StopsNearYouContainer_stopPatterns + ...NearYouContainer_stopPatterns @arguments( startTime: $startTime omitNonPickups: $omitNonPickups @@ -489,4 +487,4 @@ const refetchContainer = createPaginationContainer( }, ); -export { refetchContainer as default, StopsNearYouContainer as Component }; +export { refetchContainer as default, NearYouContainer as Component }; diff --git a/app/component/nearyou/StopsNearYouFavourites.js b/app/component/nearyou/NearYouFavourites.js similarity index 83% rename from app/component/nearyou/StopsNearYouFavourites.js rename to app/component/nearyou/NearYouFavourites.js index f8e5c8bab0..9bce19ce5f 100644 --- a/app/component/nearyou/StopsNearYouFavourites.js +++ b/app/component/nearyou/NearYouFavourites.js @@ -9,11 +9,11 @@ import { stationShape, vehicleRentalStationShape, } from '../../util/shapes'; -import StopsNearYouFavouritesContainer from './StopsNearYouFavouritesContainer'; +import NearYouFavouritesContainer from './NearYouFavouritesContainer'; import withBreakpoint from '../../util/withBreakpoint'; import Loading from '../Loading'; -function StopsNearYouFavourites({ +function NearYouFavourites({ favouriteStops, favouriteStations, favouriteVehicleRentalStationIds, @@ -48,21 +48,21 @@ function StopsNearYouFavourites({ return ( { if (props) { return ( - ); } -StopsNearYouFavourites.propTypes = { +NearYouFavourites.propTypes = { favouriteStops: PropTypes.arrayOf(PropTypes.string), favouriteStations: PropTypes.arrayOf(PropTypes.string), favouriteVehicleRentalStationIds: PropTypes.arrayOf(PropTypes.string), @@ -103,7 +103,7 @@ StopsNearYouFavourites.propTypes = { isParentTabActive: PropTypes.bool, }; -StopsNearYouFavourites.defaultProps = { +NearYouFavourites.defaultProps = { favouriteStops: undefined, favouriteStations: undefined, favouriteVehicleRentalStationIds: undefined, @@ -115,12 +115,12 @@ StopsNearYouFavourites.defaultProps = { isParentTabActive: false, }; -const StopsNearYouFavouritesWithBreakpoint = withBreakpoint(props => ( +const NearYouFavouritesWithBreakpoint = withBreakpoint(props => ( {({ environment }) => ( - + )} )); -export default StopsNearYouFavouritesWithBreakpoint; +export default NearYouFavouritesWithBreakpoint; diff --git a/app/component/nearyou/StopsNearYouFavouritesContainer.js b/app/component/nearyou/NearYouFavouritesContainer.js similarity index 64% rename from app/component/nearyou/StopsNearYouFavouritesContainer.js rename to app/component/nearyou/NearYouFavouritesContainer.js index 3cc9f00daa..96fb73ea74 100644 --- a/app/component/nearyou/StopsNearYouFavouritesContainer.js +++ b/app/component/nearyou/NearYouFavouritesContainer.js @@ -11,7 +11,7 @@ import { import StopNearYouContainer from './StopNearYouContainer'; import VehicleRentalStationNearYou from './VehicleRentalStationNearYou'; -function StopsNearYouFavouritesContainer({ +function NearYouFavouritesContainer({ stops, stations, vehicleStations, @@ -74,7 +74,7 @@ function StopsNearYouFavouritesContainer({ return stopElements; } -StopsNearYouFavouritesContainer.propTypes = { +NearYouFavouritesContainer.propTypes = { stops: PropTypes.arrayOf(stopShape), stations: PropTypes.arrayOf(stationShape), vehicleStations: PropTypes.arrayOf(vehicleRentalStationShape), @@ -82,55 +82,47 @@ StopsNearYouFavouritesContainer.propTypes = { isParentTabActive: PropTypes.bool, }; -const refetchContainer = createFragmentContainer( - StopsNearYouFavouritesContainer, - { - stops: graphql` - fragment StopsNearYouFavouritesContainer_stops on Stop - @relay(plural: true) { - ...StopNearYouContainer_stop +const refetchContainer = createFragmentContainer(NearYouFavouritesContainer, { + stops: graphql` + fragment NearYouFavouritesContainer_stops on Stop @relay(plural: true) { + ...StopNearYouContainer_stop + gtfsId + lat + lon + } + `, + stations: graphql` + fragment NearYouFavouritesContainer_stations on Stop @relay(plural: true) { + ...StopNearYouContainer_stop + gtfsId + lat + lon + stops { gtfsId - lat - lon + desc } - `, - stations: graphql` - fragment StopsNearYouFavouritesContainer_stations on Stop - @relay(plural: true) { - ...StopNearYouContainer_stop - gtfsId - lat - lon - stops { - gtfsId - desc - } + } + `, + vehicleStations: graphql` + fragment NearYouFavouritesContainer_vehicleStations on VehicleRentalStation + @relay(plural: true) { + stationId + name + availableVehicles { + total } - `, - vehicleStations: graphql` - fragment StopsNearYouFavouritesContainer_vehicleStations on VehicleRentalStation - @relay(plural: true) { - stationId - name - availableVehicles { - total - } - availableSpaces { - total - } - capacity - rentalNetwork { - networkId - } - lat - lon - operative + availableSpaces { + total } - `, - }, -); + capacity + rentalNetwork { + networkId + } + lat + lon + operative + } + `, +}); -export { - refetchContainer as default, - StopsNearYouFavouritesContainer as Component, -}; +export { refetchContainer as default, NearYouFavouritesContainer as Component }; diff --git a/app/component/nearyou/StopsNearYouFavouritesMapContainer.js b/app/component/nearyou/NearYouFavouritesMapContainer.js similarity index 84% rename from app/component/nearyou/StopsNearYouFavouritesMapContainer.js rename to app/component/nearyou/NearYouFavouritesMapContainer.js index 6c040a4b47..2b7aa1d57d 100644 --- a/app/component/nearyou/StopsNearYouFavouritesMapContainer.js +++ b/app/component/nearyou/NearYouFavouritesMapContainer.js @@ -13,7 +13,7 @@ import { locationShape, } from '../../util/shapes'; -function StopsNearYouFavouritesMapContainer(props) { +function NearYouFavouritesMapContainer(props) { const { stops, stations, vehicleStations, position } = props; const stopList = []; stopList.push( @@ -68,21 +68,21 @@ function StopsNearYouFavouritesMapContainer(props) { return ; } -StopsNearYouFavouritesMapContainer.propTypes = { +NearYouFavouritesMapContainer.propTypes = { stops: PropTypes.arrayOf(stopShape), stations: PropTypes.arrayOf(stationShape), vehicleStations: PropTypes.arrayOf(vehicleRentalStationShape), position: locationShape.isRequired, }; -StopsNearYouFavouritesMapContainer.defaultProps = { +NearYouFavouritesMapContainer.defaultProps = { stops: undefined, stations: undefined, vehicleStations: undefined, }; -const StopsNearYouMapWithStores = connectToStores( - StopsNearYouFavouritesMapContainer, +const NearYouMapWithStores = connectToStores( + NearYouFavouritesMapContainer, [PreferencesStore, FavouriteStore], ({ getStore }) => { const language = getStore(PreferencesStore).getLanguage(); @@ -90,9 +90,9 @@ const StopsNearYouMapWithStores = connectToStores( }, ); -const containerComponent = createFragmentContainer(StopsNearYouMapWithStores, { +const containerComponent = createFragmentContainer(NearYouMapWithStores, { stops: graphql` - fragment StopsNearYouFavouritesMapContainer_stops on Stop + fragment NearYouFavouritesMapContainer_stops on Stop @relay(plural: true) @argumentDefinitions(startTime: { type: "Long!", defaultValue: 0 }) { gtfsId @@ -117,7 +117,7 @@ const containerComponent = createFragmentContainer(StopsNearYouMapWithStores, { } `, stations: graphql` - fragment StopsNearYouFavouritesMapContainer_stations on Stop + fragment NearYouFavouritesMapContainer_stations on Stop @relay(plural: true) @argumentDefinitions(startTime: { type: "Long!", defaultValue: 0 }) { gtfsId @@ -144,7 +144,7 @@ const containerComponent = createFragmentContainer(StopsNearYouMapWithStores, { } `, vehicleStations: graphql` - fragment StopsNearYouFavouritesMapContainer_vehicleStations on VehicleRentalStation + fragment NearYouFavouritesMapContainer_vehicleStations on VehicleRentalStation @relay(plural: true) { name lat @@ -156,5 +156,5 @@ const containerComponent = createFragmentContainer(StopsNearYouMapWithStores, { export { containerComponent as default, - StopsNearYouFavouritesMapContainer as Component, + NearYouFavouritesMapContainer as Component, }; diff --git a/app/component/nearyou/StopNearYouHeader.js b/app/component/nearyou/NearYouHeader.js similarity index 88% rename from app/component/nearyou/StopNearYouHeader.js rename to app/component/nearyou/NearYouHeader.js index 54b8d2ca29..f27eeca622 100644 --- a/app/component/nearyou/StopNearYouHeader.js +++ b/app/component/nearyou/NearYouHeader.js @@ -8,10 +8,7 @@ import PlatformNumber from '../PlatformNumber'; import FavouriteStopContainer from '../FavouriteStopContainer'; import { getZoneLabel } from '../../util/legUtils'; -const StopNearYouHeader = ( - { stop, desc, isStation, linkAddress }, - { config }, -) => { +const NearYouHeader = ({ stop, desc, isStation, linkAddress }, { config }) => { const zoneId = isStation && stop.stops.length ? stop.stops[0].zoneId : stop.zoneId; return ( @@ -52,20 +49,20 @@ const StopNearYouHeader = ( ); }; -StopNearYouHeader.propTypes = { +NearYouHeader.propTypes = { stop: stopShape.isRequired, linkAddress: PropTypes.string.isRequired, desc: PropTypes.string, isStation: PropTypes.bool, }; -StopNearYouHeader.defaultProps = { +NearYouHeader.defaultProps = { isStation: false, desc: undefined, }; -StopNearYouHeader.contextTypes = { +NearYouHeader.contextTypes = { config: configShape.isRequired, }; -export default StopNearYouHeader; +export default NearYouHeader; diff --git a/app/component/nearyou/StopsNearYouMapContainer.js b/app/component/nearyou/NearYouMapContainer.js similarity index 93% rename from app/component/nearyou/StopsNearYouMapContainer.js rename to app/component/nearyou/NearYouMapContainer.js index c0f38314c7..9ece3bffc9 100644 --- a/app/component/nearyou/StopsNearYouMapContainer.js +++ b/app/component/nearyou/NearYouMapContainer.js @@ -1,11 +1,10 @@ import connectToStores from 'fluxible-addons-react/connectToStores'; import { graphql, createPaginationContainer } from 'react-relay'; import NearYouMap from '../map/NearYouMap'; - import FavouriteStore from '../../store/FavouriteStore'; import PreferencesStore from '../../store/PreferencesStore'; -const StopsNearYouMapWithStores = connectToStores( +const NearYouMapWithStores = connectToStores( NearYouMap, [PreferencesStore, FavouriteStore], ({ getStore }, { match }) => { @@ -30,10 +29,10 @@ const StopsNearYouMapWithStores = connectToStores( ); const containerComponent = createPaginationContainer( - StopsNearYouMapWithStores, + NearYouMapWithStores, { stopsNearYou: graphql` - fragment StopsNearYouMapContainer_stopsNearYou on QueryType + fragment NearYouMapContainer_stopsNearYou on QueryType @argumentDefinitions( startTime: { type: "Long!", defaultValue: 0 } omitNonPickups: { type: "Boolean!", defaultValue: false } @@ -57,7 +56,7 @@ const containerComponent = createPaginationContainer( maxResults: $maxResults maxDistance: $maxDistance filterByNetwork: $filterByNetwork - ) @connection(key: "StopsNearYouMapContainer_nearest") { + ) @connection(key: "NearYouMapContainer_nearest") { edges { node { distance @@ -119,7 +118,7 @@ const containerComponent = createPaginationContainer( } `, prioritizedStopsNearYou: graphql` - fragment StopsNearYouMapContainer_prioritizedStopsNearYou on Stop + fragment NearYouMapContainer_prioritizedStopsNearYou on Stop @relay(plural: true) { gtfsId lat @@ -177,7 +176,7 @@ const containerComponent = createPaginationContainer( }; }, query: graphql` - query StopsNearYouMapContainerRefetchQuery( + query NearYouMapContainerRefetchQuery( $lat: Float! $lon: Float! $filterByPlaceTypes: [FilterPlaceType] @@ -191,7 +190,7 @@ const containerComponent = createPaginationContainer( $filterByNetwork: [String!] ) { viewer { - ...StopsNearYouMapContainer_stopsNearYou + ...NearYouMapContainer_stopsNearYou @arguments( startTime: $startTime omitNonPickups: $omitNonPickups diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 6eb2e14500..6176132800 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -22,7 +22,7 @@ import { checkPositioningPermission, startLocationWatch, } from '../../action/PositionActions'; -import StopsNearYouSearch from './StopsNearYouSearch'; +import NearYouSearch from './NearYouSearch'; import { getGeolocationState, getReadMessageIds, @@ -33,11 +33,11 @@ import { getLocationSearchTargets, } from '../WithSearchContext'; import { PREFIX_NEARYOU } from '../../util/path'; -import StopsNearYouContainer from './StopsNearYouContainer'; +import NearYouContainer from './NearYouContainer'; import SwipeableTabs from '../SwipeableTabs'; -import StopsNearYouFavourites from './StopsNearYouFavourites'; -import StopsNearYouMapContainer from './StopsNearYouMapContainer'; -import StopsNearYouFavouritesMapContainer from './StopsNearYouFavouritesMapContainer'; +import NearYouFavourites from './NearYouFavourites'; +import NearYouMapContainer from './NearYouMapContainer'; +import NearYouFavouritesMapContainer from './NearYouFavouritesMapContainer'; import { mapLayerShape } from '../../store/MapLayerStore'; import { getRentalNetworkConfig, @@ -406,7 +406,7 @@ class NearYouPage extends React.Component { > {renderRefetchButton && this.refetchButton()} {this.props.favouritesFetched ? ( - {renderSearch && ( - )} {props && ( - { if (props) { return ( - { return ( -
- Date: Thu, 27 Nov 2025 18:59:42 +0200 Subject: [PATCH 009/129] fix: remove invalid param from executeAction --- app/component/map/NearYouMap.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/component/map/NearYouMap.js b/app/component/map/NearYouMap.js index 71690b963e..adc1458722 100644 --- a/app/component/map/NearYouMap.js +++ b/app/component/map/NearYouMap.js @@ -80,19 +80,21 @@ const startClient = (context, routes) => { context.executeAction(startRealTimeClient, config); } }; + const stopClient = context => { const { client } = context.getStore('RealTimeInformationStore'); if (client) { context.executeAction(stopRealTimeClient, client); } }; + const updateClient = (context, topics) => { const { client } = context.getStore('RealTimeInformationStore'); const config = getRealTimeSettings(topics, context); if (config) { - config.client = client; if (client) { - context.executeAction(changeRealTimeClientTopics, config, client); + config.client = client; + context.executeAction(changeRealTimeClientTopics, config); } } }; From 80003b3949697004e3b7e7cf2f1a210ba0f2651b Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 28 Nov 2025 07:33:00 +0200 Subject: [PATCH 010/129] fix: strange double expression --- app/component/DepartureRow.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/component/DepartureRow.js b/app/component/DepartureRow.js index 64db196dc0..b257d0c864 100644 --- a/app/component/DepartureRow.js +++ b/app/component/DepartureRow.js @@ -182,7 +182,7 @@ export default function DepartureRow(
- {headsign} {departure.bottomRow && departure.bottomRow} + {headsign} {departure.bottomRow}
From 10e9de3cfd605f7d16a4e1857f292cbae31bb1d9 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 28 Nov 2025 08:21:49 +0200 Subject: [PATCH 011/129] fix: various update bugs Pass consistent currentTime and tab activation props to child components. --- app/component/nearyou/NearYouContainer.js | 5 ++--- app/component/nearyou/NearYouFavourites.js | 3 +++ .../nearyou/NearYouFavouritesContainer.js | 13 ++++++++++-- app/component/nearyou/NearYouPage.js | 14 +++++++++++-- app/component/nearyou/StopNearYou.js | 21 ++++--------------- .../nearyou/VehicleRentalStationNearYou.js | 10 ++++----- 6 files changed, 37 insertions(+), 29 deletions(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index 4d4a4b383c..3a5e8942ff 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -226,7 +226,7 @@ class NearYouContainer extends React.Component { ); @@ -238,9 +238,8 @@ class NearYouContainer extends React.Component { ); default: diff --git a/app/component/nearyou/NearYouFavourites.js b/app/component/nearyou/NearYouFavourites.js index 9bce19ce5f..3f9ac971e5 100644 --- a/app/component/nearyou/NearYouFavourites.js +++ b/app/component/nearyou/NearYouFavourites.js @@ -22,6 +22,7 @@ function NearYouFavourites({ breakpoint, noFavourites, isParentTabActive, + currentTime, }) { if (noFavourites) { return ( @@ -81,6 +82,7 @@ function NearYouFavourites({ stations={props.stations} vehicleStations={props.vehicleStations} isParentTabActive={isParentTabActive} + currentTime={currentTime} /> ); } @@ -101,6 +103,7 @@ NearYouFavourites.propTypes = { breakpoint: PropTypes.string, noFavourites: PropTypes.bool, isParentTabActive: PropTypes.bool, + currentTime: PropTypes.number.isRequired, }; NearYouFavourites.defaultProps = { diff --git a/app/component/nearyou/NearYouFavouritesContainer.js b/app/component/nearyou/NearYouFavouritesContainer.js index 96fb73ea74..5b7f682eeb 100644 --- a/app/component/nearyou/NearYouFavouritesContainer.js +++ b/app/component/nearyou/NearYouFavouritesContainer.js @@ -17,6 +17,7 @@ function NearYouFavouritesContainer({ vehicleStations, searchPosition, isParentTabActive, + currentTime, }) { const stopList = []; stopList.push( @@ -61,12 +62,19 @@ function NearYouFavouritesContainer({ ); case 'vehicleRentalStation': - return ; + return ( + + ); default: return null; } @@ -80,6 +88,7 @@ NearYouFavouritesContainer.propTypes = { vehicleStations: PropTypes.arrayOf(vehicleRentalStationShape), searchPosition: locationShape, isParentTabActive: PropTypes.bool, + currentTime: PropTypes.number.isRequired, }; const refetchContainer = createFragmentContainer(NearYouFavouritesContainer, { diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 6176132800..c98b2f5aca 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -97,6 +97,7 @@ class NearYouPage extends React.Component { favouriteVehicleStationIds: PropTypes.arrayOf(PropTypes.string), mapLayers: mapLayerShape.isRequired, favouritesFetched: PropTypes.bool, + currentTime: PropTypes.number.isRequired, }; static defaultProps = { @@ -416,6 +417,7 @@ class NearYouPage extends React.Component { } noFavourites={noFavs} isParentTabActive={isActive} + currentTime={this.props.currentTime} /> ) : ( @@ -591,7 +593,7 @@ class NearYouPage extends React.Component { ); @@ -619,6 +621,7 @@ class NearYouPage extends React.Component { nearByStopMode={nearByStopMode} renderDisruptionBanner={renderDisruptionBanner} isParentTabActive={isActive} + currentTime={this.props.currentTime} /> )}
@@ -963,7 +966,13 @@ const NearYouPageWithBreakpoint = withBreakpoint(props => ( const PositioningWrapper = connectToStores( NearYouPageWithBreakpoint, - ['PositionStore', 'PreferencesStore', 'FavouriteStore', 'MapLayerStore'], + [ + 'PositionStore', + 'PreferencesStore', + 'FavouriteStore', + 'MapLayerStore', + 'TimeStore', + ], (context, props) => { const favouriteStopIds = context .getStore('FavouriteStore') @@ -985,6 +994,7 @@ const PositioningWrapper = connectToStores( const status = context.getStore('FavouriteStore').getStatus(); return { ...props, + currentTime: context.getStore('TimeStore').getCurrentTime(), position: context.getStore('PositionStore').getLocationState(), lang: context.getStore('PreferencesStore').getLanguage(), mapLayers: context diff --git a/app/component/nearyou/StopNearYou.js b/app/component/nearyou/StopNearYou.js index 484562bb28..4fe0badd57 100644 --- a/app/component/nearyou/StopNearYou.js +++ b/app/component/nearyou/StopNearYou.js @@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage, intlShape } from 'react-intl'; import { Link } from 'found'; -import connectToStores from 'fluxible-addons-react/connectToStores'; import Modal from '@hsl-fi/modal'; import { stopShape, configShape, relayShape } from '../../util/shapes'; import { hasEntitiesOfType } from '../../util/alertUtils'; @@ -14,7 +13,7 @@ import StopNearYouDepartureRowContainer from './StopNearYouDepartureRowContainer import CapacityModal from '../CapacityModal'; const StopNearYou = ( - { stop, desc, stopId, currentTime, currentMode, relay, isParentTabActive }, + { stop, desc, stopId, currentTime, relay, isParentTabActive }, { config, intl }, ) => { if (!stop.stoptimesWithoutPatterns) { @@ -29,12 +28,12 @@ const StopNearYou = ( if (stopId) { id = stopId; } - if (currentMode === stopMode || !currentMode) { + if (isParentTabActive) { relay?.refetch(oldVariables => { return { ...oldVariables, stopId: id, startTime: currentTime }; }, null); } - }, [currentTime, currentMode]); + }, [currentTime, isParentTabActive]); const description = desc || stop.desc; const isStation = stop.locationType === 'STATION'; @@ -119,22 +118,10 @@ const StopNearYou = ( ); }; -const connectedComponent = connectToStores( - StopNearYou, - ['TimeStore'], - (context, props) => { - return { - ...props, - currentTime: context.getStore('TimeStore').getCurrentTime(), - }; - }, -); - StopNearYou.propTypes = { stop: stopShape.isRequired, stopId: PropTypes.string, currentTime: PropTypes.number.isRequired, - currentMode: PropTypes.string.isRequired, desc: PropTypes.string, relay: relayShape, isParentTabActive: PropTypes.bool, @@ -152,4 +139,4 @@ StopNearYou.contextTypes = { intl: intlShape.isRequired, }; -export default connectedComponent; +export default StopNearYou; diff --git a/app/component/nearyou/VehicleRentalStationNearYou.js b/app/component/nearyou/VehicleRentalStationNearYou.js index 560c7def59..8a62eb5971 100644 --- a/app/component/nearyou/VehicleRentalStationNearYou.js +++ b/app/component/nearyou/VehicleRentalStationNearYou.js @@ -15,11 +15,11 @@ const VehicleRentalStationNearYou = ({ stop, relay, currentTime, - currentMode, + isParentTabActive, }) => { useEffect(() => { const { stationId } = stop; - if (currentMode === 'CITYBIKE') { + if (isParentTabActive) { relay?.refetch( oldVariables => { return { ...oldVariables, stopId: stationId }; @@ -29,7 +29,7 @@ const VehicleRentalStationNearYou = ({ { force: true }, // query variables stay the same between refetches ); } - }, [currentTime]); + }, [currentTime, isParentTabActive]); return (
@@ -86,13 +86,13 @@ VehicleRentalStationNearYou.propTypes = { availableSpaces: PropTypes.shape({ total: PropTypes.number }), }).isRequired, currentTime: PropTypes.number, - currentMode: PropTypes.string, + isParentTabActive: PropTypes.bool, relay: relayShape.isRequired, }; VehicleRentalStationNearYou.defaultProps = { currentTime: undefined, - currentMode: undefined, + isParentTabActive: false, }; const containerComponent = createRefetchContainer( From 4bc76abd874435df5e64c91c76888b27a0266e69 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 28 Nov 2025 08:43:54 +0200 Subject: [PATCH 012/129] fix: NearYouFavouritesMapContainer props --- app/component/nearyou/NearYouFavouritesMapContainer.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/component/nearyou/NearYouFavouritesMapContainer.js b/app/component/nearyou/NearYouFavouritesMapContainer.js index 2b7aa1d57d..ebc8fb44a7 100644 --- a/app/component/nearyou/NearYouFavouritesMapContainer.js +++ b/app/component/nearyou/NearYouFavouritesMapContainer.js @@ -69,16 +69,14 @@ function NearYouFavouritesMapContainer(props) { } NearYouFavouritesMapContainer.propTypes = { - stops: PropTypes.arrayOf(stopShape), - stations: PropTypes.arrayOf(stationShape), + stops: PropTypes.arrayOf(stopShape).isRequired, + stations: PropTypes.arrayOf(stationShape).isRequired, vehicleStations: PropTypes.arrayOf(vehicleRentalStationShape), position: locationShape.isRequired, }; NearYouFavouritesMapContainer.defaultProps = { - stops: undefined, - stations: undefined, - vehicleStations: undefined, + vehicleStations: null, }; const NearYouMapWithStores = connectToStores( From 09aec9e5e8065c1a138e84801add35c794b20d17 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 28 Nov 2025 09:24:40 +0200 Subject: [PATCH 013/129] fix: hundreds of relay warnings caused by missing vehicle rental station fragment --- app/component/nearyou/NearYouContainer.js | 2 +- app/component/nearyou/NearYouFavouritesContainer.js | 1 + app/component/nearyou/VehicleRentalStationNearYou.js | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index 3a5e8942ff..cbf45152f9 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -382,7 +382,7 @@ const refetchContainer = createPaginationContainer( place { __typename ... on VehicleRentalStation { - ...VehicleRentalStationNearYou_stop + ...VehicleRentalStationNearYou_station stationId rentalNetwork { networkId diff --git a/app/component/nearyou/NearYouFavouritesContainer.js b/app/component/nearyou/NearYouFavouritesContainer.js index 5b7f682eeb..9c8db186f8 100644 --- a/app/component/nearyou/NearYouFavouritesContainer.js +++ b/app/component/nearyou/NearYouFavouritesContainer.js @@ -115,6 +115,7 @@ const refetchContainer = createFragmentContainer(NearYouFavouritesContainer, { vehicleStations: graphql` fragment NearYouFavouritesContainer_vehicleStations on VehicleRentalStation @relay(plural: true) { + ...VehicleRentalStationNearYou_station stationId name availableVehicles { diff --git a/app/component/nearyou/VehicleRentalStationNearYou.js b/app/component/nearyou/VehicleRentalStationNearYou.js index 8a62eb5971..210f55bd3e 100644 --- a/app/component/nearyou/VehicleRentalStationNearYou.js +++ b/app/component/nearyou/VehicleRentalStationNearYou.js @@ -99,7 +99,7 @@ const containerComponent = createRefetchContainer( VehicleRentalStationNearYou, { stop: graphql` - fragment VehicleRentalStationNearYou_stop on VehicleRentalStation { + fragment VehicleRentalStationNearYou_station on VehicleRentalStation { stationId name availableVehicles { @@ -119,7 +119,7 @@ const containerComponent = createRefetchContainer( graphql` query VehicleRentalStationNearYouRefetchQuery($stopId: String!) { vehicleRentalStation(id: $stopId) { - ...VehicleRentalStationNearYou_stop + ...VehicleRentalStationNearYou_station } } `, From 2ce8c71b142325a28a45b76be7c4748a2aab6068 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 28 Nov 2025 11:07:44 +0200 Subject: [PATCH 014/129] fix: favourite vehicle rental station prop name errors --- .../nearyou/NearYouFavouritesMapContainer.js | 31 +++++++++---------- app/component/nearyou/NearYouPage.js | 2 +- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/app/component/nearyou/NearYouFavouritesMapContainer.js b/app/component/nearyou/NearYouFavouritesMapContainer.js index ebc8fb44a7..78fb168cf2 100644 --- a/app/component/nearyou/NearYouFavouritesMapContainer.js +++ b/app/component/nearyou/NearYouFavouritesMapContainer.js @@ -46,23 +46,22 @@ function NearYouFavouritesMapContainer(props) { }; }), ); - if (vehicleStations) { - stopList.push( - ...vehicleStations - .filter(s => s) - .map(stop => { - return { - type: 'vehicleRentalStation', - node: { - distance: distance(position, stop), - place: { - ...stop, - }, + stopList.push( + ...vehicleStations + .filter(s => s) + .map(stop => { + return { + type: 'vehicleRentalStation', + node: { + distance: distance(position, stop), + place: { + ...stop, }, - }; - }), - ); - } + }, + }; + }), + ); + stopList.sort((a, b) => a.node.distance - b.node.distance); return ; diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index c98b2f5aca..92bd4a5350 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -693,7 +693,7 @@ class NearYouPage extends React.Component { stops={props.stops} mapLayers={this.props.mapLayers} stations={props.stations} - bikeStations={props.bikeStations} + vehicleStations={props.vehicleStations} favouriteIds={[ ...this.props.favouriteStopIds, ...this.props.favouriteStationIds, From 15af1ea93be6e6953e881d6c8abac9ca1b66fe01 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 28 Nov 2025 11:45:15 +0200 Subject: [PATCH 015/129] chore: remove fake props --- app/component/nearyou/NearYouFavourites.js | 39 ++++++---------------- app/component/nearyou/NearYouPage.js | 9 ++--- 2 files changed, 14 insertions(+), 34 deletions(-) diff --git a/app/component/nearyou/NearYouFavourites.js b/app/component/nearyou/NearYouFavourites.js index 3f9ac971e5..157d93aa84 100644 --- a/app/component/nearyou/NearYouFavourites.js +++ b/app/component/nearyou/NearYouFavourites.js @@ -2,21 +2,15 @@ import PropTypes from 'prop-types'; import React from 'react'; import { graphql, QueryRenderer, ReactRelayContext } from 'react-relay'; import { FormattedMessage } from 'react-intl'; -import { - locationShape, - relayShape, - stopShape, - stationShape, - vehicleRentalStationShape, -} from '../../util/shapes'; +import { locationShape, relayShape } from '../../util/shapes'; import NearYouFavouritesContainer from './NearYouFavouritesContainer'; import withBreakpoint from '../../util/withBreakpoint'; import Loading from '../Loading'; function NearYouFavourites({ - favouriteStops, - favouriteStations, - favouriteVehicleRentalStationIds, + stopIds, + stationIds, + vehicleRentalStationIds, relayEnvironment, searchPosition, breakpoint, @@ -68,9 +62,9 @@ function NearYouFavourites({ } `} variables={{ - stopIds: favouriteStops || [], - stationIds: favouriteStations || [], - vehicleRentalStationIds: favouriteVehicleRentalStationIds || [], + stopIds: stopIds || [], + stationIds: stationIds || [], + vehicleRentalStationIds: vehicleRentalStationIds || [], }} environment={relayEnvironment} render={({ props }) => { @@ -78,11 +72,9 @@ function NearYouFavourites({ return ( ); } @@ -92,14 +84,11 @@ function NearYouFavourites({ ); } NearYouFavourites.propTypes = { - favouriteStops: PropTypes.arrayOf(PropTypes.string), - favouriteStations: PropTypes.arrayOf(PropTypes.string), - favouriteVehicleRentalStationIds: PropTypes.arrayOf(PropTypes.string), + stopIds: PropTypes.arrayOf(PropTypes.string).isRequired, + stationIds: PropTypes.arrayOf(PropTypes.string).isRequired, + vehicleRentalStationIds: PropTypes.arrayOf(PropTypes.string).isRequired, relayEnvironment: relayShape.isRequired, searchPosition: locationShape.isRequired, - stops: PropTypes.arrayOf(stopShape), - stations: PropTypes.arrayOf(stationShape), - vehicleStations: PropTypes.arrayOf(vehicleRentalStationShape), breakpoint: PropTypes.string, noFavourites: PropTypes.bool, isParentTabActive: PropTypes.bool, @@ -107,12 +96,6 @@ NearYouFavourites.propTypes = { }; NearYouFavourites.defaultProps = { - favouriteStops: undefined, - favouriteStations: undefined, - favouriteVehicleRentalStationIds: undefined, - stops: undefined, - stations: undefined, - vehicleStations: undefined, breakpoint: undefined, noFavourites: false, isParentTabActive: false, diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 92bd4a5350..f2bca23297 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -408,13 +408,10 @@ class NearYouPage extends React.Component { {renderRefetchButton && this.refetchButton()} {this.props.favouritesFetched ? ( Date: Fri, 28 Nov 2025 12:04:00 +0200 Subject: [PATCH 016/129] fix: remove useless connection with 2 stores --- .../nearyou/NearYouFavouritesMapContainer.js | 117 ++++++++---------- 1 file changed, 52 insertions(+), 65 deletions(-) diff --git a/app/component/nearyou/NearYouFavouritesMapContainer.js b/app/component/nearyou/NearYouFavouritesMapContainer.js index 78fb168cf2..6bc33790da 100644 --- a/app/component/nearyou/NearYouFavouritesMapContainer.js +++ b/app/component/nearyou/NearYouFavouritesMapContainer.js @@ -1,11 +1,8 @@ import PropTypes from 'prop-types'; import React from 'react'; -import connectToStores from 'fluxible-addons-react/connectToStores'; import { graphql, createFragmentContainer } from 'react-relay'; import distance from '@digitransit-search-util/digitransit-search-util-distance'; import NearYouMap from '../map/NearYouMap'; -import PreferencesStore from '../../store/PreferencesStore'; -import FavouriteStore from '../../store/FavouriteStore'; import { vehicleRentalStationShape, stopShape, @@ -70,58 +67,21 @@ function NearYouFavouritesMapContainer(props) { NearYouFavouritesMapContainer.propTypes = { stops: PropTypes.arrayOf(stopShape).isRequired, stations: PropTypes.arrayOf(stationShape).isRequired, - vehicleStations: PropTypes.arrayOf(vehicleRentalStationShape), + vehicleStations: PropTypes.arrayOf(vehicleRentalStationShape).isRequired, position: locationShape.isRequired, }; -NearYouFavouritesMapContainer.defaultProps = { - vehicleStations: null, -}; - -const NearYouMapWithStores = connectToStores( +const containerComponent = createFragmentContainer( NearYouFavouritesMapContainer, - [PreferencesStore, FavouriteStore], - ({ getStore }) => { - const language = getStore(PreferencesStore).getLanguage(); - return { language }; - }, -); - -const containerComponent = createFragmentContainer(NearYouMapWithStores, { - stops: graphql` - fragment NearYouFavouritesMapContainer_stops on Stop - @relay(plural: true) - @argumentDefinitions(startTime: { type: "Long!", defaultValue: 0 }) { - gtfsId - lat - lon - name - patterns { - route { - gtfsId - shortName - mode - } - code - directionId - patternGeometry { - points - } - } - stoptimesWithoutPatterns(startTime: $startTime, omitNonPickups: true) { - scheduledArrival - } - } - `, - stations: graphql` - fragment NearYouFavouritesMapContainer_stations on Stop - @relay(plural: true) - @argumentDefinitions(startTime: { type: "Long!", defaultValue: 0 }) { - gtfsId - lat - lon - name - stops { + { + stops: graphql` + fragment NearYouFavouritesMapContainer_stops on Stop + @relay(plural: true) + @argumentDefinitions(startTime: { type: "Long!", defaultValue: 0 }) { + gtfsId + lat + lon + name patterns { route { gtfsId @@ -134,22 +94,49 @@ const containerComponent = createFragmentContainer(NearYouMapWithStores, { points } } + stoptimesWithoutPatterns(startTime: $startTime, omitNonPickups: true) { + scheduledArrival + } + } + `, + stations: graphql` + fragment NearYouFavouritesMapContainer_stations on Stop + @relay(plural: true) + @argumentDefinitions(startTime: { type: "Long!", defaultValue: 0 }) { + gtfsId + lat + lon + name + stops { + patterns { + route { + gtfsId + shortName + mode + } + code + directionId + patternGeometry { + points + } + } + } + stoptimesWithoutPatterns(startTime: $startTime, omitNonPickups: true) { + scheduledArrival + } } - stoptimesWithoutPatterns(startTime: $startTime, omitNonPickups: true) { - scheduledArrival + `, + vehicleStations: graphql` + fragment NearYouFavouritesMapContainer_vehicleStations on VehicleRentalStation + @relay(plural: true) { + name + lat + lon + stationId } - } - `, - vehicleStations: graphql` - fragment NearYouFavouritesMapContainer_vehicleStations on VehicleRentalStation - @relay(plural: true) { - name - lat - lon - stationId - } - `, -}); + `, + }, +); export { containerComponent as default, From 857d32d8475808842792f80a66e2b5f272f95633 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 28 Nov 2025 13:48:54 +0200 Subject: [PATCH 017/129] chore: remove unused prop --- app/component/map/NearYouMap.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app/component/map/NearYouMap.js b/app/component/map/NearYouMap.js index adc1458722..24594bd282 100644 --- a/app/component/map/NearYouMap.js +++ b/app/component/map/NearYouMap.js @@ -443,7 +443,6 @@ NearYouMap.propTypes = { position: locationShape.isRequired, match: matchShape.isRequired, breakpoint: PropTypes.string.isRequired, - language: PropTypes.string.isRequired, relay: relayShape.isRequired, loading: PropTypes.bool, showWalkRoute: PropTypes.bool, From 010b38da37891bc830e84070a66f06e99b4670c1 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 28 Nov 2025 13:59:20 +0200 Subject: [PATCH 018/129] chore: refactor StopNearYou - Remove fake props - reqeuire all props --- app/component/nearyou/StopNearYou.js | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/app/component/nearyou/StopNearYou.js b/app/component/nearyou/StopNearYou.js index 4fe0badd57..9076961ee7 100644 --- a/app/component/nearyou/StopNearYou.js +++ b/app/component/nearyou/StopNearYou.js @@ -13,7 +13,7 @@ import StopNearYouDepartureRowContainer from './StopNearYouDepartureRowContainer import CapacityModal from '../CapacityModal'; const StopNearYou = ( - { stop, desc, stopId, currentTime, relay, isParentTabActive }, + { stop, currentTime, relay, isParentTabActive }, { config, intl }, ) => { if (!stop.stoptimesWithoutPatterns) { @@ -24,33 +24,28 @@ const StopNearYou = ( const { gtfsId } = stop; useEffect(() => { - let id = gtfsId; - if (stopId) { - id = stopId; - } if (isParentTabActive) { - relay?.refetch(oldVariables => { - return { ...oldVariables, stopId: id, startTime: currentTime }; + relay.refetch(oldVariables => { + return { ...oldVariables, stopId: gtfsId, startTime: currentTime }; }, null); } }, [currentTime, isParentTabActive]); - const description = desc || stop.desc; const isStation = stop.locationType === 'STATION'; const linkAddress = stopPagePath(isStation, gtfsId, PREFIX_DISRUPTION); - const { constantOperationStops } = config; const { locale } = intl; const isConstantOperation = constantOperationStops[gtfsId]; const filteredAlerts = stop.alerts.filter(alert => hasEntitiesOfType(alert, AlertEntityType.Stop), ); + return (
@@ -120,18 +115,9 @@ const StopNearYou = ( StopNearYou.propTypes = { stop: stopShape.isRequired, - stopId: PropTypes.string, currentTime: PropTypes.number.isRequired, - desc: PropTypes.string, - relay: relayShape, - isParentTabActive: PropTypes.bool, -}; - -StopNearYou.defaultProps = { - stopId: undefined, - desc: undefined, - relay: undefined, - isParentTabActive: false, + relay: relayShape.isRequired, + isParentTabActive: PropTypes.bool.isRequired, }; StopNearYou.contextTypes = { From 84cc1236be781305758022b32f8c630cf0fbe7c3 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 28 Nov 2025 14:14:49 +0200 Subject: [PATCH 019/129] chore: refactor VehicleRentalStationNearYou --- app/component/nearyou/NearYouContainer.js | 2 +- .../nearyou/NearYouFavouritesContainer.js | 2 +- .../nearyou/VehicleRentalStationNearYou.js | 45 +++++++------------ 3 files changed, 18 insertions(+), 31 deletions(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index cbf45152f9..b41634acde 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -237,7 +237,7 @@ class NearYouContainer extends React.Component { return ( diff --git a/app/component/nearyou/NearYouFavouritesContainer.js b/app/component/nearyou/NearYouFavouritesContainer.js index 9c8db186f8..135eeef16e 100644 --- a/app/component/nearyou/NearYouFavouritesContainer.js +++ b/app/component/nearyou/NearYouFavouritesContainer.js @@ -70,7 +70,7 @@ function NearYouFavouritesContainer({ return ( diff --git a/app/component/nearyou/VehicleRentalStationNearYou.js b/app/component/nearyou/VehicleRentalStationNearYou.js index 210f55bd3e..3b3d204f40 100644 --- a/app/component/nearyou/VehicleRentalStationNearYou.js +++ b/app/component/nearyou/VehicleRentalStationNearYou.js @@ -9,20 +9,20 @@ import { PREFIX_BIKESTATIONS } from '../../util/path'; import { isKeyboardSelectionEvent } from '../../util/browser'; import { hasVehicleRentalCode } from '../../util/vehicleRentalUtils'; import { getIdWithoutFeed } from '../../util/feedScopedIdUtils'; -import { relayShape } from '../../util/shapes'; +import { vehicleRentalStationShape, relayShape } from '../../util/shapes'; const VehicleRentalStationNearYou = ({ - stop, + station, relay, currentTime, isParentTabActive, }) => { useEffect(() => { - const { stationId } = stop; + const { stationId } = station; if (isParentTabActive) { - relay?.refetch( + relay.refetch( oldVariables => { - return { ...oldVariables, stopId: stationId }; + return { ...oldVariables, stationId }; }, null, null, @@ -44,47 +44,34 @@ const VehicleRentalStationNearYou = ({ e.stopPropagation(); } }} - to={`/${PREFIX_BIKESTATIONS}/${stop.stationId}`} + to={`/${PREFIX_BIKESTATIONS}/${station.stationId}`} > -

{stop.name}

+

{station.name}

- +
); }; + VehicleRentalStationNearYou.propTypes = { - stop: PropTypes.shape({ - capacity: PropTypes.number, - distance: PropTypes.number, - lat: PropTypes.number, - lon: PropTypes.number, - name: PropTypes.string, - rentalNetwork: PropTypes.shape({ - networkId: PropTypes.string, - }), - operative: PropTypes.bool, - stationId: PropTypes.string, - type: PropTypes.string, - availableVehicles: PropTypes.shape({ total: PropTypes.number }), - availableSpaces: PropTypes.shape({ total: PropTypes.number }), - }).isRequired, + station: vehicleRentalStationShape.isRequired, currentTime: PropTypes.number, isParentTabActive: PropTypes.bool, relay: relayShape.isRequired, @@ -98,7 +85,7 @@ VehicleRentalStationNearYou.defaultProps = { const containerComponent = createRefetchContainer( VehicleRentalStationNearYou, { - stop: graphql` + station: graphql` fragment VehicleRentalStationNearYou_station on VehicleRentalStation { stationId name @@ -117,8 +104,8 @@ const containerComponent = createRefetchContainer( `, }, graphql` - query VehicleRentalStationNearYouRefetchQuery($stopId: String!) { - vehicleRentalStation(id: $stopId) { + query VehicleRentalStationNearYouRefetchQuery($stationId: String!) { + vehicleRentalStation(id: $stationId) { ...VehicleRentalStationNearYou_station } } From 4b79ac85bc24b37b260fca5226c36b83f1f9fd7e Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Sat, 29 Nov 2025 11:22:53 +0200 Subject: [PATCH 020/129] fix: remove unnecessary store connection from NearYouContainer --- app/component/nearyou/NearYouContainer.js | 47 +++++++---------------- app/component/nearyou/NearYouPage.js | 6 ++- app/configurations/config.hsl.js | 2 +- 3 files changed, 20 insertions(+), 35 deletions(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index b41634acde..48ddb15c44 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -2,8 +2,6 @@ import PropTypes from 'prop-types'; import React from 'react'; import { createPaginationContainer, graphql } from 'react-relay'; import { intlShape, FormattedMessage } from 'react-intl'; -import connectToStores from 'fluxible-addons-react/connectToStores'; -import { matchShape } from 'found'; import { configShape, relayShape } from '../../util/shapes'; import StopNearYouContainer from './StopNearYouContainer'; import withBreakpoint from '../../util/withBreakpoint'; @@ -24,8 +22,6 @@ class NearYouContainer extends React.Component { setLoadState: PropTypes.func.isRequired, currentTime: PropTypes.number.isRequired, relay: relayShape.isRequired, - favouriteIds: PropTypes.objectOf(PropTypes.string).isRequired, - match: matchShape.isRequired, position: PropTypes.shape({ address: PropTypes.string, lat: PropTypes.number, @@ -36,6 +32,9 @@ class NearYouContainer extends React.Component { nearByStopMode: PropTypes.string.isRequired, renderDisruptionBanner: PropTypes.bool, isParentTabActive: PropTypes.bool, + favouriteStopIds: PropTypes.arrayOf(PropTypes.string).isRequired, + favouriteStationIds: PropTypes.arrayOf(PropTypes.string).isRequired, + favouriteVehicleStationIds: PropTypes.arrayOf(PropTypes.string).isRequired, }; static defaultProps = { @@ -183,14 +182,14 @@ class NearYouContainer extends React.Component { }; createNearbyStops = () => { - if (!this.props.stopPatterns || !this.props.stopPatterns.nearest) { + if (!this.props.stopPatterns?.nearest) { return null; } - const { mode } = this.props.match.params; + const mode = this.props.nearByStopMode; const walkRoutingThreshold = mode === 'RAIL' || mode === 'SUBWAY' || mode === 'FERRY' ? 3000 : 1500; const stopPatterns = this.props.stopPatterns.nearest.edges; - const isCityBikeView = this.props.match.params.mode === 'CITYBIKE'; + const isCityBikeView = this.props.nearByStopMode === 'CITYBIKE'; let sortedPatterns; if (isCityBikeView) { const withNetworks = stopPatterns.filter(pattern => { @@ -203,12 +202,16 @@ class NearYouContainer extends React.Component { }); sortedPatterns = filteredCityBikeStopPatterns .slice(0, 5) - .sort(sortNearbyRentalStations(this.props.favouriteIds)); + .sort(sortNearbyRentalStations(this.props.favouriteVehicleStationIds)); sortedPatterns.push(...filteredCityBikeStopPatterns.slice(5)); } else { + const merged = [ + ...this.props.favouriteStopIds, + ...this.props.favouriteStationIds, + ]; sortedPatterns = stopPatterns .slice(0, 5) - .sort(sortNearbyStops(this.props.favouriteIds, walkRoutingThreshold)); + .sort(sortNearbyStops(merged, walkRoutingThreshold)); sortedPatterns.push(...stopPatterns.slice(5)); } @@ -322,33 +325,11 @@ class NearYouContainer extends React.Component { ); } } -const NearYouContainerWithBreakpoint = withBreakpoint(NearYouContainer); -const connectedContainer = connectToStores( - NearYouContainerWithBreakpoint, - ['TimeStore', 'FavouriteStore'], - ({ getStore }, { match }) => { - const favouriteIds = - match.params.mode === 'CITYBIKE' - ? new Set( - getStore('FavouriteStore') - .getVehicleRentalStations() - .map(station => station.stationId), - ) - : new Set( - getStore('FavouriteStore') - .getStopsAndStations() - .map(stop => stop.gtfsId), - ); - return { - currentTime: getStore('TimeStore').getCurrentTime(), - favouriteIds, - }; - }, -); +const NearYouContainerWithBreakpoint = withBreakpoint(NearYouContainer); const refetchContainer = createPaginationContainer( - connectedContainer, + NearYouContainerWithBreakpoint, { stopPatterns: graphql` fragment NearYouContainer_stopPatterns on QueryType diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index f2bca23297..cf69a76d9f 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -611,7 +611,6 @@ class NearYouPage extends React.Component { )}
diff --git a/app/configurations/config.hsl.js b/app/configurations/config.hsl.js index b3aabbbf81..2d31cdbb80 100644 --- a/app/configurations/config.hsl.js +++ b/app/configurations/config.hsl.js @@ -470,7 +470,7 @@ export default { season: { preSeasonStart: '18.3', start: '1.4', - end: '31.10', + end: '31.11', }, capacity: BIKEAVL_WITHMAX, icon: 'citybike', From 946c8df9c007886868714450a2ba8eead44245e6 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 2 Dec 2025 16:51:02 +0200 Subject: [PATCH 021/129] fix: remove unnecessary store connections from NearYouMapContainer --- app/component/nearyou/NearYouMapContainer.js | 29 +------------------- app/component/nearyou/NearYouPage.js | 12 ++++++-- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/app/component/nearyou/NearYouMapContainer.js b/app/component/nearyou/NearYouMapContainer.js index 9ece3bffc9..ea92c32f7b 100644 --- a/app/component/nearyou/NearYouMapContainer.js +++ b/app/component/nearyou/NearYouMapContainer.js @@ -1,35 +1,8 @@ -import connectToStores from 'fluxible-addons-react/connectToStores'; import { graphql, createPaginationContainer } from 'react-relay'; import NearYouMap from '../map/NearYouMap'; -import FavouriteStore from '../../store/FavouriteStore'; -import PreferencesStore from '../../store/PreferencesStore'; - -const NearYouMapWithStores = connectToStores( - NearYouMap, - [PreferencesStore, FavouriteStore], - ({ getStore }, { match }) => { - const language = getStore(PreferencesStore).getLanguage(); - const favouriteIds = - match.params.mode === 'CITYBIKE' - ? new Set( - getStore('FavouriteStore') - .getVehicleRentalStations() - .map(station => station.stationId), - ) - : new Set( - getStore('FavouriteStore') - .getStopsAndStations() - .map(stop => stop.gtfsId), - ); - return { - language, - favouriteIds, - }; - }, -); const containerComponent = createPaginationContainer( - NearYouMapWithStores, + NearYouMap, { stopsNearYou: graphql` fragment NearYouMapContainer_stopsNearYou on QueryType diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index cf69a76d9f..1918c8e0ac 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -721,6 +721,13 @@ class NearYouPage extends React.Component { filteredMapLayers.stop[mode.toLowerCase()] = true; } } + const favouriteIds = + mode === 'CITYBIKE' + ? new Set(this.props.favouriteVehicleStationIds) + : new Set([ + ...this.props.favouriteStopIds, + ...this.props.favouriteStationIds, + ]); return ( ); }} From 8d6ed1f9a180459e9a182ef328bf5aec8a7ddafa Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 3 Dec 2025 10:18:23 +0200 Subject: [PATCH 022/129] fix: favouriteIds is required prop, code will crash without it --- app/component/map/NearYouMap.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/component/map/NearYouMap.js b/app/component/map/NearYouMap.js index 24594bd282..bb59ea1cc7 100644 --- a/app/component/map/NearYouMap.js +++ b/app/component/map/NearYouMap.js @@ -439,7 +439,7 @@ NearYouMap.propTypes = { }), prioritizedStopsNearYou: PropTypes.arrayOf(stopShape), // eslint-disable-next-line - favouriteIds: PropTypes.object, + favouriteIds: PropTypes.object.isRequired, position: locationShape.isRequired, match: matchShape.isRequired, breakpoint: PropTypes.string.isRequired, @@ -453,7 +453,6 @@ NearYouMap.defaultProps = { stopsNearYou: null, showWalkRoute: false, loading: false, - favouriteIds: undefined, setMWTRef: undefined, prioritizedStopsNearYou: [], }; From 851095c0edb9cc7c24d8d5cc02e42d74d2f169fd Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 3 Dec 2025 10:21:44 +0200 Subject: [PATCH 023/129] chore: refactor --- app/component/nearyou/NearYouMapContainer.js | 2 +- app/component/nearyou/NearYouPage.js | 55 +++++++++----------- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/app/component/nearyou/NearYouMapContainer.js b/app/component/nearyou/NearYouMapContainer.js index ea92c32f7b..154438e079 100644 --- a/app/component/nearyou/NearYouMapContainer.js +++ b/app/component/nearyou/NearYouMapContainer.js @@ -133,7 +133,7 @@ const containerComponent = createPaginationContainer( { direction: 'forward', getConnectionFromProps(props) { - return props.stopsNearYou && props.stopsNearYou.nearest; + return props.stopsNearYou?.nearest; }, getFragmentVariables(prevVars, totalCount) { return { diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 1918c8e0ac..2fff4de491 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -680,32 +680,29 @@ class NearYouPage extends React.Component { }} environment={this.props.relayEnvironment} render={({ props }) => { - if (props) { - return ( - - ); - } - return undefined; + return props ? ( + + ) : null; }} /> ); @@ -765,10 +762,9 @@ class NearYouPage extends React.Component { variables={this.getQueryVariables(mode)} environment={this.props.relayEnvironment} render={({ props }) => { - return ( + return props ? ( - ); + ) : null; }} /> ); From a81847ddff5761dced818a553d35edd3dc047dad Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 3 Dec 2025 10:25:10 +0200 Subject: [PATCH 024/129] fix: wrong prop type for FavouritesMapContainer --- app/component/nearyou/NearYouPage.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 2fff4de491..e1259881f8 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -691,11 +691,13 @@ class NearYouPage extends React.Component { this.state.phase === PH_USEDEFAULTPOS } mapLayers={this.props.mapLayers} - favouriteIds={[ - ...this.props.favouriteStopIds, - ...this.props.favouriteStationIds, - ...this.props.favouriteVehicleStationIds, - ]} + favouriteIds={ + new Set([ + ...this.props.favouriteStopIds, + ...this.props.favouriteStationIds, + ...this.props.favouriteVehicleStationIds, + ]) + } breakpoint={this.props.breakpoint} setMWTRef={this.setMWTRef} stops={props.stops} From 2d2c1012b629162ad9860c4d6838113cfbb7f34d Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 3 Dec 2025 10:56:18 +0200 Subject: [PATCH 025/129] fix: pass correct favouriteIds set prop to NearYouContainer --- app/component/nearyou/NearYouContainer.js | 13 ++++--------- app/component/nearyou/NearYouPage.js | 16 ++++++++++------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index 48ddb15c44..b3ef9d7ad7 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -32,9 +32,8 @@ class NearYouContainer extends React.Component { nearByStopMode: PropTypes.string.isRequired, renderDisruptionBanner: PropTypes.bool, isParentTabActive: PropTypes.bool, - favouriteStopIds: PropTypes.arrayOf(PropTypes.string).isRequired, - favouriteStationIds: PropTypes.arrayOf(PropTypes.string).isRequired, - favouriteVehicleStationIds: PropTypes.arrayOf(PropTypes.string).isRequired, + // eslint-disable-next-line + favouriteIds: PropTypes.object, }; static defaultProps = { @@ -202,16 +201,12 @@ class NearYouContainer extends React.Component { }); sortedPatterns = filteredCityBikeStopPatterns .slice(0, 5) - .sort(sortNearbyRentalStations(this.props.favouriteVehicleStationIds)); + .sort(sortNearbyRentalStations(this.props.favouriteIds)); sortedPatterns.push(...filteredCityBikeStopPatterns.slice(5)); } else { - const merged = [ - ...this.props.favouriteStopIds, - ...this.props.favouriteStationIds, - ]; sortedPatterns = stopPatterns .slice(0, 5) - .sort(sortNearbyStops(merged, walkRoutingThreshold)); + .sort(sortNearbyStops(this.props.favouriteIds, walkRoutingThreshold)); sortedPatterns.push(...stopPatterns.slice(5)); } diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index e1259881f8..db65578610 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -478,6 +478,14 @@ class NearYouPage extends React.Component { } const prioritizedStops = config.prioritizedStopsNearYou[nearByStopMode.toLowerCase()]; + const favouriteIds = + mode === 'CITYBIKE' + ? new Set(this.props.favouriteVehicleStationIds) + : new Set([ + ...this.props.favouriteStopIds, + ...this.props.favouriteStationIds, + ]); + return (
{renderSearch && ( @@ -609,20 +617,16 @@ class NearYouPage extends React.Component { )} {props && ( )}
From ddafa1bf18f4c796183aead942559d602034bffc Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 3 Dec 2025 11:34:52 +0200 Subject: [PATCH 026/129] chore: refactor and rename --- app/component/nearyou/NearYouContainer.js | 34 +++++++++---------- .../nearyou/NearYouFavouritesContainer.js | 2 +- app/component/nearyou/NearYouPage.js | 10 +++--- app/translations.js | 24 ++++++------- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index b3ef9d7ad7..d6ec2b0682 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -18,7 +18,7 @@ import DisruptionBanner from '../DisruptionBanner'; class NearYouContainer extends React.Component { static propTypes = { // eslint-disable-next-line - stopPatterns: PropTypes.object, + places: PropTypes.object, setLoadState: PropTypes.func.isRequired, currentTime: PropTypes.number.isRequired, relay: relayShape.isRequired, @@ -37,7 +37,7 @@ class NearYouContainer extends React.Component { }; static defaultProps = { - stopPatterns: undefined, + places: undefined, withSeparator: false, prioritizedStops: undefined, renderDisruptionBanner: false, @@ -78,8 +78,8 @@ class NearYouContainer extends React.Component { currentPosition: nextProps.position, }; } - if (nextProps.stopPatterns) { - const stopsForFiltering = [...nextProps.stopPatterns.nearest.edges]; + if (nextProps.places) { + const stopsForFiltering = [...nextProps.places.nearest.edges]; const newestStops = stopsForFiltering.splice( stopsForFiltering.length - 5, ); @@ -181,17 +181,17 @@ class NearYouContainer extends React.Component { }; createNearbyStops = () => { - if (!this.props.stopPatterns?.nearest) { + if (!this.props.places?.nearest) { return null; } const mode = this.props.nearByStopMode; const walkRoutingThreshold = mode === 'RAIL' || mode === 'SUBWAY' || mode === 'FERRY' ? 3000 : 1500; - const stopPatterns = this.props.stopPatterns.nearest.edges; + const { edges } = this.props.places.nearest; const isCityBikeView = this.props.nearByStopMode === 'CITYBIKE'; - let sortedPatterns; + let sorted; if (isCityBikeView) { - const withNetworks = stopPatterns.filter(pattern => { + const withNetworks = edges.filter(pattern => { return !!pattern.node.place?.rentalNetwork?.networkId; }); const filteredCityBikeStopPatterns = withNetworks.filter(pattern => { @@ -199,18 +199,18 @@ class NearYouContainer extends React.Component { pattern.node.place?.rentalNetwork?.networkId, ); }); - sortedPatterns = filteredCityBikeStopPatterns + sorted = filteredCityBikeStopPatterns .slice(0, 5) .sort(sortNearbyRentalStations(this.props.favouriteIds)); - sortedPatterns.push(...filteredCityBikeStopPatterns.slice(5)); + sorted.push(...filteredCityBikeStopPatterns.slice(5)); } else { - sortedPatterns = stopPatterns + sorted = edges .slice(0, 5) .sort(sortNearbyStops(this.props.favouriteIds, walkRoutingThreshold)); - sortedPatterns.push(...stopPatterns.slice(5)); + sorted.push(...edges.slice(5)); } - const stops = sortedPatterns.map(({ node }) => { + const stops = sorted.map(({ node }) => { const stop = node.place; /* eslint-disable-next-line no-underscore-dangle */ switch (stop.__typename) { @@ -326,8 +326,8 @@ const NearYouContainerWithBreakpoint = withBreakpoint(NearYouContainer); const refetchContainer = createPaginationContainer( NearYouContainerWithBreakpoint, { - stopPatterns: graphql` - fragment NearYouContainer_stopPatterns on QueryType + places: graphql` + fragment NearYouContainer_places on QueryType @argumentDefinitions( startTime: { type: "Long!", defaultValue: 0 } omitNonPickups: { type: "Boolean!", defaultValue: false } @@ -412,7 +412,7 @@ const refetchContainer = createPaginationContainer( { direction: 'forward', getConnectionFromProps(props) { - return props.stopPatterns && props.stopPatterns.nearest; + return props.places?.nearest; }, getFragmentVariables(prevVars, totalCount) { return { @@ -442,7 +442,7 @@ const refetchContainer = createPaginationContainer( $filterByNetwork: [String!] ) { viewer { - ...NearYouContainer_stopPatterns + ...NearYouContainer_places @arguments( startTime: $startTime omitNonPickups: $omitNonPickups diff --git a/app/component/nearyou/NearYouFavouritesContainer.js b/app/component/nearyou/NearYouFavouritesContainer.js index 135eeef16e..84ddbef473 100644 --- a/app/component/nearyou/NearYouFavouritesContainer.js +++ b/app/component/nearyou/NearYouFavouritesContainer.js @@ -71,8 +71,8 @@ function NearYouFavouritesContainer({ ); default: diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index db65578610..25f6092e2f 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -442,8 +442,8 @@ class NearYouPage extends React.Component { $omitNonPickups: Boolean! $filterByNetwork: [String!] ) { - stopPatterns: viewer { - ...NearYouContainer_stopPatterns + places: viewer { + ...NearYouContainer_places @arguments( lat: $lat lon: $lon @@ -617,7 +617,7 @@ class NearYouPage extends React.Component { )} {props && ( ) : null; @@ -926,7 +926,7 @@ class NearYouPage extends React.Component { + ) : ( Date: Wed, 3 Dec 2025 13:41:09 +0200 Subject: [PATCH 027/129] fix: correct stopsNearYou prop type --- app/component/map/NearYouMap.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/component/map/NearYouMap.js b/app/component/map/NearYouMap.js index bb59ea1cc7..6f330dbaaa 100644 --- a/app/component/map/NearYouMap.js +++ b/app/component/map/NearYouMap.js @@ -431,12 +431,15 @@ function NearYouMap( } NearYouMap.propTypes = { - stopsNearYou: PropTypes.shape({ - nearest: PropTypes.shape({ - // eslint-disable-next-line + stopsNearYou: PropTypes.oneOfType([ + PropTypes.shape({ + nearest: PropTypes.shape({ + // eslint-disable-next-line edges: PropTypes.arrayOf(PropTypes.object).isRequired, - }).isRequired, - }), + }).isRequired, + }), + PropTypes.arrayOf(PropTypes.object), + ]), prioritizedStopsNearYou: PropTypes.arrayOf(stopShape), // eslint-disable-next-line favouriteIds: PropTypes.object.isRequired, From 2b66e853cc3b40b3b1321a17bf67bee375233927 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Sun, 7 Dec 2025 12:08:21 +0200 Subject: [PATCH 028/129] feat: refactor NearYouContainer thoroughly - Convert to function component - Rename and simplify - Remove useless state, use refs not state - Simple aria messages --- app/component/nearyou/NearYouContainer.js | 417 +++++++++------------- app/component/nearyou/NearYouPage.js | 6 +- 2 files changed, 175 insertions(+), 248 deletions(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index d6ec2b0682..2d61c05385 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -1,5 +1,5 @@ import PropTypes from 'prop-types'; -import React from 'react'; +import React, { useEffect, useState, useRef } from 'react'; import { createPaginationContainer, graphql } from 'react-relay'; import { intlShape, FormattedMessage } from 'react-intl'; import { configShape, relayShape } from '../../util/shapes'; @@ -15,198 +15,112 @@ import Icon from '../Icon'; import { getDefaultNetworks } from '../../util/vehicleRentalUtils'; import DisruptionBanner from '../DisruptionBanner'; -class NearYouContainer extends React.Component { - static propTypes = { - // eslint-disable-next-line - places: PropTypes.object, - setLoadState: PropTypes.func.isRequired, - currentTime: PropTypes.number.isRequired, - relay: relayShape.isRequired, - position: PropTypes.shape({ - address: PropTypes.string, - lat: PropTypes.number, - lon: PropTypes.number, - }).isRequired, - withSeparator: PropTypes.bool, - prioritizedStops: PropTypes.arrayOf(PropTypes.string), - nearByStopMode: PropTypes.string.isRequired, - renderDisruptionBanner: PropTypes.bool, - isParentTabActive: PropTypes.bool, - // eslint-disable-next-line - favouriteIds: PropTypes.object, - }; - - static defaultProps = { - places: undefined, - withSeparator: false, - prioritizedStops: undefined, - renderDisruptionBanner: false, - isParentTabActive: false, - }; - - static contextTypes = { - config: configShape, - intl: intlShape.isRequired, - executeAction: PropTypes.func.isRequired, - getStore: PropTypes.func, - }; - - constructor(props, context) { - super(props, context); - this.resultsUpdatedAlertRef = React.createRef(); - this.state = { - maxRefetches: context.config.maxNearbyStopRefetches, - refetches: 0, - stopCount: 5, - currentPosition: props.position, - fetchMoreStops: false, - isLoadingmoreStops: false, - isUpdatingPosition: false, - }; - } - - static getDerivedStateFromProps(nextProps, prevState) { - let newState = null; - if ( - !prevState.currentPosition || - (!prevState.currentPosition.address && - nextProps.position && - nextProps.position.address) - ) { - newState = { - ...newState, - currentPosition: nextProps.position, - }; - } - if (nextProps.places) { - const stopsForFiltering = [...nextProps.places.nearest.edges]; - const newestStops = stopsForFiltering.splice( - stopsForFiltering.length - 5, - ); - if ( - newestStops.every(stop => { - return ( - stop.node.place.stoptimesWithoutPatterns && - stop.node.place.stoptimesWithoutPatterns.length === 0 - ); - }) && - prevState.refetches < prevState.maxRefetches - ) { - newState = { - ...newState, - fetchMoreStops: true, - }; - } else { - newState = { - ...newState, - fetchMoreStops: false, - }; - } - } - return newState; - } - - componentDidUpdate(prevProps, prevState) { - const { position } = prevProps; - if (position && this.state.currentPosition) { - if ( - position.lat !== this.props.position.lat || - position.lon !== this.props.position.lon - ) { - this.updatePosition(); - } - } - if (this.state.fetchMoreStops) { - this.showMore(true); - } - if ( - this.resultsUpdatedAlertRef.current && - prevState.isLoadingmoreStops && - !this.state.isLoadingmoreStops - ) { - this.resultsUpdatedAlertRef.current.innerHTML = - this.context.intl.formatMessage({ - id: 'stop-near-you-update-alert', - defaultMessage: 'Search results updated', - }); - setTimeout(() => { - this.resultsUpdatedAlertRef.current.innerHTML = null; - }, 100); - } - } - - componentDidMount() { - this.props.setLoadState(); - if (this.state.fetchMoreStops) { - this.showMore(true); - } - } +function NearYouContainer( + { + places, + loadingDone, + currentTime, + relay, + position, + withSeparator, + prioritizedStops, + mode, + renderDisruptionBanner, + isParentTabActive, + favouriteIds, + }, + { config, intl }, +) { + const ariaRef = useRef('stop-near-you'); + const searchPos = useRef(position); // position used for fetching nearest places + const refetches = useRef(0); + const stopCount = useRef(5); + const [loading, setLoading] = useState(0); - updatePosition = () => { + const updatePosition = () => { const variables = { - lat: this.props.position.lat, - lon: this.props.position.lon, - startTime: this.props.currentTime, + ...position, + startTime: currentTime, }; - this.setState({ - isUpdatingPosition: true, - }); - this.props.relay.refetchConnection( - this.state.stopCount, + setLoading(1); + relay.refetchConnection( + stopCount.current, () => { - this.setState({ - isUpdatingPosition: false, - currentPosition: this.props.position, - }); + setLoading(0); + searchPos.current = position; }, variables, ); }; - showMore = automatic => { - if (!this.props.relay.hasMore() || this.state.isLoadingmoreStops) { + const showMore = automatic => { + if (!relay.hasMore() || loading) { return; } - this.setState({ isLoadingmoreStops: true, fetchMoreStops: false }); - this.props.relay.loadMore(5, () => { - this.setState(previousState => ({ - refetches: automatic - ? previousState.refetches + 1 - : previousState.refetches, - stopCount: previousState.stopCount + 5, - fetchMoreStops: false, - isLoadingmoreStops: false, - })); + setLoading(2); + if (!automatic) { + ariaRef.current = 'loading'; + } + relay.loadMore(5, () => { + if (automatic) { + refetches.current += 1; + } + stopCount.current += 5; + ariaRef.current = 'stop-near-you-update-alert'; + setLoading(0); }); }; - createNearbyStops = () => { - if (!this.props.places?.nearest) { - return null; + useEffect(() => { + const { edges } = places.nearest; + const fetchMore = + edges.filter( + stop => !(stop.node.place.stoptimesWithoutPatterns?.length === 0), + ).length < 5 && refetches.current < config.maxNearbyStopRefetches; + if (fetchMore) { + showMore(true); + } + }, [places]); + + useEffect(() => { + if ( + position.lat !== searchPos.current.lat || + position.lon !== searchPos.current.lon + ) { + updatePosition(); + } + }, [position.lat, position.lon]); + + useEffect(() => { + loadingDone(); + }, []); + + const createNearbyStops = () => { + if (!places?.nearest) { + return []; } - const mode = this.props.nearByStopMode; const walkRoutingThreshold = mode === 'RAIL' || mode === 'SUBWAY' || mode === 'FERRY' ? 3000 : 1500; - const { edges } = this.props.places.nearest; - const isCityBikeView = this.props.nearByStopMode === 'CITYBIKE'; + const { edges } = places.nearest; + const isCityBikeView = mode === 'CITYBIKE'; let sorted; if (isCityBikeView) { - const withNetworks = edges.filter(pattern => { - return !!pattern.node.place?.rentalNetwork?.networkId; + const withNetworks = edges.filter(edge => { + return !!edge.node.place?.rentalNetwork?.networkId; }); - const filteredCityBikeStopPatterns = withNetworks.filter(pattern => { - return getDefaultNetworks(this.context.config).includes( - pattern.node.place?.rentalNetwork?.networkId, + const filteredCityBikeStopEdges = withNetworks.filter(edge => { + return getDefaultNetworks(config).includes( + edge.node.place?.rentalNetwork?.networkId, ); }); - sorted = filteredCityBikeStopPatterns + sorted = filteredCityBikeStopEdges .slice(0, 5) - .sort(sortNearbyRentalStations(this.props.favouriteIds)); - sorted.push(...filteredCityBikeStopPatterns.slice(5)); + .sort(sortNearbyRentalStations(favouriteIds)); + sorted.push(...filteredCityBikeStopEdges.slice(5)); } else { sorted = edges .slice(0, 5) - .sort(sortNearbyStops(this.props.favouriteIds, walkRoutingThreshold)); + .sort(sortNearbyStops(favouriteIds, walkRoutingThreshold)); sorted.push(...edges.slice(5)); } @@ -215,17 +129,14 @@ class NearYouContainer extends React.Component { /* eslint-disable-next-line no-underscore-dangle */ switch (stop.__typename) { case 'Stop': - if ( - stop.stoptimesWithoutPatterns && - stop.stoptimesWithoutPatterns.length > 0 - ) { - if (!this.props.prioritizedStops?.includes(stop.gtfsId)) { + if (stop.stoptimesWithoutPatterns?.length > 0) { + if (!prioritizedStops?.includes(stop.gtfsId)) { return ( ); } @@ -236,8 +147,8 @@ class NearYouContainer extends React.Component { ); default: @@ -248,79 +159,95 @@ class NearYouContainer extends React.Component { return stops; }; - render() { - const screenReaderUpdateAlert = ( - - ); - const stops = this.createNearbyStops().filter(e => e); - const alerts = stops - .flatMap(stop => stop.props.stop?.routes || []) - .flatMap(route => route?.alerts || []) - .filter(alert => alert.alertSeverityLevel === 'SEVERE'); - const noStopsFound = - !stops.length && - this.state.refetches >= this.state.maxRefetches && - !this.state.isLoadingmoreStops; - return ( - <> - {this.props.renderDisruptionBanner && ( - - )} - {((!this.props.relay.hasMore() && - !stops.length && - !this.props.prioritizedStops?.length) || - (noStopsFound && !this.props.prioritizedStops?.length)) && ( - <> - {this.props.withSeparator &&
} -
- - -
- - )} - {screenReaderUpdateAlert} - {this.state.isUpdatingPosition && ( -
- + const stops = createNearbyStops(); + const alerts = stops + .flatMap(stop => stop?.props?.stop?.routes || []) + .flatMap(route => route?.alerts || []) + .filter(alert => alert.alertSeverityLevel === 'SEVERE'); + const noStopsFound = + !stops.length && refetches >= config.maxNearbyStopRefetches && !loading; + return ( + <> + {renderDisruptionBanner && ( + + )} + {((!relay.hasMore() && !stops.length && !prioritizedStops?.length) || + (noStopsFound && !prioritizedStops?.length)) && ( + <> + {withSeparator &&
} +
+ +
- )} -
- {stops} + + )} +
+ +
+ {loading === 1 && ( +
+
- {this.state.isLoadingmoreStops && ( -
- -
- )} - {this.props.relay.hasMore() && !noStopsFound && ( - - )} - - ); - } + )} +
+ {stops} +
+ {loading === 2 && ( +
+ +
+ )} + {relay.hasMore() && !noStopsFound && ( + + )} + + ); } +NearYouContainer.propTypes = { + // eslint-disable-next-line + places: PropTypes.object, + loadingDone: PropTypes.func.isRequired, + currentTime: PropTypes.number.isRequired, + relay: relayShape.isRequired, + position: PropTypes.shape({ + lat: PropTypes.number, + lon: PropTypes.number, + }).isRequired, + withSeparator: PropTypes.bool, + prioritizedStops: PropTypes.arrayOf(PropTypes.string), + mode: PropTypes.string.isRequired, + renderDisruptionBanner: PropTypes.bool, + isParentTabActive: PropTypes.bool, + // eslint-disable-next-line + favouriteIds: PropTypes.object, +}; + +NearYouContainer.defaultProps = { + places: undefined, + withSeparator: false, + prioritizedStops: undefined, + renderDisruptionBanner: false, + isParentTabActive: false, +}; + +NearYouContainer.contextTypes = { + config: configShape, + intl: intlShape.isRequired, + executeAction: PropTypes.func.isRequired, + getStore: PropTypes.func, +}; + const NearYouContainerWithBreakpoint = withBreakpoint(NearYouContainer); const refetchContainer = createPaginationContainer( diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 25f6092e2f..dac4db28ed 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -208,7 +208,7 @@ class NearYouPage extends React.Component { return newState; } - setLoadState = () => { + loadingDone = () => { // trigger a state update in this component to force a rerender when stop data is received for the first time. // this fixes a bug where swipeable tabs were not keeping focusable elements up to date after receving stop data // and keyboard focus could be lost to hidden elements. @@ -619,10 +619,10 @@ class NearYouPage extends React.Component { Date: Mon, 8 Dec 2025 13:07:36 +0200 Subject: [PATCH 029/129] chore: rename --- app/component/nearyou/NearYouContainer.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index 2d61c05385..e4106912b9 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -125,16 +125,16 @@ function NearYouContainer( } const stops = sorted.map(({ node }) => { - const stop = node.place; + const { place } = node; /* eslint-disable-next-line no-underscore-dangle */ - switch (stop.__typename) { + switch (place.__typename) { case 'Stop': - if (stop.stoptimesWithoutPatterns?.length > 0) { - if (!prioritizedStops?.includes(stop.gtfsId)) { + if (place.stoptimesWithoutPatterns?.length > 0) { + if (!prioritizedStops?.includes(place.gtfsId)) { return ( @@ -145,8 +145,8 @@ function NearYouContainer( case 'VehicleRentalStation': return ( From 0973d61160d4a456b018a2e866808df60ba41408 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Mon, 8 Dec 2025 16:15:52 +0200 Subject: [PATCH 030/129] feat: move update button to sub component --- app/component/nearyou/NearYouPage.js | 50 ++++++------------- app/component/nearyou/UpdateLocationButton.js | 33 ++++++++++++ 2 files changed, 47 insertions(+), 36 deletions(-) create mode 100644 app/component/nearyou/UpdateLocationButton.js diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index dac4db28ed..0f0c2de440 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -18,6 +18,7 @@ import { otpToLocation, locationToUri } from '../../util/otpStrings'; import { isKeyboardSelectionEvent } from '../../util/browser'; import Loading from '../Loading'; import StopNearYouContainer from './StopNearYouContainer'; +import UpdateLocationButton from './UpdateLocationButton'; import { checkPositioningPermission, startLocationWatch, @@ -335,38 +336,6 @@ class NearYouPage extends React.Component { this.setState({ centerOfMapChanged: false }); }; - refetchButton = nearByMode => { - const { mode } = this.props.match.params; - const modeClass = nearByMode || mode; - return ( -
- - -
- ); - }; - noFavourites = () => { return ( !this.props.favouriteStopIds.length && @@ -386,7 +355,7 @@ class NearYouPage extends React.Component { const { centerOfMapChanged } = this.state; const { mode } = this.props.match.params; const noFavourites = mode === 'FAVORITE' && this.noFavourites(); - const renderRefetchButton = centerOfMapChanged && !noFavourites; + const renderUpdateButton = centerOfMapChanged && !noFavourites; const nearByStopModes = this.modes; const index = nearByStopModes.indexOf(mode); const { config } = this.context; @@ -405,7 +374,12 @@ class NearYouPage extends React.Component { }`} aria-hidden={!isActive} > - {renderRefetchButton && this.refetchButton()} + {renderUpdateButton && ( + + )} {this.props.favouritesFetched ? (
)} - - {renderRefetchButton && this.refetchButton(nearByStopMode)} + {renderUpdateButton && ( + + )} {prioritizedStops?.length && ( + + +
+ ); +} + +UpdateLocationButton.propTypes = { + mode: PropTypes.string.isRequired, + onClick: PropTypes.func.isRequired, +}; + +UpdateLocationButton.contextTypes = { + intl: intlShape.isRequired, +}; From b924aeaceaeee5d8f5e28aceac5586a7660026c2 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 9 Dec 2025 10:23:57 +0200 Subject: [PATCH 031/129] feat: move top level map rendering logic to a new component --- app/component/nearyou/MapWrapper.js | 161 +++++++++++++++++ app/component/nearyou/NearYouMapContainer.js | 12 +- app/component/nearyou/NearYouPage.js | 175 ++++--------------- 3 files changed, 197 insertions(+), 151 deletions(-) create mode 100644 app/component/nearyou/MapWrapper.js diff --git a/app/component/nearyou/MapWrapper.js b/app/component/nearyou/MapWrapper.js new file mode 100644 index 0000000000..0dcd21eed0 --- /dev/null +++ b/app/component/nearyou/MapWrapper.js @@ -0,0 +1,161 @@ +import PropTypes from 'prop-types'; +import React from 'react'; +import { graphql, QueryRenderer } from 'react-relay'; +import { matchShape } from 'found'; +import { + relayShape, + configShape, + mapLayerOptionsShape, +} from '../../util/shapes'; +import NearYouMapContainer from './NearYouMapContainer'; +import NearYouFavouritesMapContainer from './NearYouFavouritesMapContainer'; +import { mapLayerShape } from '../../store/MapLayerStore'; + +export default function MapWrapper( + { + match, + relayEnvironment, + favouriteStopIds, + favouriteStationIds, + favouriteVehicleStationIds, + setCenterOfMap, + mapLayers, + mapLayerOptions, + variables, + ...rest + }, + { config }, +) { + const commonProps = { + match, + onEndNavigation: setCenterOfMap, + onMapTracking: setCenterOfMap, + }; + const { mode } = match.params; + + if (mode === 'FAVORITE') { + return ( + { + return props ? ( + + ) : null; + }} + /> + ); + } + + const citybike = mode === 'CITYBIKE'; + const filteredMapLayers = { + ...mapLayers, + citybike, + citybikeOverrideMinZoom: citybike, + }; + if (!config.map.showLayerSelector) { + filteredMapLayers.stop = {}; + if (!citybike) { + filteredMapLayers.stop[mode.toLowerCase()] = true; + } + } + const favouriteIds = citybike + ? new Set(favouriteVehicleStationIds) + : new Set([...favouriteStopIds, ...favouriteStationIds]); + return ( + { + return props ? ( + + ) : null; + }} + /> + ); +} + +MapWrapper.propTypes = { + relayEnvironment: relayShape.isRequired, + match: matchShape.isRequired, + favouriteStopIds: PropTypes.arrayOf(PropTypes.string).isRequired, + favouriteStationIds: PropTypes.arrayOf(PropTypes.string).isRequired, + favouriteVehicleStationIds: PropTypes.arrayOf(PropTypes.string).isRequired, + setCenterOfMap: PropTypes.func.isRequired, + mapLayers: mapLayerShape.isRequired, + mapLayerOptions: mapLayerOptionsShape.isRequired, + // eslint-disable-next-line + variables: PropTypes.object.isRequired, +}; + +MapWrapper.contextTypes = { config: configShape.isRequired }; diff --git a/app/component/nearyou/NearYouMapContainer.js b/app/component/nearyou/NearYouMapContainer.js index 154438e079..f356a9a169 100644 --- a/app/component/nearyou/NearYouMapContainer.js +++ b/app/component/nearyou/NearYouMapContainer.js @@ -4,8 +4,8 @@ import NearYouMap from '../map/NearYouMap'; const containerComponent = createPaginationContainer( NearYouMap, { - stopsNearYou: graphql` - fragment NearYouMapContainer_stopsNearYou on QueryType + stops: graphql` + fragment NearYouMapContainer_stops on QueryType @argumentDefinitions( startTime: { type: "Long!", defaultValue: 0 } omitNonPickups: { type: "Boolean!", defaultValue: false } @@ -90,8 +90,8 @@ const containerComponent = createPaginationContainer( } } `, - prioritizedStopsNearYou: graphql` - fragment NearYouMapContainer_prioritizedStopsNearYou on Stop + prioritizedStops: graphql` + fragment NearYouMapContainer_prioritizedStops on Stop @relay(plural: true) { gtfsId lat @@ -133,7 +133,7 @@ const containerComponent = createPaginationContainer( { direction: 'forward', getConnectionFromProps(props) { - return props.stopsNearYou?.nearest; + return props.stops?.nearest; }, getFragmentVariables(prevVars, totalCount) { return { @@ -163,7 +163,7 @@ const containerComponent = createPaginationContainer( $filterByNetwork: [String!] ) { viewer { - ...NearYouMapContainer_stopsNearYou + ...NearYouMapContainer_stops @arguments( startTime: $startTime omitNonPickups: $omitNonPickups diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 0f0c2de440..7173616ede 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -19,6 +19,7 @@ import { isKeyboardSelectionEvent } from '../../util/browser'; import Loading from '../Loading'; import StopNearYouContainer from './StopNearYouContainer'; import UpdateLocationButton from './UpdateLocationButton'; +import MapWrapper from './MapWrapper'; import { checkPositioningPermission, startLocationWatch, @@ -37,8 +38,6 @@ import { PREFIX_NEARYOU } from '../../util/path'; import NearYouContainer from './NearYouContainer'; import SwipeableTabs from '../SwipeableTabs'; import NearYouFavourites from './NearYouFavourites'; -import NearYouMapContainer from './NearYouMapContainer'; -import NearYouFavouritesMapContainer from './NearYouFavouritesMapContainer'; import { mapLayerShape } from '../../store/MapLayerStore'; import { getRentalNetworkConfig, @@ -93,18 +92,15 @@ class NearYouPage extends React.Component { position: locationShape.isRequired, lang: PropTypes.string.isRequired, match: matchShape.isRequired, - favouriteStopIds: PropTypes.arrayOf(PropTypes.string), - favouriteStationIds: PropTypes.arrayOf(PropTypes.string), - favouriteVehicleStationIds: PropTypes.arrayOf(PropTypes.string), + favouriteStopIds: PropTypes.arrayOf(PropTypes.string).isRequired, + favouriteStationIds: PropTypes.arrayOf(PropTypes.string).isRequired, + favouriteVehicleStationIds: PropTypes.arrayOf(PropTypes.string).isRequired, mapLayers: mapLayerShape.isRequired, favouritesFetched: PropTypes.bool, currentTime: PropTypes.number.isRequired, }; static defaultProps = { - favouriteStopIds: [], - favouriteStationIds: [], - favouriteVehicleStationIds: [], favouritesFetched: false, }; @@ -227,6 +223,13 @@ class NearYouPage extends React.Component { }; getQueryVariables = mode => { + if (mode === 'FAVORITE') { + return { + stopIds: this.props.favouriteStopIds, + stationIds: this.props.favouriteStationIds, + vehicleRentalStationIds: this.props.favouriteVehicleStationIds, + }; + } const { searchPosition } = this.state; let placeTypes = ['STOP', 'STATION']; let modes = [mode]; @@ -631,144 +634,26 @@ class NearYouPage extends React.Component { return tabs[0]; }; - renderMap = () => { - const { mode } = this.props.match.params; - if (mode === 'FAVORITE') { - return ( - { - return props ? ( - - ) : null; - }} - /> - ); - } - const filteredMapLayers = { - ...this.props.mapLayers, - citybike: mode === 'CITYBIKE', - citybikeOverrideMinZoom: mode === 'CITYBIKE', - }; - if (!this.context.config.map.showLayerSelector) { - filteredMapLayers.stop = {}; - if (mode !== 'CITYBIKE') { - filteredMapLayers.stop[mode.toLowerCase()] = true; + renderMap = () => ( + { - return props ? ( - - ) : null; - }} - /> - ); - }; + mapLayers={this.props.mapLayers} + mapLayerOptions={this.state.mapLayerOptions} + breakpoint={this.props.breakpoint} + setMWTRef={this.setMWTRef} + variables={this.getQueryVariables(this.props.match.params.mode)} + /> + ); handleClose = () => { this.setState({ phase: PH_USEDEFAULTPOS }); From 004640afeb21431b89545b850b1a13be67138a34 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 9 Dec 2025 11:59:44 +0200 Subject: [PATCH 032/129] chore: rename more --- app/component/nearyou/NearYouPage.js | 29 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 7173616ede..4a2c3fc285 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -362,16 +362,15 @@ class NearYouPage extends React.Component { const nearByStopModes = this.modes; const index = nearByStopModes.indexOf(mode); const { config } = this.context; - const tabs = nearByStopModes.map(nearByStopMode => { - const renderSearch = - nearByStopMode !== 'FERRY' && nearByStopMode !== 'FAVORITE'; - const renderDisruptionBanner = nearByStopMode !== 'CITYBIKE'; - const isActive = nearByStopMode === mode; - if (nearByStopMode === 'FAVORITE') { + const tabs = nearByStopModes.map(tabMode => { + const renderSearch = tabMode !== 'FERRY' && tabMode !== 'FAVORITE'; + const renderDisruptionBanner = tabMode !== 'CITYBIKE'; + const isActive = tabMode === mode; + if (tabMode === 'FAVORITE') { const noFavs = this.noFavourites(); return (
{renderUpdateButton && ( )} @@ -403,7 +402,7 @@ class NearYouPage extends React.Component { return (
{ const { vehicleRental } = config; @@ -454,7 +453,7 @@ class NearYouPage extends React.Component { ).url; } const prioritizedStops = - config.prioritizedStopsNearYou[nearByStopMode.toLowerCase()]; + config.prioritizedStopsNearYou[tabMode.toLowerCase()]; const favouriteIds = mode === 'CITYBIKE' ? new Set(this.props.favouriteVehicleStationIds) @@ -467,14 +466,14 @@ class NearYouPage extends React.Component {
{renderSearch && ( )} {this.state.showCityBikeTeaser && - nearByStopMode === 'CITYBIKE' && + tabMode === 'CITYBIKE' && (cityBikeBuyUrl || cityBikeNetworkUrl) && (
@@ -542,7 +541,7 @@ class NearYouPage extends React.Component { )} {renderUpdateButton && ( )} @@ -603,7 +602,7 @@ class NearYouPage extends React.Component { loadingDone={this.loadingDone} position={this.state.searchPosition} withSeparator={!renderSearch} - mode={nearByStopMode} + mode={tabMode} renderDisruptionBanner={renderDisruptionBanner} isParentTabActive={isActive} currentTime={this.props.currentTime} From f630726ad804acf00ddd75dc690e5f277e23edc4 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 9 Dec 2025 13:13:29 +0200 Subject: [PATCH 033/129] feat: move modal which asks initial location into new component --- app/component/nearyou/LocationModal.js | 70 ++++++++++++++++++++++++++ app/component/nearyou/NearYouPage.js | 70 +++++--------------------- 2 files changed, 82 insertions(+), 58 deletions(-) create mode 100644 app/component/nearyou/LocationModal.js diff --git a/app/component/nearyou/LocationModal.js b/app/component/nearyou/LocationModal.js new file mode 100644 index 0000000000..e9e429d746 --- /dev/null +++ b/app/component/nearyou/LocationModal.js @@ -0,0 +1,70 @@ +import PropTypes from 'prop-types'; +import React from 'react'; +import { FormattedMessage, intlShape } from 'react-intl'; +import DTIcon from '@digitransit-component/digitransit-component-icon'; +import Modal from '@hsl-fi/modal'; + +export default function LocationModal( + { handleClose, startGeolocation, showGeolocationButton, showInfo, children }, + { intl }, +) { + return ( + +
+
+
+ +
+
+
+ +
+
+ +
+
+
{children}
+
+
+ +
+ {showGeolocationButton && ( +
+ +
+ )} + {showInfo && ( +
+ +
+ )} +
+
+ ); +} + +LocationModal.propTypes = { + handleClose: PropTypes.func.isRequired, + startGeolocation: PropTypes.func.isRequired, + showGeolocationButton: PropTypes.bool.isRequired, + showInfo: PropTypes.bool.isRequired, + children: PropTypes.node, +}; + +LocationModal.contextTypes = { + intl: intlShape.isRequired, +}; diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 4a2c3fc285..c486bbff77 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -5,9 +5,7 @@ import { FormattedMessage, intlShape } from 'react-intl'; import { graphql, ReactRelayContext, QueryRenderer } from 'react-relay'; import { matchShape, routerShape } from 'found'; import connectToStores from 'fluxible-addons-react/connectToStores'; -import Modal from '@hsl-fi/modal'; import DTAutoSuggest from '@digitransit-component/digitransit-component-autosuggest'; -import DTIcon from '@digitransit-component/digitransit-component-icon'; import distance from '@digitransit-search-util/digitransit-search-util-distance'; import { relayShape, configShape, locationShape } from '../../util/shapes'; import Icon from '../Icon'; @@ -20,6 +18,7 @@ import Loading from '../Loading'; import StopNearYouContainer from './StopNearYouContainer'; import UpdateLocationButton from './UpdateLocationButton'; import MapWrapper from './MapWrapper'; +import LocationModal from './LocationModal'; import { checkPositioningPermission, startLocationWatch, @@ -111,7 +110,7 @@ class NearYouPage extends React.Component { centerOfMapChanged: false, showCityBikeTeaser: true, searchPosition: {}, - mapLayerOptions: null, + mapLayerOptions: {}, // eslint-disable-next-line react/no-unused-state resultsLoaded: false, }; @@ -719,67 +718,22 @@ class NearYouPage extends React.Component { ); }; - renderDialogModal = () => { - return ( - -
-
-
- -
-
-
- -
-
- -
-
-
- {this.renderAutoSuggestField()} -
-
-
- -
- {this.state.phase === PH_SEARCH_GEOLOCATION && ( -
- -
- )} - {this.state.phase === PH_SEARCH && ( -
- -
- )} -
-
- ); - }; - render() { const { mode } = this.props.match.params; const { phase } = this.state; const nearByStopModes = this.modes; if (PH_SHOWSEARCH.includes(phase)) { - return
{this.renderDialogModal()}
; + return ( + + {this.renderAutoSuggestField()} + + ); } if (PH_READY.includes(phase)) { return ( From 07092886664a0be1505594674007a056597bbcff Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 9 Dec 2025 13:50:47 +0200 Subject: [PATCH 034/129] fix: give understandable names for the two search components --- app/component/nearyou/NearYouPage.js | 20 +++++++++---------- .../{NearYouSearch.js => StopRouteSearch.js} | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) rename app/component/nearyou/{NearYouSearch.js => StopRouteSearch.js} (93%) diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index c486bbff77..b97e5008da 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -23,7 +23,7 @@ import { checkPositioningPermission, startLocationWatch, } from '../../action/PositionActions'; -import NearYouSearch from './NearYouSearch'; +import StopRouteSearch from './StopRouteSearch'; import { getGeolocationState, getReadMessageIds, @@ -362,8 +362,8 @@ class NearYouPage extends React.Component { const index = nearByStopModes.indexOf(mode); const { config } = this.context; const tabs = nearByStopModes.map(tabMode => { - const renderSearch = tabMode !== 'FERRY' && tabMode !== 'FAVORITE'; - const renderDisruptionBanner = tabMode !== 'CITYBIKE'; + const renderStopRouteSearch = + tabMode !== 'FERRY' && tabMode !== 'FAVORITE'; const isActive = tabMode === mode; if (tabMode === 'FAVORITE') { const noFavs = this.noFavourites(); @@ -463,8 +463,8 @@ class NearYouPage extends React.Component { return (
- {renderSearch && ( - { + locationSearch = () => { return (
{this.renderAutoSuggestField(true)} @@ -762,7 +762,7 @@ class NearYouPage extends React.Component { scrollable={nearByStopModes.length === 1} map={ <> - {this.renderSearchBox()} + {this.locationSearch()} {this.renderMap()} } @@ -772,7 +772,7 @@ class NearYouPage extends React.Component { diff --git a/app/component/nearyou/NearYouSearch.js b/app/component/nearyou/StopRouteSearch.js similarity index 93% rename from app/component/nearyou/NearYouSearch.js rename to app/component/nearyou/StopRouteSearch.js index ce02cd7c4b..45a5543f87 100644 --- a/app/component/nearyou/NearYouSearch.js +++ b/app/component/nearyou/StopRouteSearch.js @@ -10,7 +10,7 @@ import { getStopRoutePath } from '../../util/path'; const DTAutoSuggestWithSearchContext = withSearchContext(DTAutoSuggest); const searchSources = ['Favourite', 'History', 'Datasource']; -function NearYouSearch( +function StopRouteSearch( { mode, breakpoint, lang, originLocation }, { router, config }, ) { @@ -55,7 +55,7 @@ function NearYouSearch( ); } -NearYouSearch.propTypes = { +StopRouteSearch.propTypes = { mode: PropTypes.string.isRequired, breakpoint: PropTypes.string.isRequired, lang: PropTypes.string.isRequired, @@ -66,13 +66,13 @@ NearYouSearch.propTypes = { }), }; -NearYouSearch.defaultProps = { +StopRouteSearch.defaultProps = { originLocation: {}, }; -NearYouSearch.contextTypes = { +StopRouteSearch.contextTypes = { router: routerShape.isRequired, config: configShape.isRequired, }; -export default memo(NearYouSearch); +export default memo(StopRouteSearch); From 62a1f61984a0abd2fa6a51a5dc3b3d3f8d1e867f Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 10 Dec 2025 08:56:00 +0200 Subject: [PATCH 035/129] feat: move location search into sub component --- app/component/nearyou/LocationModal.js | 2 ++ app/component/nearyou/NearYouPage.js | 49 ++++---------------------- 2 files changed, 9 insertions(+), 42 deletions(-) diff --git a/app/component/nearyou/LocationModal.js b/app/component/nearyou/LocationModal.js index e9e429d746..fd8b265f3b 100644 --- a/app/component/nearyou/LocationModal.js +++ b/app/component/nearyou/LocationModal.js @@ -65,6 +65,8 @@ LocationModal.propTypes = { children: PropTypes.node, }; +LocationModal.defaultProps = { children: null }; + LocationModal.contextTypes = { intl: intlShape.isRequired, }; diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index b97e5008da..0e52f88c70 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -5,7 +5,6 @@ import { FormattedMessage, intlShape } from 'react-intl'; import { graphql, ReactRelayContext, QueryRenderer } from 'react-relay'; import { matchShape, routerShape } from 'found'; import connectToStores from 'fluxible-addons-react/connectToStores'; -import DTAutoSuggest from '@digitransit-component/digitransit-component-autosuggest'; import distance from '@digitransit-search-util/digitransit-search-util-distance'; import { relayShape, configShape, locationShape } from '../../util/shapes'; import Icon from '../Icon'; @@ -23,16 +22,13 @@ import { checkPositioningPermission, startLocationWatch, } from '../../action/PositionActions'; +import Search from './Search'; import StopRouteSearch from './StopRouteSearch'; import { getGeolocationState, getReadMessageIds, setReadMessageIds, } from '../../store/localStorage'; -import { - withSearchContext, - getLocationSearchTargets, -} from '../WithSearchContext'; import { PREFIX_NEARYOU } from '../../util/path'; import NearYouContainer from './NearYouContainer'; import SwipeableTabs from '../SwipeableTabs'; @@ -63,8 +59,6 @@ const PH_USEMAPCENTER = 'usemapcenter'; const PH_SHOWSEARCH = [PH_SEARCH, PH_SEARCH_GEOLOCATION]; // show modal const PH_READY = [PH_USEDEFAULTPOS, PH_USEGEOLOCATION, PH_USEMAPCENTER]; // render the actual page -const DTAutoSuggestWithSearchContext = withSearchContext(DTAutoSuggest); - function getModes(config) { const transportModes = getTransportModes(config); const nearYouModes = getNearYouModes(config); @@ -680,44 +674,15 @@ class NearYouPage extends React.Component { locationSearch = () => { return (
- {this.renderAutoSuggestField(true)} +
); }; - renderAutoSuggestField = onMap => { - const isMobile = this.props.breakpoint !== 'large'; - const searchProps = { - id: 'origin-stop-near-you', - placeholder: 'origin', - translatedPlaceholder: onMap - ? this.context.intl.formatMessage({ id: 'move-on-map' }) - : undefined, - mobileLabel: onMap - ? this.context.intl.formatMessage({ id: 'position' }) - : undefined, - inputClassName: onMap ? 'origin-stop-near-you-selector' : undefined, - modeIconColors: this.context.config.colors.iconColors, - modeSet: this.context.config.iconModeSet, - getAutoSuggestIcons: this.context.config.getAutoSuggestIcons, - }; - const targets = getLocationSearchTargets(this.context.config, false); - return ( - - ); - }; - render() { const { mode } = this.props.match.params; const { phase } = this.state; @@ -731,7 +696,7 @@ class NearYouPage extends React.Component { showGeolocationButton={this.state.phase === PH_SEARCH_GEOLOCATION} showInfo={this.state.phase === PH_SEARCH} > - {this.renderAutoSuggestField()} + ); } From 7a1616d84ee214a48040fc7689d51bed186b87c3 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 10 Dec 2025 09:21:41 +0200 Subject: [PATCH 036/129] chore: refactor searches more - expose only props which are accessed - rename - use Memo --- app/component/nearyou/NearYouPage.js | 30 ++++++++++++++---------- app/component/nearyou/StopRouteSearch.js | 25 +++----------------- 2 files changed, 20 insertions(+), 35 deletions(-) diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 0e52f88c70..e2d8ba6fa1 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -460,9 +460,9 @@ class NearYouPage extends React.Component { {renderStopRouteSearch && ( )} {this.state.showCityBikeTeaser && @@ -671,15 +671,19 @@ class NearYouPage extends React.Component { }); }; - locationSearch = () => { + search = onMap => ( + + ); + + mapSearch = () => { return ( -
- -
+
{this.search(true)}
); }; @@ -696,7 +700,7 @@ class NearYouPage extends React.Component { showGeolocationButton={this.state.phase === PH_SEARCH_GEOLOCATION} showInfo={this.state.phase === PH_SEARCH} > - + {this.search(false)} ); } @@ -727,7 +731,7 @@ class NearYouPage extends React.Component { scrollable={nearByStopModes.length === 1} map={ <> - {this.locationSearch()} + {this.mapSearch()} {this.renderMap()} } @@ -737,7 +741,7 @@ class NearYouPage extends React.Component { diff --git a/app/component/nearyou/StopRouteSearch.js b/app/component/nearyou/StopRouteSearch.js index 45a5543f87..40bbc06edb 100644 --- a/app/component/nearyou/StopRouteSearch.js +++ b/app/component/nearyou/StopRouteSearch.js @@ -10,11 +10,7 @@ import { getStopRoutePath } from '../../util/path'; const DTAutoSuggestWithSearchContext = withSearchContext(DTAutoSuggest); const searchSources = ['Favourite', 'History', 'Datasource']; -function StopRouteSearch( - { mode, breakpoint, lang, originLocation }, - { router, config }, -) { - const isMobile = breakpoint !== 'large'; +function StopRouteSearch({ mode, ...rest }, { router, config }) { const transportMode = `route-${mode}`; const filter = config.stopSearchFilter @@ -31,8 +27,6 @@ function StopRouteSearch(
); } -StopRouteSearch.propTypes = { - mode: PropTypes.string.isRequired, - breakpoint: PropTypes.string.isRequired, - lang: PropTypes.string.isRequired, - originLocation: PropTypes.shape({ - address: PropTypes.string, - lat: PropTypes.number, - lon: PropTypes.number, - }), -}; - -StopRouteSearch.defaultProps = { - originLocation: {}, -}; +StopRouteSearch.propTypes = { mode: PropTypes.string.isRequired }; StopRouteSearch.contextTypes = { router: routerShape.isRequired, From e29e82212032c2f3f0dee44b5f3cb4cac479ff2e Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 10 Dec 2025 09:21:41 +0200 Subject: [PATCH 037/129] chore: refactor searches more - expose only props which are accessed - rename - use Memo --- app/component/nearyou/Search.js | 52 +++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 app/component/nearyou/Search.js diff --git a/app/component/nearyou/Search.js b/app/component/nearyou/Search.js new file mode 100644 index 0000000000..e5e79f0f62 --- /dev/null +++ b/app/component/nearyou/Search.js @@ -0,0 +1,52 @@ +import PropTypes from 'prop-types'; +import React, { memo } from 'react'; +import DTAutoSuggest from '@digitransit-component/digitransit-component-autosuggest'; +import { intlShape } from 'react-intl'; +import { configShape } from '../../util/shapes'; +import { + withSearchContext, + getLocationSearchTargets, +} from '../WithSearchContext'; + +const DTAutoSuggestWithSearchContext = withSearchContext(DTAutoSuggest); + +function Search({ onMap, ...rest }, { config, intl }) { + const searchProps = { + id: 'origin-stop-near-you', + placeholder: 'origin', + translatedPlaceholder: onMap + ? intl.formatMessage({ id: 'move-on-map' }) + : undefined, + mobileLabel: onMap ? intl.formatMessage({ id: 'position' }) : undefined, + inputClassName: onMap ? 'origin-stop-near-you-selector' : undefined, + modeIconColors: config.colors.iconColors, + modeSet: config.iconModeSet, + getAutoSuggestIcons: config.getAutoSuggestIcons, + }; + return ( + + ); +} + +Search.propTypes = { + onMap: PropTypes.bool, +}; + +Search.defaultProps = { + onMap: false, +}; + +Search.contextTypes = { + config: configShape.isRequired, + intl: intlShape.isRequired, +}; + +export default memo(Search); From 5809c76c46c587674f8492f663835c69de5b23b0 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 10 Dec 2025 15:05:57 +0200 Subject: [PATCH 038/129] feat: convert NearYouPage to function and refactor it --- app/component/nearyou/NearYouPage.js | 604 ++++++++++++--------------- 1 file changed, 277 insertions(+), 327 deletions(-) diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index e2d8ba6fa1..c0deb2ee42 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -1,6 +1,6 @@ /* eslint-disable react/no-unstable-nested-components */ import PropTypes from 'prop-types'; -import React from 'react'; +import React, { useEffect, useState, useRef } from 'react'; import { FormattedMessage, intlShape } from 'react-intl'; import { graphql, ReactRelayContext, QueryRenderer } from 'react-relay'; import { matchShape, routerShape } from 'found'; @@ -70,81 +70,68 @@ function getModes(config) { return modes.map(nearYouMode => nearYouMode.toUpperCase()); } -class NearYouPage extends React.Component { - static contextTypes = { - config: configShape.isRequired, - executeAction: PropTypes.func.isRequired, - getStore: PropTypes.func, - intl: intlShape.isRequired, - router: routerShape.isRequired, - }; - - static propTypes = { - breakpoint: PropTypes.string.isRequired, - relayEnvironment: relayShape.isRequired, - position: locationShape.isRequired, - lang: PropTypes.string.isRequired, - match: matchShape.isRequired, - favouriteStopIds: PropTypes.arrayOf(PropTypes.string).isRequired, - favouriteStationIds: PropTypes.arrayOf(PropTypes.string).isRequired, - favouriteVehicleStationIds: PropTypes.arrayOf(PropTypes.string).isRequired, - mapLayers: mapLayerShape.isRequired, - favouritesFetched: PropTypes.bool, - currentTime: PropTypes.number.isRequired, - }; - - static defaultProps = { - favouritesFetched: false, - }; +function NearYouPage( + { + breakpoint, + relayEnvironment, + position, + lang, + match, + favouriteStopIds, + favouriteStationIds, + favouriteVehicleStationIds, + mapLayers, + favouritesFetched, + currentTime, + }, + { config, executeAction, router }, +) { + const MWTRef = useRef(); + const modes = useRef(getModes(config)); + const centerOfMap = useRef({}); + const [phase, setPhase] = useState(PH_START); + const [centerOfMapChanged, setCenterOfMapChanged] = useState(false); + const [showCityBikeTeaser, setShowCityBikeTeaser] = useState( + !getReadMessageIds().includes('citybike_teaser'), + ); + const [searchPosition, setSearchPosition] = useState({}); + const [mapLayerOptions, setMapLayerOptions] = useState({}); + // eslint-disable-next-line + const [resultsLoaded, setResultsLoaded] = useState(false); - constructor(props) { - super(props); - this.state = { - phase: PH_START, - centerOfMapChanged: false, - showCityBikeTeaser: true, - searchPosition: {}, - mapLayerOptions: {}, - // eslint-disable-next-line react/no-unused-state - resultsLoaded: false, - }; - } + const { mode } = match.params; + const allModes = modes.current; - componentDidMount() { - this.modes = getModes(this.context.config); - const readMessageIds = getReadMessageIds(); - const showCityBikeTeaser = !readMessageIds.includes('citybike_teaser'); - if (this.context.config.map.showLayerSelector) { - const { mode } = this.props.match.params; - const mapLayerOptions = getMapLayerOptions({ + const updateMapLayerOptions = () => { + if (config.map.showLayerSelector) { + const options = getMapLayerOptions({ lockedMapLayers: ['vehicles', 'citybike', 'stop'], selectedMapLayers: ['vehicles', mode.toLowerCase()], }); - this.setState({ showCityBikeTeaser, mapLayerOptions }); - } else { - this.setState({ showCityBikeTeaser }); + setMapLayerOptions(options); } + }; + + useEffect(() => { + updateMapLayerOptions(); checkPositioningPermission().then(permission => { - const { origin: matchParamsOrigin, place } = this.props.match.params; + const { origin: matchParamsOrigin, place } = match.params; const savedPermission = getGeolocationState(); const { state } = permission; - const newState = {}; - - if (matchParamsOrigin) { - newState.searchPosition = otpToLocation(matchParamsOrigin); - } else { - newState.searchPosition = this.context.config.defaultEndpoint; - } + let newSearchPosition = matchParamsOrigin + ? otpToLocation(matchParamsOrigin) + : config.defaultEndpoint; + let newPhase; if (savedPermission === 'unknown') { if (!matchParamsOrigin) { // state = 'error' means no permission api, so we assume geolocation will work if (state === 'prompt' || state === 'granted' || state === 'error') { - newState.phase = PH_SEARCH_GEOLOCATION; + newPhase = PH_SEARCH_GEOLOCATION; } else { - newState.phase = PH_SEARCH; + newPhase = PH_SEARCH; } } else { - newState.phase = PH_USEDEFAULTPOS; + newPhase = PH_USEDEFAULTPOS; } } else if ( state === 'prompt' || @@ -152,110 +139,89 @@ class NearYouPage extends React.Component { (state === 'error' && savedPermission !== 'denied') ) { // reason to expect that geolocation will work - newState.phase = PH_GEOLOCATIONING; - this.context.executeAction(startLocationWatch); + newPhase = PH_GEOLOCATIONING; + executeAction(startLocationWatch); } else if (matchParamsOrigin) { - newState.phase = PH_USEDEFAULTPOS; + newPhase = PH_USEDEFAULTPOS; } else if (state === 'error') { // No permission api. // Suggest geolocation, user may have changed permissions from browser settings - newState.phase = PH_SEARCH_GEOLOCATION; + newPhase = PH_SEARCH_GEOLOCATION; } else { // Geolocationing is known to be denied. Provide search modal - newState.phase = PH_SEARCH; + newPhase = PH_SEARCH; } if (place !== 'POS') { - newState.searchPosition = otpToLocation(place); - newState.phase = PH_USEDEFAULTPOS; + newSearchPosition = otpToLocation(place); + newPhase = PH_USEDEFAULTPOS; } - this.setState(newState); + setSearchPosition(newSearchPosition); + setPhase(newPhase); }); - } - - componentDidUpdate(prevProps) { - if (this.context.config.map.showLayerSelector) { - const { mode } = this.props.match.params; - const { mode: prevMode } = prevProps.match.params; - if (mode !== prevMode) { - this.setMapLayerOptions(); - } - } - } - - static getDerivedStateFromProps(nextProps, prevState) { - let newState = null; - if (prevState.phase === PH_GEOLOCATIONING) { - if (nextProps.position.locationingFailed) { - newState = { phase: PH_USEDEFAULTPOS }; - } else if (nextProps.position.hasLocation) { - newState = { - phase: PH_USEGEOLOCATION, - searchPosition: nextProps.position, - }; + }, []); + + useEffect(() => { + updateMapLayerOptions(); + }, [mode]); + + useEffect(() => { + if (phase === PH_GEOLOCATIONING) { + if (position.locationingFailed) { + setPhase(PH_USEDEFAULTPOS); + } else if (position.hasLocation) { + setPhase(PH_USEGEOLOCATION); + setSearchPosition(position); } - return newState; } - return newState; - } + }, [phase, position.locationingFailed, position.hasLocation]); - loadingDone = () => { + const loadingDone = () => { // trigger a state update in this component to force a rerender when stop data is received for the first time. // this fixes a bug where swipeable tabs were not keeping focusable elements up to date after receving stop data // and keyboard focus could be lost to hidden elements. // eslint-disable-next-line react/no-unused-state - this.setState({ resultsLoaded: true }); - }; - - setMapLayerOptions = () => { - const { mode } = this.props.match.params; - const mapLayerOptions = getMapLayerOptions({ - lockedMapLayers: ['vehicles', 'citybike', 'stop'], - selectedMapLayers: ['vehicles', mode.toLowerCase()], - }); - this.setState({ mapLayerOptions }); + setResultsLoaded(true); }; - getQueryVariables = mode => { - if (mode === 'FAVORITE') { + const getQueryVariables = queryMode => { + if (queryMode === 'FAVORITE') { return { - stopIds: this.props.favouriteStopIds, - stationIds: this.props.favouriteStationIds, - vehicleRentalStationIds: this.props.favouriteVehicleStationIds, + stopIds: favouriteStopIds, + stationIds: favouriteStationIds, + vehicleRentalStationIds: favouriteVehicleStationIds, }; } - const { searchPosition } = this.state; let placeTypes = ['STOP', 'STATION']; - let modes = [mode]; + let qModes = [queryMode]; let allowedNetworks = []; - if (mode === 'CITYBIKE') { + if (queryMode === 'CITYBIKE') { placeTypes = 'VEHICLE_RENT'; - modes = ['BICYCLE']; - allowedNetworks = getDefaultNetworks(this.context.config); + qModes = ['BICYCLE']; + allowedNetworks = getDefaultNetworks(config); } const prioritizedStops = - this.context.config.prioritizedStopsNearYou[mode.toLowerCase()] || []; + config.prioritizedStopsNearYou[queryMode.toLowerCase()] || []; return { lat: searchPosition.lat, lon: searchPosition.lon, maxResults: 10, - first: this.context.config.maxNearbyStopAmount, - maxDistance: - this.context.config.maxNearbyStopDistance[mode.toLowerCase()], - filterByModes: modes, + first: config.maxNearbyStopAmount, + maxDistance: config.maxNearbyStopDistance[queryMode.toLowerCase()], + filterByModes: qModes, filterByPlaceTypes: placeTypes, - omitNonPickups: this.context.config.omitNonPickups, + omitNonPickups: config.omitNonPickups, prioritizedStopIds: prioritizedStops, filterByNetwork: allowedNetworks, }; }; - setCenterOfMap = mapElement => { + const setCenterOfMap = mapElement => { let location; if (!mapElement) { - location = this.props.position; - } else if (this.props.breakpoint === 'large') { - const centerOfMap = mapElement.leafletElement.getCenter(); - location = { lat: centerOfMap.lat, lon: centerOfMap.lng }; + location = position; + } else if (breakpoint === 'large') { + const center = mapElement.leafletElement.getCenter(); + location = { lat: center.lat, lon: center.lng }; } else { // find center pixel coordinates of the visible part of the map // and convert to lat, lon @@ -271,96 +237,78 @@ class NearYouPage extends React.Component { const point = mapElement.leafletElement.containerPointToLatLng([x, y]); location = { lat: point.lat, lon: point.lng }; } - this.centerOfMap = location; - const changed = distance(location, this.state.searchPosition) > 200; - if (changed !== this.state.centerOfMapChanged) { - this.setState({ centerOfMapChanged: changed }); + centerOfMap.current = location; + const changed = distance(location, searchPosition) > 200; + if (changed !== centerOfMapChanged) { + setCenterOfMapChanged(changed); } }; // store ref to map - setMWTRef = ref => { - this.MWTRef = ref; + const setMWTRef = ref => { + MWTRef.current = ref; }; - updateLocation = () => { - const { centerOfMap } = this; - const { mode } = this.props.match.params; - if (centerOfMap?.lat && centerOfMap?.lon) { - let phase = PH_USEMAPCENTER; + const updateLocation = () => { + const center = centerOfMap.current; + if (center?.lat && center?.lon) { + let newPhase = PH_USEMAPCENTER; let type = 'CenterOfMap'; - if (centerOfMap.type === 'CurrentLocation') { - phase = PH_USEGEOLOCATION; - type = centerOfMap.type; + if (center.type === 'CurrentLocation') { + newPhase = PH_USEGEOLOCATION; + type = center.type; const path = `/${PREFIX_NEARYOU}/${mode}/POS`; - this.context.router.replace({ - ...this.props.match.location, + router.replace({ + ...match.location, pathname: path, }); } else { - const path = `/${PREFIX_NEARYOU}/${mode}/${locationToUri(centerOfMap)}`; - this.context.router.replace({ - ...this.props.match.location, + const path = `/${PREFIX_NEARYOU}/${mode}/${locationToUri(center)}`; + router.replace({ + ...match.location, pathname: path, }); } - return this.setState({ - searchPosition: { ...centerOfMap, type }, - centerOfMapChanged: false, - phase, - }); + setSearchPosition({ ...center, type }); + setCenterOfMapChanged(false); + setPhase(newPhase); + } else { + setSearchPosition(phase === PH_USEDEFAULTPOS ? searchPosition : position); } - return this.setState({ searchPosition: this.getPosition() }); - }; - - getPosition = () => { - return this.state.phase === PH_USEDEFAULTPOS - ? this.state.searchPosition - : this.props.position; }; - onSwipe = e => { - const { mode } = this.props.match.params; - const newMode = this.modes[e]; - const paramArray = this.props.match.location.pathname.split(mode); + const onSwipe = e => { + const newMode = allModes[e]; + const paramArray = match.location.pathname.split(mode); const pathParams = paramArray.length > 1 ? paramArray[1] : '/POS'; const path = `/${PREFIX_NEARYOU}/${newMode}${pathParams}`; - this.context.router.replace({ - ...this.props.match.location, + router.replace({ + ...match.location, pathname: path, }); - this.setState({ centerOfMapChanged: false }); + setCenterOfMapChanged(false); }; - noFavourites = () => { - return ( - !this.props.favouriteStopIds.length && - !this.props.favouriteStationIds.length && - !this.props.favouriteVehicleStationIds.length - ); - }; + const noFavourites = () => + !favouriteStopIds.length && + !favouriteStationIds.length && + !favouriteVehicleStationIds.length; - handleCityBikeTeaserClose = () => { + const handleCityBikeTeaserClose = () => { const readMessageIds = getReadMessageIds() || []; readMessageIds.push('citybike_teaser'); setReadMessageIds(readMessageIds); - this.setState({ showCityBikeTeaser: false }); + setShowCityBikeTeaser(false); }; - renderContent = () => { - const { centerOfMapChanged } = this.state; - const { mode } = this.props.match.params; - const noFavourites = mode === 'FAVORITE' && this.noFavourites(); - const renderUpdateButton = centerOfMapChanged && !noFavourites; - const nearByStopModes = this.modes; - const index = nearByStopModes.indexOf(mode); - const { config } = this.context; - const tabs = nearByStopModes.map(tabMode => { + const renderContent = () => { + const index = allModes.indexOf(mode); + const tabs = allModes.map(tabMode => { const renderStopRouteSearch = tabMode !== 'FERRY' && tabMode !== 'FAVORITE'; const isActive = tabMode === mode; if (tabMode === 'FAVORITE') { - const noFavs = this.noFavourites(); + const noFavs = noFavourites(); return (
- {renderUpdateButton && ( - + {centerOfMapChanged && !noFavs && ( + )} - {this.props.favouritesFetched ? ( + {favouritesFetched ? ( ) : ( @@ -427,14 +372,14 @@ class NearYouPage extends React.Component { } } `} - variables={this.getQueryVariables(tabMode)} - environment={this.props.relayEnvironment} + variables={getQueryVariables(tabMode)} + environment={relayEnvironment} render={({ props }) => { const { vehicleRental } = config; // Use buy instructions if available const cityBikeBuyUrl = vehicleRental.buyUrl; const buyInstructions = cityBikeBuyUrl - ? vehicleRental.buyInstructions?.[this.props.lang] + ? vehicleRental.buyInstructions?.[lang] : undefined; let cityBikeNetworkUrl; @@ -449,23 +394,20 @@ class NearYouPage extends React.Component { config.prioritizedStopsNearYou[tabMode.toLowerCase()]; const favouriteIds = mode === 'CITYBIKE' - ? new Set(this.props.favouriteVehicleStationIds) - : new Set([ - ...this.props.favouriteStopIds, - ...this.props.favouriteStationIds, - ]); + ? new Set(favouriteVehicleStationIds) + : new Set([...favouriteStopIds, ...favouriteStationIds]); return (
{renderStopRouteSearch && ( )} - {this.state.showCityBikeTeaser && + {showCityBikeTeaser && tabMode === 'CITYBIKE' && (cityBikeBuyUrl || cityBikeNetworkUrl) && (
@@ -480,10 +422,10 @@ class NearYouPage extends React.Component { isKeyboardSelectionEvent(e) && (e.keyCode === 13 || e.keyCode === 32) ) { - this.handleCityBikeTeaserClose(); + handleCityBikeTeaserClose(); } }} - onClick={this.handleCityBikeTeaserClose} + onClick={handleCityBikeTeaserClose} role="button" > @@ -505,7 +447,7 @@ class NearYouPage extends React.Component { )} {cityBikeBuyUrl && ( @@ -532,10 +473,10 @@ class NearYouPage extends React.Component {
)} - {renderUpdateButton && ( + {centerOfMapChanged && ( )} {prioritizedStops?.length && ( @@ -561,7 +502,7 @@ class NearYouPage extends React.Component { startTime: 0, omitNonPickups: false, }} - environment={this.props.relayEnvironment} + environment={relayEnvironment} render={res => { if (res.props) { return ( @@ -571,7 +512,7 @@ class NearYouPage extends React.Component { ); @@ -590,15 +531,16 @@ class NearYouPage extends React.Component { )} {props && ( )} @@ -614,11 +556,9 @@ class NearYouPage extends React.Component { return ( ); @@ -626,133 +566,143 @@ class NearYouPage extends React.Component { return tabs[0]; }; - renderMap = () => ( + const renderMap = () => ( ); - handleClose = () => { - this.setState({ phase: PH_USEDEFAULTPOS }); - }; + const handleClose = () => setPhase(PH_USEDEFAULTPOS); - handleStartGeolocation = () => { - this.context.executeAction(startLocationWatch); - this.setState({ phase: PH_GEOLOCATIONING }); + const handleStartGeolocation = () => { + executeAction(startLocationWatch); + setPhase(PH_GEOLOCATIONING); }; - selectHandler = item => { - const { mode } = this.props.match.params; + const selectHandler = item => { const path = `/${PREFIX_NEARYOU}/${mode}/${locationToUri(item)}`; - this.context.router.replace({ - ...this.props.match.location, + router.replace({ + ...match.location, pathname: path, }); - this.centerOfMap = null; - this.setState({ - phase: PH_USEDEFAULTPOS, - searchPosition: item, - centerOfMapChanged: false, - }); + centerOfMap.current = {}; + setPhase(PH_USEDEFAULTPOS); + setSearchPosition(item); + setCenterOfMapChanged(false); }; - search = onMap => ( + const search = onMap => ( ); - mapSearch = () => { - return ( -
{this.search(true)}
- ); + const mapSearch = () => { + return
{search(true)}
; }; - render() { - const { mode } = this.props.match.params; - const { phase } = this.state; - const nearByStopModes = this.modes; - - if (PH_SHOWSEARCH.includes(phase)) { - return ( - - {this.search(false)} - - ); - } - if (PH_READY.includes(phase)) { - return ( - ( - - ) : ( - - ), - }} - /> - ) - } - bckBtnFallback="back" - content={this.renderContent()} - scrollable={nearByStopModes.length === 1} - map={ - <> - {this.mapSearch()} - {this.renderMap()} - - } - /> - )} - mobile={() => ( - - )} - /> - ); - } - return ; + if (PH_SHOWSEARCH.includes(phase)) { + return ( + + {search(false)} + + ); + } + if (PH_READY.includes(phase)) { + return ( + ( + + ) : ( + + ), + }} + /> + ) + } + bckBtnFallback="back" + content={renderContent()} + scrollable={allModes.length === 1} + map={ + <> + {mapSearch()} + {renderMap()} + + } + /> + )} + mobile={() => ( + + )} + /> + ); } + return ; } +NearYouPage.contextTypes = { + config: configShape.isRequired, + executeAction: PropTypes.func.isRequired, + getStore: PropTypes.func, + intl: intlShape.isRequired, + router: routerShape.isRequired, +}; + +NearYouPage.propTypes = { + breakpoint: PropTypes.string.isRequired, + relayEnvironment: relayShape.isRequired, + position: locationShape.isRequired, + lang: PropTypes.string.isRequired, + match: matchShape.isRequired, + favouriteStopIds: PropTypes.arrayOf(PropTypes.string).isRequired, + favouriteStationIds: PropTypes.arrayOf(PropTypes.string).isRequired, + favouriteVehicleStationIds: PropTypes.arrayOf(PropTypes.string).isRequired, + mapLayers: mapLayerShape.isRequired, + favouritesFetched: PropTypes.bool, + currentTime: PropTypes.number.isRequired, +}; + +NearYouPage.defaultProps = { + favouritesFetched: false, +}; + const NearYouPageWithBreakpoint = withBreakpoint(props => ( {({ environment }) => ( From f73ff90e4e5c7263c90d587a2420ccd236e7d057 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 11 Dec 2025 14:13:59 +0200 Subject: [PATCH 039/129] fix: update renamed props in map component, too --- app/component/map/NearYouMap.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/component/map/NearYouMap.js b/app/component/map/NearYouMap.js index 6f330dbaaa..6b37726416 100644 --- a/app/component/map/NearYouMap.js +++ b/app/component/map/NearYouMap.js @@ -131,14 +131,14 @@ const getLocationMarker = location => { function NearYouMap( { breakpoint, - stopsNearYou, + stops, match, loading, favouriteIds, relay, position, showWalkRoute, - prioritizedStopsNearYou, + prioritizedStops, setMWTRef, ...rest }, @@ -298,8 +298,8 @@ function NearYouMap( }, [uniqueRealtimeTopics]); useEffect(() => { - if (stopsNearYou?.nearest?.edges) { - const active = stopsNearYou.nearest.edges + if (stops?.nearest?.edges) { + const active = stops.nearest.edges .slice() .filter( stop => @@ -312,7 +312,7 @@ function NearYouMap( } let sortedEdges; if (!isTransitMode) { - const withNetworks = stopsNearYou.nearest.edges.filter(edge => { + const withNetworks = stops.nearest.edges.filter(edge => { return !!edge.node.place?.rentalNetwork?.networkId; }); const filteredCityBikeEdges = withNetworks.filter(pattern => { @@ -330,7 +330,7 @@ function NearYouMap( } sortedEdges.unshift( - ...prioritizedStopsNearYou.map(stop => { + ...prioritizedStops.map(stop => { return { node: { distance: distance(position, stop), @@ -347,11 +347,11 @@ function NearYouMap( updateRoutes(sortedEdges); } if (mode === 'FAVORITE') { - handleWalkRoutes(handleStopsAndStations(stopsNearYou)); - setSortedStopEdges(stopsNearYou); - updateRoutes(stopsNearYou); + handleWalkRoutes(handleStopsAndStations(stops)); + setSortedStopEdges(stops); + updateRoutes(stops); } - }, [stopsNearYou, favouriteIds]); + }, [stops, favouriteIds]); if (loading) { return ; @@ -431,7 +431,7 @@ function NearYouMap( } NearYouMap.propTypes = { - stopsNearYou: PropTypes.oneOfType([ + stops: PropTypes.oneOfType([ PropTypes.shape({ nearest: PropTypes.shape({ // eslint-disable-next-line @@ -440,7 +440,7 @@ NearYouMap.propTypes = { }), PropTypes.arrayOf(PropTypes.object), ]), - prioritizedStopsNearYou: PropTypes.arrayOf(stopShape), + prioritizedStops: PropTypes.arrayOf(stopShape), // eslint-disable-next-line favouriteIds: PropTypes.object.isRequired, position: locationShape.isRequired, @@ -453,11 +453,11 @@ NearYouMap.propTypes = { }; NearYouMap.defaultProps = { - stopsNearYou: null, + stops: null, showWalkRoute: false, loading: false, setMWTRef: undefined, - prioritizedStopsNearYou: [], + prioritizedStops: [], }; NearYouMap.contextTypes = { From 94aa51687d432ab49e355d44de773fed7563b2b5 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 17 Dec 2025 10:37:54 +0200 Subject: [PATCH 040/129] fix: buggy LocationMarker key, remove unnecessary wrapper func --- app/component/map/NearYouMap.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/app/component/map/NearYouMap.js b/app/component/map/NearYouMap.js index 6b37726416..ea7ea94514 100644 --- a/app/component/map/NearYouMap.js +++ b/app/component/map/NearYouMap.js @@ -118,16 +118,6 @@ const handleBounds = (location, edges) => { return bounds; }; -const getLocationMarker = location => { - return ( - - ); -}; - function NearYouMap( { breakpoint, @@ -395,7 +385,13 @@ function NearYouMap( // Marker for the search point. if (position.type !== 'CurrentLocation' && showWalkRoute) { - leafletObjs.push(getLocationMarker(position)); + leafletObjs.push( + , + ); } const mapProps = { From 6ec7a3cb09b431aa52f7f16e386cdbd3decdef2a Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 17 Dec 2025 11:48:08 +0200 Subject: [PATCH 041/129] chore: refactor route and vehicle drawing on near you map --- app/component/map/NearYouMap.js | 37 +++++++++++---------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/app/component/map/NearYouMap.js b/app/component/map/NearYouMap.js index ea7ea94514..5f2752769d 100644 --- a/app/component/map/NearYouMap.js +++ b/app/component/map/NearYouMap.js @@ -224,41 +224,29 @@ function NearYouMap( } }, [position, sortedStopEdges]); - const updateRoutes = sortedRoutes => { + const updateRoutes = places => { let patterns = []; const realtimeTopics = []; - sortedRoutes.forEach(item => { + places.forEach(item => { const { place } = item.node; - // eslint-disable-next-line no-unused-expressions - place.patterns && - place.patterns.forEach(pattern => { - const feedId = pattern.route.gtfsId.split(':')[0]; + const stopArray = place.stops || [place]; // station stops, single stop or other place + stopArray.forEach(stop => { + stop.patterns?.forEach(pattern => { + const [feedId, route] = pattern.route.gtfsId.split(':'); realtimeTopics.push({ feedId, - route: pattern.route.gtfsId.split(':')[1], + route, shortName: pattern.route.shortName, type: pattern.route.type, }); patterns.push(pattern); }); - // eslint-disable-next-line no-unused-expressions - place.stops && - place.stops.forEach(stop => { - stop.patterns.forEach(pattern => { - const feedId = pattern.route.gtfsId.split(':')[0]; - realtimeTopics.push({ - feedId, - route: pattern.route.gtfsId.split(':')[1], - shortName: pattern.route.shortName, - type: pattern.route.type, - }); - patterns.push(pattern); - }); - }); + }); }); + patterns = uniqBy(patterns, p => p.patternGeometry?.points || ''); const lines = patterns - .filter(p => p.patternGeometry) + .filter(p => p.patternGeometry?.points) .map(p => ( )); setRouteLines(lines); - setUniqueRealtimeTopics(uniqBy(realtimeTopics, route => route.route)); + setUniqueRealtimeTopics(uniqBy(realtimeTopics, topic => topic.route)); }; useEffect(() => { @@ -347,8 +335,7 @@ function NearYouMap( return ; } - const leafletObjs = - isTransitMode && Array.isArray(routeLines) ? [...routeLines] : []; + const leafletObjs = isTransitMode ? [...routeLines] : []; if (uniqueRealtimeTopics.length > 0) { leafletObjs.push( Date: Wed, 17 Dec 2025 13:15:25 +0200 Subject: [PATCH 042/129] chore: refactor near you map more --- app/component/map/NearYouMap.js | 46 ++++++------------- .../nearyou/NearYouFavouritesMapContainer.js | 2 +- 2 files changed, 16 insertions(+), 32 deletions(-) diff --git a/app/component/map/NearYouMap.js b/app/component/map/NearYouMap.js index 5f2752769d..258dff9e91 100644 --- a/app/component/map/NearYouMap.js +++ b/app/component/map/NearYouMap.js @@ -3,7 +3,6 @@ import PropTypes from 'prop-types'; import { matchShape } from 'found'; import { fetchQuery } from 'react-relay'; import uniqBy from 'lodash/uniqBy'; -import compact from 'lodash/compact'; import isEqual from 'lodash/isEqual'; import polyline from 'polyline-encoded'; import distance from '@digitransit-search-util/digitransit-search-util-distance'; @@ -36,11 +35,9 @@ import { walkQuery } from './WalkQuery'; import LocationMarker from './LocationMarker'; const handleStopsAndStations = edges => { - const stopsAndStations = edges.map(({ node }) => { - const stop = { ...node.place, distance: node.distance }; - return stop; + return edges.map(({ node }) => { + return { ...node.place, distance: node.distance }; }); - return compact(stopsAndStations); }; const getRealTimeSettings = (routes, context) => { @@ -132,7 +129,7 @@ function NearYouMap( setMWTRef, ...rest }, - { ...context }, + context, ) { const [sortedStopEdges, setSortedStopEdges] = useState([]); const [uniqueRealtimeTopics, setUniqueRealtimeTopics] = useState([]); @@ -140,18 +137,17 @@ function NearYouMap( const [bounds, setBounds] = useState([]); const [clientOn, setClientOn] = useState(false); const [walk, setWalk] = useState({ itinerary: null, stop: null }); - const prevPlace = useRef(); - const prevMode = useRef(); const mwtRef = useRef(); const { mode } = match.params; const isTransitMode = mode !== 'CITYBIKE'; const walkRoutingThreshold = mode === 'RAIL' || mode === 'SUBWAY' || mode === 'FERRY' ? 3000 : 1500; const { environment } = relay; + const { config } = context; const fetchPlan = stop => { if (stop.distance < walkRoutingThreshold) { - const settings = getSettings(context.config); + const settings = getSettings(config); const variables = { origin: { location: { @@ -209,8 +205,6 @@ function NearYouMap( }; useEffect(() => { - prevPlace.current = match.params.place; - prevMode.current = match.params.mode; return function cleanup() { stopClient(context); }; @@ -264,13 +258,8 @@ function NearYouMap( if (!clientOn) { startClient(context, uniqueRealtimeTopics); setClientOn(true); - } else if ( - match.params.place !== prevPlace.current || - match.params.mode !== prevMode.current - ) { + } else { updateClient(context, uniqueRealtimeTopics); - prevPlace.current = match.params.place; - prevMode.current = match.params.mode; } } }, [uniqueRealtimeTopics]); @@ -279,11 +268,7 @@ function NearYouMap( if (stops?.nearest?.edges) { const active = stops.nearest.edges .slice() - .filter( - stop => - stop.node.place.stoptimesWithoutPatterns && - stop.node.place.stoptimesWithoutPatterns.length, - ); + .filter(stop => stop.node.place.stoptimesWithoutPatterns?.length); if (isTransitMode && !active.length && relay.hasMore()) { relay.loadMore(5); return; @@ -294,7 +279,7 @@ function NearYouMap( return !!edge.node.place?.rentalNetwork?.networkId; }); const filteredCityBikeEdges = withNetworks.filter(pattern => { - return getDefaultNetworks(context.config).includes( + return getDefaultNetworks(config).includes( pattern.node.place?.rentalNetwork.networkId, ); }); @@ -319,8 +304,7 @@ function NearYouMap( }; }), ); - const stopsAndStations = handleStopsAndStations(sortedEdges); - handleWalkRoutes(stopsAndStations); + handleWalkRoutes(handleStopsAndStations(sortedEdges)); setSortedStopEdges(sortedEdges); updateRoutes(sortedEdges); } @@ -360,14 +344,14 @@ function NearYouMap( const highlightedStops = () => { const stopsAndStations = handleStopsAndStations(sortedStopEdges); - if (Array.isArray(stopsAndStations) && stopsAndStations.length > 0) { + if (stopsAndStations.length) { return [ - stopsAndStations[0]?.gtfsId || - stopsAndStations[0]?.stationId || + stopsAndStations[0].gtfsId || + stopsAndStations[0].stationId || stopsAndStations[0].node.place.gtfsId, ]; } - return ['']; + return []; }; // Marker for the search point. @@ -395,7 +379,7 @@ function NearYouMap( if (breakpoint === 'large') { return ( <> - {context.config.useCookiesPrompt && } + {config.useCookiesPrompt && } ); @@ -405,7 +389,7 @@ function NearYouMap( diff --git a/app/component/nearyou/NearYouFavouritesMapContainer.js b/app/component/nearyou/NearYouFavouritesMapContainer.js index 6bc33790da..27e9101379 100644 --- a/app/component/nearyou/NearYouFavouritesMapContainer.js +++ b/app/component/nearyou/NearYouFavouritesMapContainer.js @@ -61,7 +61,7 @@ function NearYouFavouritesMapContainer(props) { stopList.sort((a, b) => a.node.distance - b.node.distance); - return ; + return ; } NearYouFavouritesMapContainer.propTypes = { From 9cf81006a878d9ae894eced5d18efc60961a2aa9 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 17 Dec 2025 15:53:46 +0200 Subject: [PATCH 043/129] fix: remove unnecessary stop list conversion to another data type, refactor more --- app/component/map/NearYouMap.js | 89 +++++++++++++-------------------- 1 file changed, 35 insertions(+), 54 deletions(-) diff --git a/app/component/map/NearYouMap.js b/app/component/map/NearYouMap.js index 258dff9e91..2acbbbe0aa 100644 --- a/app/component/map/NearYouMap.js +++ b/app/component/map/NearYouMap.js @@ -34,11 +34,10 @@ import CookieSettingsButton from '../CookieSettingsButton'; import { walkQuery } from './WalkQuery'; import LocationMarker from './LocationMarker'; -const handleStopsAndStations = edges => { - return edges.map(({ node }) => { - return { ...node.place, distance: node.distance }; - }); -}; +function getId(edge) { + const { place } = edge.node; + return place.gtfsId || place.stationId || place.id; +} const getRealTimeSettings = (routes, context) => { const { realTime } = context.config; @@ -61,7 +60,7 @@ const getRealTimeSettings = (routes, context) => { }); const source = feedId && realTime[feedId]; - if (source && source.active) { + if (source?.active) { return { ...source, feedId, @@ -135,8 +134,8 @@ function NearYouMap( const [uniqueRealtimeTopics, setUniqueRealtimeTopics] = useState([]); const [routeLines, setRouteLines] = useState([]); const [bounds, setBounds] = useState([]); - const [clientOn, setClientOn] = useState(false); const [walk, setWalk] = useState({ itinerary: null, stop: null }); + const clientOn = useRef(false); const mwtRef = useRef(); const { mode } = match.params; const isTransitMode = mode !== 'CITYBIKE'; @@ -145,8 +144,8 @@ function NearYouMap( const { environment } = relay; const { config } = context; - const fetchPlan = stop => { - if (stop.distance < walkRoutingThreshold) { + const fetchPlan = node => { + if (node.distance < walkRoutingThreshold) { const settings = getSettings(config); const variables = { origin: { @@ -156,7 +155,7 @@ function NearYouMap( }, destination: { location: { - coordinate: { latitude: stop.lat, longitude: stop.lon }, + coordinate: { latitude: node.place.lat, longitude: node.place.lon }, }, }, walkSpeed: settings.walkSpeed, @@ -167,31 +166,28 @@ function NearYouMap( .then(result => { setWalk({ itinerary: result.plan.edges.length - ? result.plan.edges?.[0].node + ? result.plan.edges[0].node : null, - stop, + node, }); }); } else { - setWalk({ itinerary: null, stop }); + setWalk({ itinerary: null, node }); } }; - const handleWalkRoutes = stopsAndStations => { - if (showWalkRoute) { - if (stopsAndStations.length > 0) { - const firstStop = stopsAndStations[0]; - const shouldFetch = - (mode !== 'BUS' && mode !== 'TRAM') || - favouriteIds.has(firstStop.gtfsId); - if (shouldFetch && !isEqual(firstStop, walk.stop)) { - fetchPlan(firstStop); - } else if (!shouldFetch) { - setWalk({ itinerary: null, stop: null }); - } + const handleWalkRoutes = edges => { + if (showWalkRoute && edges.length > 0) { + const first = edges[0]; + const shouldFetch = + (mode !== 'BUS' && mode !== 'TRAM') || favouriteIds.has(getId(first)); + if (shouldFetch && !isEqual(first.node, walk.node)) { + fetchPlan(first.node); + } else if (!shouldFetch) { + setWalk({ itinerary: null, node: null }); } } else { - setWalk({ itinerary: null, stop: null }); + setWalk({ itinerary: null, node: null }); } }; @@ -218,10 +214,10 @@ function NearYouMap( } }, [position, sortedStopEdges]); - const updateRoutes = places => { + const updateRoutes = edges => { let patterns = []; const realtimeTopics = []; - places.forEach(item => { + edges.forEach(item => { const { place } = item.node; const stopArray = place.stops || [place]; // station stops, single stop or other place stopArray.forEach(stop => { @@ -255,9 +251,9 @@ function NearYouMap( useEffect(() => { if (uniqueRealtimeTopics.length > 0) { - if (!clientOn) { + if (!clientOn.current) { startClient(context, uniqueRealtimeTopics); - setClientOn(true); + clientOn.current = true; } else { updateClient(context, uniqueRealtimeTopics); } @@ -265,7 +261,8 @@ function NearYouMap( }, [uniqueRealtimeTopics]); useEffect(() => { - if (stops?.nearest?.edges) { + let sortedEdges; + if (stops.nearest?.edges) { const active = stops.nearest.edges .slice() .filter(stop => stop.node.place.stoptimesWithoutPatterns?.length); @@ -273,7 +270,6 @@ function NearYouMap( relay.loadMore(5); return; } - let sortedEdges; if (!isTransitMode) { const withNetworks = stops.nearest.edges.filter(edge => { return !!edge.node.place?.rentalNetwork?.networkId; @@ -304,15 +300,12 @@ function NearYouMap( }; }), ); - handleWalkRoutes(handleStopsAndStations(sortedEdges)); - setSortedStopEdges(sortedEdges); - updateRoutes(sortedEdges); - } - if (mode === 'FAVORITE') { - handleWalkRoutes(handleStopsAndStations(stops)); - setSortedStopEdges(stops); - updateRoutes(stops); + } else if (mode === 'FAVORITE') { + sortedEdges = stops; } + handleWalkRoutes(sortedEdges); + setSortedStopEdges(sortedEdges); + updateRoutes(sortedEdges); }, [stops, favouriteIds]); if (loading) { @@ -342,18 +335,6 @@ function NearYouMap( ); } - const highlightedStops = () => { - const stopsAndStations = handleStopsAndStations(sortedStopEdges); - if (stopsAndStations.length) { - return [ - stopsAndStations[0].gtfsId || - stopsAndStations[0].stationId || - stopsAndStations[0].node.place.gtfsId, - ]; - } - return []; - }; - // Marker for the search point. if (position.type !== 'CurrentLocation' && showWalkRoute) { leafletObjs.push( @@ -367,7 +348,7 @@ function NearYouMap( const mapProps = { stopsToShow: mode === 'FAVORITE' ? Array.from(favouriteIds) : undefined, - highlightedStops: highlightedStops(), + highlightedStops: sortedStopEdges.length ? [getId(sortedStopEdges[0])] : [], mergeStops: false, bounds, leafletObjs, @@ -420,7 +401,7 @@ NearYouMap.propTypes = { }; NearYouMap.defaultProps = { - stops: null, + stops: [], showWalkRoute: false, loading: false, setMWTRef: undefined, From 35ad0ee8d31a4782c4019a7534396520b87bda09 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 17 Dec 2025 16:44:40 +0200 Subject: [PATCH 044/129] fix: show vehicles on favourites near you map This has apparently been always broken --- app/component/map/NearYouMap.js | 2 +- app/component/map/VehicleMarkerContainer.js | 2 ++ app/component/nearyou/NearYouFavouritesMapContainer.js | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/component/map/NearYouMap.js b/app/component/map/NearYouMap.js index 2acbbbe0aa..efc0ae37c9 100644 --- a/app/component/map/NearYouMap.js +++ b/app/component/map/NearYouMap.js @@ -318,7 +318,7 @@ function NearYouMap( , ); diff --git a/app/component/map/VehicleMarkerContainer.js b/app/component/map/VehicleMarkerContainer.js index 1c45929bc9..5f85db9838 100644 --- a/app/component/map/VehicleMarkerContainer.js +++ b/app/component/map/VehicleMarkerContainer.js @@ -148,11 +148,13 @@ VehicleMarkerContainer.propTypes = { }).isRequired, ).isRequired, useLargeIcon: PropTypes.bool, + mode: PropTypes.string, }; VehicleMarkerContainer.defaultProps = { direction: undefined, useLargeIcon: true, + mode: undefined, }; VehicleMarkerContainer.contextTypes = { diff --git a/app/component/nearyou/NearYouFavouritesMapContainer.js b/app/component/nearyou/NearYouFavouritesMapContainer.js index 27e9101379..ad98062469 100644 --- a/app/component/nearyou/NearYouFavouritesMapContainer.js +++ b/app/component/nearyou/NearYouFavouritesMapContainer.js @@ -87,6 +87,7 @@ const containerComponent = createFragmentContainer( gtfsId shortName mode + type } code directionId @@ -113,6 +114,7 @@ const containerComponent = createFragmentContainer( gtfsId shortName mode + type } code directionId From 5e85d2959272857bad3027e29ce9e0f8bad0ab90 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 18 Dec 2025 07:45:26 +0200 Subject: [PATCH 045/129] fix: remove unused query fields and arguments from fav map container --- .../nearyou/NearYouFavouritesMapContainer.js | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/app/component/nearyou/NearYouFavouritesMapContainer.js b/app/component/nearyou/NearYouFavouritesMapContainer.js index ad98062469..9bda7411da 100644 --- a/app/component/nearyou/NearYouFavouritesMapContainer.js +++ b/app/component/nearyou/NearYouFavouritesMapContainer.js @@ -31,13 +31,13 @@ function NearYouFavouritesMapContainer(props) { stopList.push( ...stations .filter(s => s) - .map(stop => { + .map(station => { return { type: 'station', node: { - distance: distance(position, stop), + distance: distance(position, station), place: { - ...stop, + ...station, }, }, }; @@ -46,13 +46,13 @@ function NearYouFavouritesMapContainer(props) { stopList.push( ...vehicleStations .filter(s => s) - .map(stop => { + .map(station => { return { type: 'vehicleRentalStation', node: { - distance: distance(position, stop), + distance: distance(position, station), place: { - ...stop, + ...station, }, }, }; @@ -76,12 +76,10 @@ const containerComponent = createFragmentContainer( { stops: graphql` fragment NearYouFavouritesMapContainer_stops on Stop - @relay(plural: true) - @argumentDefinitions(startTime: { type: "Long!", defaultValue: 0 }) { + @relay(plural: true) { gtfsId lat lon - name patterns { route { gtfsId @@ -90,24 +88,18 @@ const containerComponent = createFragmentContainer( type } code - directionId patternGeometry { points } } - stoptimesWithoutPatterns(startTime: $startTime, omitNonPickups: true) { - scheduledArrival - } } `, stations: graphql` fragment NearYouFavouritesMapContainer_stations on Stop - @relay(plural: true) - @argumentDefinitions(startTime: { type: "Long!", defaultValue: 0 }) { + @relay(plural: true) { gtfsId lat lon - name stops { patterns { route { @@ -117,15 +109,11 @@ const containerComponent = createFragmentContainer( type } code - directionId patternGeometry { points } } } - stoptimesWithoutPatterns(startTime: $startTime, omitNonPickups: true) { - scheduledArrival - } } `, vehicleStations: graphql` From 0d72539bcc103a1bff4251642bad97f19c65ea1e Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 18 Dec 2025 08:00:33 +0200 Subject: [PATCH 046/129] fix: remove triple code in favourite mapping --- .../nearyou/NearYouFavouritesMapContainer.js | 62 ++++--------------- 1 file changed, 13 insertions(+), 49 deletions(-) diff --git a/app/component/nearyou/NearYouFavouritesMapContainer.js b/app/component/nearyou/NearYouFavouritesMapContainer.js index 9bda7411da..094d8f8622 100644 --- a/app/component/nearyou/NearYouFavouritesMapContainer.js +++ b/app/component/nearyou/NearYouFavouritesMapContainer.js @@ -12,56 +12,20 @@ import { function NearYouFavouritesMapContainer(props) { const { stops, stations, vehicleStations, position } = props; - const stopList = []; - stopList.push( - ...stops - .filter(s => s) - .map(stop => { - return { - type: 'stop', - node: { - distance: distance(position, stop), - place: { - ...stop, - }, - }, - }; - }), - ); - stopList.push( - ...stations - .filter(s => s) - .map(station => { - return { - type: 'station', - node: { - distance: distance(position, station), - place: { - ...station, - }, - }, - }; - }), - ); - stopList.push( - ...vehicleStations - .filter(s => s) - .map(station => { - return { - type: 'vehicleRentalStation', - node: { - distance: distance(position, station), - place: { - ...station, - }, - }, - }; - }), - ); + const favs = [...stops, ...stations, ...vehicleStations]; + const edges = favs + .filter(s => s) + .map(stop => { + return { + node: { + distance: distance(position, stop), + place: { ...stop }, + }, + }; + }) + .sort((a, b) => a.node.distance - b.node.distance); - stopList.sort((a, b) => a.node.distance - b.node.distance); - - return ; + return ; } NearYouFavouritesMapContainer.propTypes = { From 1b9028656361836e1757a0268bd753bc3e65052d Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 18 Dec 2025 08:24:23 +0200 Subject: [PATCH 047/129] fix: remove unncessary near youy map container query fields and arguments --- app/component/nearyou/MapWrapper.js | 2 -- app/component/nearyou/NearYouMapContainer.js | 25 -------------------- app/configurations/config.hsl.js | 2 +- 3 files changed, 1 insertion(+), 28 deletions(-) diff --git a/app/component/nearyou/MapWrapper.js b/app/component/nearyou/MapWrapper.js index 0dcd21eed0..04e7597881 100644 --- a/app/component/nearyou/MapWrapper.js +++ b/app/component/nearyou/MapWrapper.js @@ -104,7 +104,6 @@ export default function MapWrapper( $first: Int! $maxResults: Int! $maxDistance: Int! - $omitNonPickups: Boolean! $prioritizedStopIds: [String!]! $filterByNetwork: [String!] ) { @@ -118,7 +117,6 @@ export default function MapWrapper( first: $first maxResults: $maxResults maxDistance: $maxDistance - omitNonPickups: $omitNonPickups filterByNetwork: $filterByNetwork ) } diff --git a/app/component/nearyou/NearYouMapContainer.js b/app/component/nearyou/NearYouMapContainer.js index f356a9a169..b5c1109167 100644 --- a/app/component/nearyou/NearYouMapContainer.js +++ b/app/component/nearyou/NearYouMapContainer.js @@ -7,8 +7,6 @@ const containerComponent = createPaginationContainer( stops: graphql` fragment NearYouMapContainer_stops on QueryType @argumentDefinitions( - startTime: { type: "Long!", defaultValue: 0 } - omitNonPickups: { type: "Boolean!", defaultValue: false } lat: { type: "Float!" } lon: { type: "Float!", defaultValue: 0 } filterByPlaceTypes: { type: "[FilterPlaceType]", defaultValue: null } @@ -36,19 +34,14 @@ const containerComponent = createPaginationContainer( place { __typename ... on VehicleRentalStation { - name lat lon stationId - rentalNetwork { - networkId - } } ... on Stop { gtfsId lat lon - name patterns { route { gtfsId @@ -57,7 +50,6 @@ const containerComponent = createPaginationContainer( type } code - directionId patternGeometry { points } @@ -71,18 +63,11 @@ const containerComponent = createPaginationContainer( type } code - directionId patternGeometry { points } } } - stoptimesWithoutPatterns( - startTime: $startTime - omitNonPickups: $omitNonPickups - ) { - scheduledArrival - } } } } @@ -96,7 +81,6 @@ const containerComponent = createPaginationContainer( gtfsId lat lon - name stops { patterns { route { @@ -106,7 +90,6 @@ const containerComponent = createPaginationContainer( type } code - directionId patternGeometry { points } @@ -119,14 +102,10 @@ const containerComponent = createPaginationContainer( mode } code - directionId patternGeometry { points } } - stoptimesWithoutPatterns { - scheduledArrival - } } `, }, @@ -158,15 +137,11 @@ const containerComponent = createPaginationContainer( $after: String $maxResults: Int! $maxDistance: Int! - $startTime: Long! - $omitNonPickups: Boolean! $filterByNetwork: [String!] ) { viewer { ...NearYouMapContainer_stops @arguments( - startTime: $startTime - omitNonPickups: $omitNonPickups lat: $lat lon: $lon filterByPlaceTypes: $filterByPlaceTypes diff --git a/app/configurations/config.hsl.js b/app/configurations/config.hsl.js index d2bfbe7b6c..559a3951cb 100644 --- a/app/configurations/config.hsl.js +++ b/app/configurations/config.hsl.js @@ -467,7 +467,7 @@ export default { season: { preSeasonStart: '18.3', start: '1.4', - end: '31.11', + end: '30.12', }, capacity: BIKEAVL_WITHMAX, icon: 'citybike', From 453d70d8fef86951d82103e136d3ec73da08cc82 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 18 Dec 2025 08:44:22 +0200 Subject: [PATCH 048/129] fix: remove strange relay.loadMore from near you map --- app/component/map/NearYouMap.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/app/component/map/NearYouMap.js b/app/component/map/NearYouMap.js index efc0ae37c9..aadb962f8e 100644 --- a/app/component/map/NearYouMap.js +++ b/app/component/map/NearYouMap.js @@ -263,13 +263,6 @@ function NearYouMap( useEffect(() => { let sortedEdges; if (stops.nearest?.edges) { - const active = stops.nearest.edges - .slice() - .filter(stop => stop.node.place.stoptimesWithoutPatterns?.length); - if (isTransitMode && !active.length && relay.hasMore()) { - relay.loadMore(5); - return; - } if (!isTransitMode) { const withNetworks = stops.nearest.edges.filter(edge => { return !!edge.node.place?.rentalNetwork?.networkId; @@ -283,7 +276,7 @@ function NearYouMap( .slice() .sort(sortNearbyRentalStations(favouriteIds)); } else { - sortedEdges = active + sortedEdges = stops.nearest.edges .slice() .sort(sortNearbyStops(favouriteIds, walkRoutingThreshold)); } From 2790c7b5c691d99462e9c239f0132883622e33fa Mon Sep 17 00:00:00 2001 From: Janne Antikainen Date: Fri, 19 Dec 2025 11:56:36 +0200 Subject: [PATCH 049/129] Enable car ferries for Kela configuration --- app/component/itinerary/StreetModeSelectorButton.js | 2 +- app/configurations/config.kela.js | 4 +++- app/util/legUtils.js | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/component/itinerary/StreetModeSelectorButton.js b/app/component/itinerary/StreetModeSelectorButton.js index f9ebaf11b9..540879aacc 100644 --- a/app/component/itinerary/StreetModeSelectorButton.js +++ b/app/component/itinerary/StreetModeSelectorButton.js @@ -42,7 +42,7 @@ export default function StreetModeSelectorButton( break; case streetHash.carAndVehicle: distance = displayDistance( - getTotalDrivingDistance(itinerary), + getTotalDrivingDistance(itinerary, config), config, intl.formatNumber, ); diff --git a/app/configurations/config.kela.js b/app/configurations/config.kela.js index bd98d4d70f..f217b4a0d9 100644 --- a/app/configurations/config.kela.js +++ b/app/configurations/config.kela.js @@ -49,7 +49,9 @@ export default { }, ], }, - + carBoardingModes: { + FERRY: { showNotification: false }, + }, transportModes: { citybike: { availableForSelection: false, diff --git a/app/util/legUtils.js b/app/util/legUtils.js index 966527156e..dd37dd4358 100644 --- a/app/util/legUtils.js +++ b/app/util/legUtils.js @@ -528,7 +528,11 @@ export function getTotalBikingDistance(itinerary) { return sumDistances(itinerary.legs.filter(isBikingLeg)); } -export function getTotalDrivingDistance(itinerary) { +export function getTotalDrivingDistance(itinerary, config = {}) { + // Don't rely only driving legs when calculating the one way journey. + if (config?.emphasizeOneWayJourney) { + return sumDistances(itinerary.legs); + } return sumDistances(itinerary.legs.filter(isDrivingLeg)); } From d893c857aa727d8cffb62d1671df63a74a7f8ce8 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 23 Dec 2025 09:46:36 +0200 Subject: [PATCH 050/129] chore: simplify nearyou code more --- app/component/nearyou/NearYouContainer.js | 18 +++-- app/component/nearyou/NearYouMapContainer.js | 1 + app/component/nearyou/NearYouPage.js | 70 +++++++++----------- 3 files changed, 39 insertions(+), 50 deletions(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index e4106912b9..e7524847c2 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -102,15 +102,14 @@ function NearYouContainer( const walkRoutingThreshold = mode === 'RAIL' || mode === 'SUBWAY' || mode === 'FERRY' ? 3000 : 1500; const { edges } = places.nearest; - const isCityBikeView = mode === 'CITYBIKE'; let sorted; - if (isCityBikeView) { + if (mode === 'CITYBIKE') { const withNetworks = edges.filter(edge => { - return !!edge.node.place?.rentalNetwork?.networkId; + return !!edge.node.place.rentalNetwork?.networkId; }); const filteredCityBikeStopEdges = withNetworks.filter(edge => { return getDefaultNetworks(config).includes( - edge.node.place?.rentalNetwork?.networkId, + edge.node.place.rentalNetwork?.networkId, ); }); sorted = filteredCityBikeStopEdges @@ -129,8 +128,8 @@ function NearYouContainer( /* eslint-disable-next-line no-underscore-dangle */ switch (place.__typename) { case 'Stop': - if (place.stoptimesWithoutPatterns?.length > 0) { - if (!prioritizedStops?.includes(place.gtfsId)) { + if (place.stoptimesWithoutPatterns.length > 0) { + if (!prioritizedStops.includes(place.gtfsId)) { return ( )} - {((!relay.hasMore() && !stops.length && !prioritizedStops?.length) || - (noStopsFound && !prioritizedStops?.length)) && ( + {((!relay.hasMore() && !stops.length && !prioritizedStops.length) || + (noStopsFound && !prioritizedStops.length)) && ( <> {withSeparator &&
}
@@ -225,7 +224,7 @@ NearYouContainer.propTypes = { lon: PropTypes.number, }).isRequired, withSeparator: PropTypes.bool, - prioritizedStops: PropTypes.arrayOf(PropTypes.string), + prioritizedStops: PropTypes.arrayOf(PropTypes.string).isRequired, mode: PropTypes.string.isRequired, renderDisruptionBanner: PropTypes.bool, isParentTabActive: PropTypes.bool, @@ -236,7 +235,6 @@ NearYouContainer.propTypes = { NearYouContainer.defaultProps = { places: undefined, withSeparator: false, - prioritizedStops: undefined, renderDisruptionBanner: false, isParentTabActive: false, }; diff --git a/app/component/nearyou/NearYouMapContainer.js b/app/component/nearyou/NearYouMapContainer.js index b5c1109167..95b443a2c2 100644 --- a/app/component/nearyou/NearYouMapContainer.js +++ b/app/component/nearyou/NearYouMapContainer.js @@ -100,6 +100,7 @@ const containerComponent = createPaginationContainer( gtfsId shortName mode + type } code patternGeometry { diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index c0deb2ee42..3d6d97e696 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -391,7 +391,7 @@ function NearYouPage( ).url; } const prioritizedStops = - config.prioritizedStopsNearYou[tabMode.toLowerCase()]; + config.prioritizedStopsNearYou[tabMode.toLowerCase()] || []; const favouriteIds = mode === 'CITYBIKE' ? new Set(favouriteVehicleStationIds) @@ -479,7 +479,7 @@ function NearYouPage( onClick={updateLocation} /> )} - {prioritizedStops?.length && ( + {prioritizedStops.length && ( { - if (res.props) { - return ( - <> - {res.props.stops.map(stop => { - return ( - - ); - })} - - ); - } - return null; - }} + render={res => + res.props?.stops.map(stop => ( + + )) + } /> )} - {!props && ( -
- -
- )} - {props && ( + + {props ? ( + ) : ( +
+ +
)}
); @@ -721,24 +712,22 @@ const PositioningWrapper = connectToStores( 'TimeStore', ], (context, props) => { - const favouriteStopIds = context - .getStore('FavouriteStore') + const favStore = context.getStore('FavouriteStore'); + const favouriteStopIds = favStore .getStopsAndStations() .filter(stop => stop.type === 'stop') .map(stop => stop.gtfsId); - const favouriteStationIds = context - .getStore('FavouriteStore') + const favouriteStationIds = favStore .getStopsAndStations() .filter(stop => stop.type === 'station') .map(stop => stop.gtfsId); - let favouriteVehicleStationIds = []; - if (useCitybikes(context.config.vehicleRental?.networks, context.config)) { - favouriteVehicleStationIds = context - .getStore('FavouriteStore') - .getVehicleRentalStations() - .map(station => station.stationId); - } - const status = context.getStore('FavouriteStore').getStatus(); + const favouriteVehicleStationIds = useCitybikes( + context.config.vehicleRental?.networks, + context.config, + ) + ? favStore.getVehicleRentalStations().map(station => station.stationId) + : []; + return { ...props, currentTime: context.getStore('TimeStore').getCurrentTime(), @@ -750,7 +739,8 @@ const PositioningWrapper = connectToStores( favouriteStopIds, favouriteVehicleStationIds, favouriteStationIds, - favouritesFetched: status !== FavouriteStore.STATUS_FETCHING_OR_UPDATING, + favouritesFetched: + favStore.getStatus() !== FavouriteStore.STATUS_FETCHING_OR_UPDATING, }; }, ); From b85aa684a7fdac8c7546f64e7dc5c3936461c002 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 23 Dec 2025 11:06:45 +0200 Subject: [PATCH 051/129] feat: move city bike info to own component --- app/component/nearyou/CityBikeInfo.js | 108 ++++++++++++++++++++++++++ app/component/nearyou/NearYouPage.js | 107 +------------------------ 2 files changed, 112 insertions(+), 103 deletions(-) create mode 100644 app/component/nearyou/CityBikeInfo.js diff --git a/app/component/nearyou/CityBikeInfo.js b/app/component/nearyou/CityBikeInfo.js new file mode 100644 index 0000000000..cc1f0da127 --- /dev/null +++ b/app/component/nearyou/CityBikeInfo.js @@ -0,0 +1,108 @@ +import PropTypes from 'prop-types'; +import React, { useState } from 'react'; +import { FormattedMessage } from 'react-intl'; +import { configShape } from '../../util/shapes'; +import { isKeyboardSelectionEvent } from '../../util/browser'; +import { getReadMessageIds, setReadMessageIds } from '../../store/localStorage'; +import { + getRentalNetworkConfig, + getRentalNetworkId, +} from '../../util/vehicleRentalUtils'; +import Icon from '../Icon'; + +const CityBikeInfo = ({ lang }, { config }) => { + const [showCityBikeTeaser, setShowCityBikeTeaser] = useState( + !getReadMessageIds().includes('citybike_teaser'), + ); + + const handleClose = () => { + const readMessageIds = getReadMessageIds() || []; + readMessageIds.push('citybike_teaser'); + setReadMessageIds(readMessageIds); + setShowCityBikeTeaser(false); + }; + + const { vehicleRental } = config; + // Use buy instructions if available + const { buyUrl } = vehicleRental; + const buyInstructions = buyUrl && vehicleRental.buyInstructions?.[lang]; + + // Use general information about using city bike, if one network config is available + const networkUrl = + Object.keys(vehicleRental.networks).length === 1 && + getRentalNetworkConfig( + getRentalNetworkId(Object.keys(vehicleRental.networks)), + config, + ).url; + + if (!showCityBikeTeaser || !(buyUrl || networkUrl)) { + return undefined; + } + return ( +
+ ); +}; + +CityBikeInfo.propTypes = { lang: PropTypes.string.isRequired }; + +CityBikeInfo.contextTypes = { config: configShape.isRequired }; + +export default CityBikeInfo; diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 3d6d97e696..7432a61b4c 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -7,38 +7,29 @@ import { matchShape, routerShape } from 'found'; import connectToStores from 'fluxible-addons-react/connectToStores'; import distance from '@digitransit-search-util/digitransit-search-util-distance'; import { relayShape, configShape, locationShape } from '../../util/shapes'; -import Icon from '../Icon'; import DesktopView from '../DesktopView'; import MobileView from '../MobileView'; import withBreakpoint, { DesktopOrMobile } from '../../util/withBreakpoint'; import { otpToLocation, locationToUri } from '../../util/otpStrings'; -import { isKeyboardSelectionEvent } from '../../util/browser'; import Loading from '../Loading'; import StopNearYouContainer from './StopNearYouContainer'; import UpdateLocationButton from './UpdateLocationButton'; import MapWrapper from './MapWrapper'; import LocationModal from './LocationModal'; +import CityBikeInfo from './CityBikeInfo'; import { checkPositioningPermission, startLocationWatch, } from '../../action/PositionActions'; import Search from './Search'; import StopRouteSearch from './StopRouteSearch'; -import { - getGeolocationState, - getReadMessageIds, - setReadMessageIds, -} from '../../store/localStorage'; +import { getGeolocationState } from '../../store/localStorage'; import { PREFIX_NEARYOU } from '../../util/path'; import NearYouContainer from './NearYouContainer'; import SwipeableTabs from '../SwipeableTabs'; import NearYouFavourites from './NearYouFavourites'; import { mapLayerShape } from '../../store/MapLayerStore'; -import { - getRentalNetworkConfig, - getRentalNetworkId, - getDefaultNetworks, -} from '../../util/vehicleRentalUtils'; +import { getDefaultNetworks } from '../../util/vehicleRentalUtils'; import { getMapLayerOptions } from '../../util/mapLayerUtils'; import { getTransportModes, @@ -91,9 +82,6 @@ function NearYouPage( const centerOfMap = useRef({}); const [phase, setPhase] = useState(PH_START); const [centerOfMapChanged, setCenterOfMapChanged] = useState(false); - const [showCityBikeTeaser, setShowCityBikeTeaser] = useState( - !getReadMessageIds().includes('citybike_teaser'), - ); const [searchPosition, setSearchPosition] = useState({}); const [mapLayerOptions, setMapLayerOptions] = useState({}); // eslint-disable-next-line @@ -294,13 +282,6 @@ function NearYouPage( !favouriteStationIds.length && !favouriteVehicleStationIds.length; - const handleCityBikeTeaserClose = () => { - const readMessageIds = getReadMessageIds() || []; - readMessageIds.push('citybike_teaser'); - setReadMessageIds(readMessageIds); - setShowCityBikeTeaser(false); - }; - const renderContent = () => { const index = allModes.indexOf(mode); const tabs = allModes.map(tabMode => { @@ -375,21 +356,6 @@ function NearYouPage( variables={getQueryVariables(tabMode)} environment={relayEnvironment} render={({ props }) => { - const { vehicleRental } = config; - // Use buy instructions if available - const cityBikeBuyUrl = vehicleRental.buyUrl; - const buyInstructions = cityBikeBuyUrl - ? vehicleRental.buyInstructions?.[lang] - : undefined; - - let cityBikeNetworkUrl; - // Use general information about using city bike, if one network config is available - if (Object.keys(vehicleRental.networks).length === 1) { - cityBikeNetworkUrl = getRentalNetworkConfig( - getRentalNetworkId(Object.keys(vehicleRental.networks)), - config, - ).url; - } const prioritizedStops = config.prioritizedStopsNearYou[tabMode.toLowerCase()] || []; const favouriteIds = @@ -407,72 +373,7 @@ function NearYouPage( refPoint={searchPosition} /> )} - {showCityBikeTeaser && - tabMode === 'CITYBIKE' && - (cityBikeBuyUrl || cityBikeNetworkUrl) && ( -
-
- -
{ - if ( - isKeyboardSelectionEvent(e) && - (e.keyCode === 13 || e.keyCode === 32) - ) { - handleCityBikeTeaserClose(); - } - }} - onClick={handleCityBikeTeaserClose} - role="button" - > - -
-
- -
- )} + {tabMode === 'CITYBIKE' && } {centerOfMapChanged && ( Date: Tue, 23 Dec 2025 12:30:40 +0200 Subject: [PATCH 052/129] fix: don't render 0 --- app/component/nearyou/NearYouPage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 7432a61b4c..7c9706f663 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -380,7 +380,7 @@ function NearYouPage( onClick={updateLocation} /> )} - {prioritizedStops.length && ( + {prioritizedStops.length ? ( - )} + ) : null} {props ? ( Date: Tue, 23 Dec 2025 12:48:11 +0200 Subject: [PATCH 053/129] fix: restore bike season --- app/configurations/config.hsl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/configurations/config.hsl.js b/app/configurations/config.hsl.js index 3e88387e64..0ddd8c63bb 100644 --- a/app/configurations/config.hsl.js +++ b/app/configurations/config.hsl.js @@ -468,7 +468,7 @@ export default { season: { preSeasonStart: '18.3', start: '1.4', - end: '30.12', + end: '31.10', }, capacity: BIKEAVL_WITHMAX, icon: 'citybike', From 21fe5e17866f8ed7bc704c3a4b31a91e82a373b7 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Mon, 29 Dec 2025 10:30:22 +0200 Subject: [PATCH 054/129] fix: use standard severe alert color for low city bike capacity It was previously subway orange --- 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 1a36972abf..cbf45fdd83 100644 --- a/sass/themes/default/_theme.scss +++ b/sass/themes/default/_theme.scss @@ -57,7 +57,7 @@ $viewpoint-marker-color: $livi-blue; $link-color: $primary-color; $from-color: #4ea700; $to-color: #ec5188; -$slider-severe-color: #ca4000; +$slider-severe-color: $cancelation-red; $slider-warning-color: #fbb800; $slider-ok-color: #4ea700; $selected-lang-background: rgba(0, 0, 0, 0.15); From b6f672c15357c498d292fcd1d9a1b704b8388c10 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Mon, 29 Dec 2025 10:35:27 +0200 Subject: [PATCH 055/129] fix: use color variable instead of hard coded value --- app/component/navigation.scss | 2 +- app/component/nearyou/stops-near-you.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/component/navigation.scss b/app/component/navigation.scss index 8560caf443..e34bd21e68 100644 --- a/app/component/navigation.scss +++ b/app/component/navigation.scss @@ -573,7 +573,7 @@ $content-background-color: $background-color; padding-left: 0; margin-left: 10px; width: 24px; - fill: #dc0451; + fill: $disruption-color; height: 21px; } } diff --git a/app/component/nearyou/stops-near-you.scss b/app/component/nearyou/stops-near-you.scss index 73b54c8e12..455f54b09b 100644 --- a/app/component/nearyou/stops-near-you.scss +++ b/app/component/nearyou/stops-near-you.scss @@ -437,7 +437,7 @@ text-decoration: none; font-weight: 100; white-space: pre-wrap; - background-color: #dc0451; + background-color: $disruption-color; color: white; font-size: 0.9375rem; padding: 12px 0 5px 0; From 49717c642fb238b8fe38af70455dd91bf7db643c Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Mon, 29 Dec 2025 16:49:38 +0200 Subject: [PATCH 056/129] fix: favourites were available only in HSL itinerary page search --- app/store/FavouriteStore.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/store/FavouriteStore.js b/app/store/FavouriteStore.js index 3d314323fa..09c8fbe009 100644 --- a/app/store/FavouriteStore.js +++ b/app/store/FavouriteStore.js @@ -57,6 +57,7 @@ export default class FavouriteStore extends Store { this.config = dispatcher.getContext().config; if (!this.config.allowLogin) { this.favourites = mapFromStore(getFavouriteStorage()); + this.status = FavouriteStore.STATUS_HAS_DATA; } else { this.status = FavouriteStore.STATUS_FETCHING_OR_UPDATING; } From 8db28852794d7ffafc510d42bc09ef38c374dead Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Mon, 29 Dec 2025 16:50:42 +0200 Subject: [PATCH 057/129] feat: method which counts favourite locations --- app/store/FavouriteStore.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/store/FavouriteStore.js b/app/store/FavouriteStore.js index 09c8fbe009..8dd4b98c5b 100644 --- a/app/store/FavouriteStore.js +++ b/app/store/FavouriteStore.js @@ -37,6 +37,8 @@ function mapToStore(favourites) { ); } +const locationTypes = ['station', 'stop', 'place', 'bikeStation']; + export default class FavouriteStore extends Store { static storeName = 'FavouriteStore'; @@ -169,6 +171,16 @@ export default class FavouriteStore extends Store { ); } + getLocationCount() { + let cnt = 0; + this.favourites.forEach(favourite => { + if (locationTypes.includes(favourite.type)) { + cnt += 1; + } + }); + return cnt; + } + /** * Merges array of favourites with favourites from localstorage and returns uniques by favouriteId and gtfsId. * If there are duplicates by favouriteId or gtfsId, newer one is saved (by lastUpdated field) From 2a62c60401913562cf4df013dfb5e0f23eddf51b Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Mon, 29 Dec 2025 16:51:28 +0200 Subject: [PATCH 058/129] fix: add 'own locations' sub menu only if fav locations exist --- app/component/IndexPage.js | 7 +++++-- app/component/itinerary/OriginDestinationBar.js | 2 +- app/component/nearyou/Search.js | 9 +++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/component/IndexPage.js b/app/component/IndexPage.js index e0d612b60f..628fa0143f 100644 --- a/app/component/IndexPage.js +++ b/app/component/IndexPage.js @@ -288,12 +288,15 @@ class IndexPage extends React.Component { const { breakpoint, lang } = this.props; const origin = this.pendingOrigin || this.props.origin; const destination = this.pendingDestination || this.props.destination; + const locationSources = ['History', 'Datasource']; const sources = ['Favourite', 'History', 'Datasource']; const stopAndRouteSearchTargets = ['Stations', 'Stops', 'Routes']; const targets = getLocationSearchTargets(config, breakpoint !== 'large'); targets.push('FutureRoutes'); - + if (this.context.getStore('FavouriteStore').getLocationCount()) { + locationSources.push('Favourite'); + } if (!config.targetsFromOTP) { if (useCitybikes(config.vehicleRental?.networks, config)) { stopAndRouteSearchTargets.push('VehicleRentalStations'); @@ -312,7 +315,7 @@ class IndexPage extends React.Component { origin, destination, lang, - sources, + locationSources, targets, color, hoverColor, diff --git a/app/component/itinerary/OriginDestinationBar.js b/app/component/itinerary/OriginDestinationBar.js index b11a1c80fc..0a786c7990 100644 --- a/app/component/itinerary/OriginDestinationBar.js +++ b/app/component/itinerary/OriginDestinationBar.js @@ -186,7 +186,7 @@ const connectedComponent = connectToStores( ['PreferencesStore', 'FavouriteStore', 'ViaPointStore', 'PositionStore'], ({ getStore }) => ({ language: getStore('PreferencesStore').getLanguage(), - showFavourites: getStore('FavouriteStore').getStatus() === 'has-data', + showFavourites: getStore('FavouriteStore').getLocationCount() > 0, viaPoints: getStore('ViaPointStore').getViaPoints(), locationState: getStore('PositionStore').getLocationState(), }), diff --git a/app/component/nearyou/Search.js b/app/component/nearyou/Search.js index e5e79f0f62..869911954f 100644 --- a/app/component/nearyou/Search.js +++ b/app/component/nearyou/Search.js @@ -10,7 +10,7 @@ import { const DTAutoSuggestWithSearchContext = withSearchContext(DTAutoSuggest); -function Search({ onMap, ...rest }, { config, intl }) { +function Search({ onMap, ...rest }, { config, intl, getStore }) { const searchProps = { id: 'origin-stop-near-you', placeholder: 'origin', @@ -23,11 +23,15 @@ function Search({ onMap, ...rest }, { config, intl }) { modeSet: config.iconModeSet, getAutoSuggestIcons: config.getAutoSuggestIcons, }; + const sources = ['History', 'Datasource']; + if (getStore('FavouriteStore').getLocationCount()) { + sources.push('Favourite'); + } return ( Date: Mon, 29 Dec 2025 20:49:44 +0200 Subject: [PATCH 059/129] chore: inherit config values from base config --- app/configurations/config.default.js | 3 +-- app/configurations/config.hameenlinna.js | 3 --- app/configurations/config.joensuu.js | 4 ---- app/configurations/config.jyvaskyla.js | 7 +----- app/configurations/config.kela.js | 5 ----- app/configurations/config.kotka.js | 3 --- app/configurations/config.kouvola.js | 4 ---- app/configurations/config.kuopio.js | 4 ---- app/configurations/config.lahti.js | 4 ---- app/configurations/config.lappeenranta.js | 4 ---- app/configurations/config.mikkeli.js | 4 ---- app/configurations/config.oulu.js | 4 ---- app/configurations/config.pori.js | 4 ---- app/configurations/config.raasepori.js | 5 ----- app/configurations/config.rovaniemi.js | 3 --- app/configurations/config.tampere.js | 5 ----- app/configurations/config.turku.js | 7 ------ app/configurations/config.vaasa.js | 4 ---- app/configurations/config.varely.js | 6 ----- app/configurations/config.waltti.js | 27 +++++++++++------------ app/configurations/config.walttiOpas.js | 2 -- 21 files changed, 15 insertions(+), 97 deletions(-) diff --git a/app/configurations/config.default.js b/app/configurations/config.default.js index 5a4ce6130a..e5611d5151 100644 --- a/app/configurations/config.default.js +++ b/app/configurations/config.default.js @@ -748,12 +748,11 @@ export default { vehicles: false, showVehiclesOnStopPage: false, + showVehiclesOnItineraryPage: false, trafficNowLink: '', timetables: {}, - showVehiclesOnItineraryPage: false, - showWeatherInformation: true, showBikeAndParkItineraries: false, diff --git a/app/configurations/config.hameenlinna.js b/app/configurations/config.hameenlinna.js index b3602f0ed3..5c0ddeac80 100644 --- a/app/configurations/config.hameenlinna.js +++ b/app/configurations/config.hameenlinna.js @@ -137,9 +137,6 @@ export default configMerger(walttiConfig, { 7: 'G', }, - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, zones: { stops: true, itinerary: true, diff --git a/app/configurations/config.joensuu.js b/app/configurations/config.joensuu.js index f775a9b968..3a5cc57a7f 100644 --- a/app/configurations/config.joensuu.js +++ b/app/configurations/config.joensuu.js @@ -88,10 +88,6 @@ export default configMerger(walttiConfig, { lon: 29.7569847, }, - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, - aboutThisService: { fi: [ { diff --git a/app/configurations/config.jyvaskyla.js b/app/configurations/config.jyvaskyla.js index 90d2513441..a1cf2af85d 100644 --- a/app/configurations/config.jyvaskyla.js +++ b/app/configurations/config.jyvaskyla.js @@ -63,10 +63,6 @@ export default configMerger(walttiConfig, { // Navbar logo logo: 'jyvaskyla/jyvaskyla-favicon.png', - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, - mainMenu: { stopMonitor: { show: true, @@ -180,8 +176,7 @@ export default configMerger(walttiConfig, { stops: true, itinerary: true, }, - // Notice! Turning on this setting forces the search for car routes (for the CO2 comparison only). - showCO2InItinerarySummary: true, + sendAnalyticsCustomEventGoals: true, defaultSettings: { diff --git a/app/configurations/config.kela.js b/app/configurations/config.kela.js index bd98d4d70f..80fe0cc0fc 100644 --- a/app/configurations/config.kela.js +++ b/app/configurations/config.kela.js @@ -149,12 +149,7 @@ export default { }, staticMessagesUrl: process.env.STATIC_MESSAGE_URL, - showNearYouButtons: false, - showVehiclesOnStopPage: false, - showVehiclesOnItineraryPage: false, includeCarSuggestions: true, - // Notice! Turning on this setting forces the search for car routes (for the CO2 comparison only). - showCO2InItinerarySummary: false, useAssembledGeoJsonZones: 'isOnByDefault', locationSearchTargetsFromOTP: [], // remove stop/station location search }; diff --git a/app/configurations/config.kotka.js b/app/configurations/config.kotka.js index 738face925..c6fdf9cefd 100644 --- a/app/configurations/config.kotka.js +++ b/app/configurations/config.kotka.js @@ -160,9 +160,6 @@ export default configMerger(walttiConfig, { 1: 'A', 2: 'B', }, - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, zones: { stops: true, itinerary: true, diff --git a/app/configurations/config.kouvola.js b/app/configurations/config.kouvola.js index 17f810cbe7..042930431a 100644 --- a/app/configurations/config.kouvola.js +++ b/app/configurations/config.kouvola.js @@ -115,10 +115,6 @@ export default configMerger(walttiConfig, { lon: 26.705328946745546, }, - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, - menu: { copyright: { label: `© Kouvola ${walttiConfig.YEAR}` }, content: [ diff --git a/app/configurations/config.kuopio.js b/app/configurations/config.kuopio.js index 38f7469343..f018d7c1ff 100644 --- a/app/configurations/config.kuopio.js +++ b/app/configurations/config.kuopio.js @@ -71,10 +71,6 @@ export default configMerger(walttiConfig, { lon: 27.678136, }, - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, - vehicleRental: { networks: { freebike_kuopio: { diff --git a/app/configurations/config.lahti.js b/app/configurations/config.lahti.js index 81e5d0c8d2..6fe104e610 100644 --- a/app/configurations/config.lahti.js +++ b/app/configurations/config.lahti.js @@ -142,10 +142,6 @@ export default configMerger(walttiConfig, { itinerary: true, }, - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, - transportModes: { citybike: { availableForSelection: true, diff --git a/app/configurations/config.lappeenranta.js b/app/configurations/config.lappeenranta.js index 8ca5562106..06a7290966 100644 --- a/app/configurations/config.lappeenranta.js +++ b/app/configurations/config.lappeenranta.js @@ -153,10 +153,6 @@ export default configMerger(walttiConfig, { lon: 28.18572, }, - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, - menu: { copyright: { label: `© Lappeenranta ${walttiConfig.YEAR}` }, content: [ diff --git a/app/configurations/config.mikkeli.js b/app/configurations/config.mikkeli.js index 1da7685107..9704ad12b8 100644 --- a/app/configurations/config.mikkeli.js +++ b/app/configurations/config.mikkeli.js @@ -127,8 +127,4 @@ export default configMerger(walttiConfig, { stops: true, itinerary: true, }, - - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, }); diff --git a/app/configurations/config.oulu.js b/app/configurations/config.oulu.js index b0d2e85649..8198e5da4c 100644 --- a/app/configurations/config.oulu.js +++ b/app/configurations/config.oulu.js @@ -118,10 +118,6 @@ export default configMerger(walttiConfig, { ], }, - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, - aboutThisService: { fi: [ { diff --git a/app/configurations/config.pori.js b/app/configurations/config.pori.js index c6f82b2077..b036c0e33b 100644 --- a/app/configurations/config.pori.js +++ b/app/configurations/config.pori.js @@ -91,10 +91,6 @@ export default configMerger(walttiConfig, { ], }, - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, - aboutThisService: { fi: [ { diff --git a/app/configurations/config.raasepori.js b/app/configurations/config.raasepori.js index 04cd04ceb5..0a04f3fb3d 100644 --- a/app/configurations/config.raasepori.js +++ b/app/configurations/config.raasepori.js @@ -95,11 +95,6 @@ export default configMerger(walttiConfig, { }, ], }, - - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, - aboutThisService: { fi: [ { diff --git a/app/configurations/config.rovaniemi.js b/app/configurations/config.rovaniemi.js index 8c7df26ebb..7236942462 100644 --- a/app/configurations/config.rovaniemi.js +++ b/app/configurations/config.rovaniemi.js @@ -85,9 +85,6 @@ export default configMerger(walttiConfig, { }, ], }, - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, zoneIdMapping: { 1: 'A', 2: 'B', diff --git a/app/configurations/config.tampere.js b/app/configurations/config.tampere.js index 96a0ac90f7..24c116b3af 100644 --- a/app/configurations/config.tampere.js +++ b/app/configurations/config.tampere.js @@ -246,8 +246,6 @@ export default configMerger(walttiConfig, { ], }, - staticMessages: [], - aboutThisService: { fi: [ { @@ -278,9 +276,6 @@ export default configMerger(walttiConfig, { }, ], }, - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, timetables: { tampere: tampereTimetables, }, diff --git a/app/configurations/config.turku.js b/app/configurations/config.turku.js index 948c54950a..1bc23a96f8 100644 --- a/app/configurations/config.turku.js +++ b/app/configurations/config.turku.js @@ -171,10 +171,6 @@ export default configMerger(walttiConfig, { lon: 22.267633, }, - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, - aboutThisService: { fi: [ { @@ -204,13 +200,10 @@ export default configMerger(walttiConfig, { ], }, - staticMessages: [], geoJson: { layerConfigUrl: 'https://data.foli.fi/geojson/reittiopas', }, - showNearYouButtons: true, - allowLogin: false, constantOperationStops: { 'FUNI:9900': CONSTANT_OPERATION_PARAGRAPHS.fori, 'FUNI:9901': CONSTANT_OPERATION_PARAGRAPHS.fori, diff --git a/app/configurations/config.vaasa.js b/app/configurations/config.vaasa.js index c3f004737c..fd787f2845 100644 --- a/app/configurations/config.vaasa.js +++ b/app/configurations/config.vaasa.js @@ -132,10 +132,6 @@ export default configMerger(walttiConfig, { ], }, - vehicles: true, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, - stopCard: { header: { virtualMonitorBaseUrl, diff --git a/app/configurations/config.varely.js b/app/configurations/config.varely.js index 92c161fb1c..af7513d71e 100644 --- a/app/configurations/config.varely.js +++ b/app/configurations/config.varely.js @@ -125,8 +125,6 @@ export default configMerger(walttiConfig, { /* Enable real-time map layer for vehicle positions */ vehicles: false, viaPointsEnabled: false, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, aboutThisService: { fi: [ @@ -185,10 +183,6 @@ export default configMerger(walttiConfig, { }, }, - staticMessages: [], - showCO2InItinerarySummary: true, - showNearYouButtons: true, - allowLogin: false, routeNotifications: [], analyticsScript: '', GTMid: null, diff --git a/app/configurations/config.waltti.js b/app/configurations/config.waltti.js index 10596fedb8..866831c2ab 100644 --- a/app/configurations/config.waltti.js +++ b/app/configurations/config.waltti.js @@ -60,6 +60,9 @@ export default { availableLanguages: ['fi', 'sv', 'en'], defaultLanguage: 'fi', + vehicles: true, + showVehiclesOnStopPage: true, + showVehiclesOnItineraryPage: true, showCO2InItinerarySummary: true, transportModes: { @@ -144,9 +147,18 @@ export default { }, }, + showNearYouButtons: true, + nearYouButton: { + borderRadius: '50%', + color: '#000F94', + }, + nearYouTitle: { + fi: 'Aikataulut ja linjat', + sv: 'Tidtabeller och linjer', + en: 'Timetables and routes', + }, nearYouModes: ['bus'], nearbyModeSet: 'waltti', - maxNearbyStopDistance: { bus: 30000, tram: 30000, @@ -173,19 +185,6 @@ export default { }, }, - showNearYouButtons: true, - nearYouButton: { - borderRadius: '50%', - color: '#000F94', - }, - nearYouTitle: { - fi: 'Aikataulut ja linjat', - sv: 'Tidtabeller och linjer', - en: 'Timetables and routes', - }, - - allowLogin: false, - messageBarAlerts: true, includeCarSuggestions: true, diff --git a/app/configurations/config.walttiOpas.js b/app/configurations/config.walttiOpas.js index a12c2ff177..87fe932e35 100644 --- a/app/configurations/config.walttiOpas.js +++ b/app/configurations/config.walttiOpas.js @@ -102,8 +102,6 @@ export default configMerger(walttiConfig, { }, viaPointsEnabled: false, - showVehiclesOnStopPage: true, - showVehiclesOnItineraryPage: true, sourceForAlertsAndDisruptions: { Kajaani: { From 8f6d80c905692e49d60c5ef7786f20cf8f233249 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 30 Dec 2025 10:20:18 +0200 Subject: [PATCH 060/129] chore: refactor nearyou props --- app/component/IndexPage.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/component/IndexPage.js b/app/component/IndexPage.js index 628fa0143f..b1ce0ba4fb 100644 --- a/app/component/IndexPage.js +++ b/app/component/IndexPage.js @@ -233,7 +233,6 @@ class IndexPage extends React.Component { const nearYouModes = getNearYouModes(config); // Styles are defined by which button type is configured (narrow/wide) - const narrowButtons = config.narrowNearYouButtons; const modeTitles = filterObject( transportModes, 'availableForSelection', @@ -249,6 +248,14 @@ class IndexPage extends React.Component { feedIds: config.feedIds, }; + const wideProps = config.narrowNearYouButtons + ? {} + : { + buttonStyle: config.nearYouButton, + title: config.nearYouTitle, + modes: modeTitles, + }; + return config.showNearYouButtons ? ( ) : (
From 2f4ab0e3bab96c9c30b5bd8063911813280ccb21 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 30 Dec 2025 13:56:04 +0200 Subject: [PATCH 061/129] fix: refactor the insane prop spaghetti of near you buttons - Set horizontal layout with a single understandable prop - Move translations from config to library --- .../package.json | 2 +- .../src/helpers/translations.js | 140 ++++++------------ .../src/index.js | 78 ++++------ .../digitransit-component/package.json | 2 +- 4 files changed, 78 insertions(+), 144 deletions(-) diff --git a/digitransit-component/packages/digitransit-component-control-panel/package.json b/digitransit-component/packages/digitransit-component-control-panel/package.json index 4c8a39abf7..ee5131b7f1 100644 --- a/digitransit-component/packages/digitransit-component-control-panel/package.json +++ b/digitransit-component/packages/digitransit-component-control-panel/package.json @@ -1,6 +1,6 @@ { "name": "@digitransit-component/digitransit-component-control-panel", - "version": "6.0.2", + "version": "7.0.0", "description": "digitransit-component control-panel module", "main": "index.js", "files": [ diff --git a/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js b/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js index 94900029fe..ede7486be3 100644 --- a/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js +++ b/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js @@ -1,117 +1,67 @@ const translations = { de: { translation: { - 'close-teaser-modal': 'Schließen', - 'pick-mode': 'Wählen Sie ein Verkehrsmittel', - 'pick-mode-airplane': 'Flug', - 'pick-mode-bus': 'Bus', - 'pick-mode-citybike': 'Leihrad', - 'pick-mode-favorite': 'Favoriten', - 'pick-mode-ferry': 'Fähre', - 'pick-mode-rail': 'Zug', - 'pick-mode-subway': 'U-Bahn', - 'pick-mode-tram': 'Straßenbahn', - 'placeholder-destination': 'Geben Sie Ihren Zielort ein', - 'placeholder-origin': 'Geben Sie Ihren Abfahrtsort ein', - 'placeholder-route-stop-station': 'Enter route, stop or station', - 'title-route-stop-station': 'Haltestellen und Linien in der Nähe', - 'title-origin-to-destination': 'Wohin?', - 'use-own-position': 'Verwende aktuelle Position', + airplane: 'Flug', + bus: 'Bus', + citybike: 'Leihrad', + favorite: 'Favoriten', + ferry: 'Fähre', + rail: 'Zug', + subway: 'U-Bahn', + tram: 'Straßenbahn', + title: 'Haltestellen und Linien in der Nähe', }, }, en: { translation: { - 'close-teaser-modal': 'Close', - 'pick-mode': 'Select a transport mode', - 'pick-mode-airplane': 'Flight', - 'pick-mode-bus': 'Bus', - 'pick-mode-citybike': 'Citybike', - 'pick-mode-favorite': 'Stops nearby me', - 'pick-mode-ferry': 'Ferry', - 'pick-mode-rail': 'Rail', - 'pick-mode-subway': 'Metro', - 'pick-mode-tram': 'Tram', - 'placeholder-destination': 'Enter destination', - 'placeholder-origin': 'Enter origin', - 'placeholder-route-stop-station': 'Enter route, stop or station', - 'title-route-stop-station': 'Nearby stops and routes', - 'title-origin-to-destination': 'Where to?', - 'use-own-position': 'Use current location', - 'nearby-stops-teaser-header': - 'Try the new map views showing nearby stops', - 'nearby-stops-teaser-content': - 'Real-time timetables for nearby stops and vehicles on map.', + airplane: 'The closest airports', + bus: 'Buses and nearby stops on map', + citybike: 'The closest city bike stations', + favorite: 'Stops nearby me', + ferry: 'The closest ferry piers', + rail: 'Trains and nearby stations on map', + subway: 'Metro and nearby stations on map', + tram: 'Trams and nearby stops on map', + title: 'Nearby stops and routes', }, }, fi: { translation: { - 'close-teaser-modal': 'Sulje', - 'pick-mode': 'Valitse joukkoliikennevälineistä', - 'pick-mode-airplane': 'Lentokone', - 'pick-mode-bus': 'Bussi', - 'pick-mode-citybike': 'Kaupunkipyörä', - 'pick-mode-favorite': 'Omat lähipysäkit', - 'pick-mode-ferry': 'Lautta', - 'pick-mode-rail': 'Juna', - 'pick-mode-subway': 'Metro', - 'pick-mode-tram': 'Raitiovaunu', - 'placeholder-destination': 'Syötä määränpää', - 'placeholder-origin': 'Syötä lähtöpaikka', - 'placeholder-route-stop-station': 'Syötä linja, pysäkki tai asema', - 'title-route-stop-station': 'Lähipysäkit ja linjat', - 'title-origin-to-destination': 'Minne mennään?', - 'use-own-position': 'Käytä nykyistä sijaintia', - 'nearby-stops-teaser-header': 'Kokeile uusia lähipysäkkinäkymiä', - 'nearby-stops-teaser-content': - 'Reaaliaikaiset lähipysäkkiesi aikataulut ja ajoneuvot kartalla.', + airplane: 'Lähimmät lentoasemat', + bus: 'Bussit ja lähipysäkit kartalla', + citybike: 'Lähimmät kaupunkipyöräasemat', + favorite: 'Omat lähipysäkit', + ferry: 'Lähimmät lauttalaiturit', + rail: 'Junat ja lähiasemat kartalla', + subway: 'Metrot ja lähiasemat kartalla', + tram: 'Raitiovaunut ja lähipysäkit kartalla', + title: 'Lähipysäkit ja linjat', }, }, pl: { translation: { - 'close-teaser-modal': 'Zamknij', - 'pick-mode': 'Wybierz typ transportu', - 'pick-mode-airplane': 'Lot', - 'pick-mode-bus': 'Autobus', - 'pick-mode-citybike': 'Rower miejski', - 'pick-mode-favorite': 'Przystanki w pobliżu', - 'pick-mode-ferry': 'Prom', - 'pick-mode-rail': 'Kolej', - 'pick-mode-subway': 'Metro', - 'pick-mode-tram': 'Tramwaj', - 'placeholder-destination': 'Wprowadź cel', - 'placeholder-origin': 'Wprowadź początek', - 'placeholder-route-stop-station': 'Wprowadź trasę, przystanek lub stację', - 'title-route-stop-station': 'Przystanki i trasy w pobliżu', - 'title-origin-to-destination': 'Dokąd?', - 'use-own-position': 'Użyj obecnej lokalizacji', - 'nearby-stops-teaser-header': - 'Wypróbuj nowy widok mapy pokazujący przystanki w pobliżu', - 'nearby-stops-teaser-content': - 'Rozkłady jazdy w czasie rzeczywistym dla pobliskich przystanków i pojazdów na mapie.', + airplane: 'Lot', + bus: 'Autobus', + citybike: 'Rower miejski', + favorite: 'Przystanki w pobliżu', + ferry: 'Prom', + rail: 'Kolej', + subway: 'Metro', + tram: 'Tramwaj', + title: 'Przystanki i trasy w pobliżu', }, }, sv: { translation: { - 'close-teaser-modal': 'Stäng', - 'pick-mode': 'Välj ett transportläge', - 'pick-mode-airplane': 'Flyg', - 'pick-mode-bus': 'Buss', - 'pick-mode-citybike': 'Stadscykel', - 'pick-mode-favorite': 'Hållplatser nära mig', - 'pick-mode-ferry': 'Färja', - 'pick-mode-rail': 'Tåg', - 'pick-mode-subway': 'Metro', - 'pick-mode-tram': 'Spårvagn', - 'placeholder-destination': 'Skriv destination', - 'placeholder-origin': 'Skriv avfärdsplats', - 'placeholder-route-stop-station': 'Skriv linje, hållplats eller station', - 'title-route-stop-station': 'Hållplatser och linjer nära dig', - 'title-origin-to-destination': 'Var till?', - 'use-own-position': 'Använd min position', - 'nearby-stops-teaser-header': - 'Prova de nya kartavyerna som visar hållplatserna i närheten', - 'nearby-stops-teaser-content': - 'Fordonen och tidtabellerna i realtid för hållplatserna nära dig på kartan.', + airplane: 'Närmaste flygplatser', + bus: 'Bussar och hållplatser på kartan', + citybike: 'Närmaste cykelstationer', + favorite: 'Hållplatser nära mig', + ferry: 'Närmaste färjekajer', + rail: 'Tåg och stationer på kartan', + subway: 'Metro och stationer på kartan', + tram: 'Spårvagnar och hållplatser på kartan', + title: 'Hållplatser och linjer nära dig', }, }, }; diff --git a/digitransit-component/packages/digitransit-component-control-panel/src/index.js b/digitransit-component/packages/digitransit-component-control-panel/src/index.js index e7265a2801..35fb29be0a 100644 --- a/digitransit-component/packages/digitransit-component-control-panel/src/index.js +++ b/digitransit-component/packages/digitransit-component-control-panel/src/index.js @@ -46,7 +46,7 @@ SeparatorLine.defaultProps = { * @param {string[]} props.modeArray - Names of transport modes to show buttons for. Should be in lower case. Also defines button order * @param {string} props.language - Language used for accessible labels * @param {string} props.urlPrefix - URL prefix for links. Must end with /lahellasi - * @param {boolean} props.showTitle - Show title, default is false + * @param {boolean} props.title - Custom titles per language * @param {Object} props.alertsContext * @param {function} props.alertsContext.getModesWithAlerts - Function which should return an array of transport modes that have active alerts (e.g. [BUS, SUBWAY]) * @param {Number} props.alertsContext.currentTime - Time stamp with which the returned alerts are validated with @@ -86,18 +86,17 @@ function getIconName(mode, modeSet) { } function NearStopsAndRoutes({ + horizontal, modeArray, urlPrefix, language, - showTitle, + title, alertsContext, LinkComponent, origin, omitLanguageUrl, onClick, buttonStyle, - title, - modes, modeSet, modeIconColors, fontWeights, @@ -134,10 +133,10 @@ function NearStopsAndRoutes({ }`; } - const modeButton = !modes ? ( + const modeButton = horizontal ? ( <> - {t(`pick-mode-${mode}`, { lng: language })} + {t(mode, { lng: language })} @@ -154,34 +153,25 @@ function NearStopsAndRoutes({ ) : ( - <> - - {t(`pick-mode-${mode}`, { lng: language })} + + + + {withAlert && ( + + + + )} - - - - {withAlert && ( - - - - )} - - - {modes[mode]['nearYouLabel'][language]} - + + {t(mode, language)} - + ); if (onClick) { @@ -220,18 +210,14 @@ function NearStopsAndRoutes({ className={styles['near-you-container']} style={{ '--font-weight-medium': fontWeights.medium }} > - {showTitle && ( -

- {!modes - ? t('title-route-stop-station', { lng: language }) - : title[language]} -

- )} +

+ {title?.[language] || t('title', { lng: language })} +

{buttons} @@ -242,9 +228,10 @@ function NearStopsAndRoutes({ NearStopsAndRoutes.propTypes = { modeArray: PropTypes.arrayOf(PropTypes.string).isRequired, + title: PropTypes.objectOf(PropTypes.string), urlPrefix: PropTypes.string.isRequired, language: PropTypes.string, - showTitle: PropTypes.bool, + horizontal: PropTypes.bool, alertsContext: PropTypes.shape({ getModesWithAlerts: PropTypes.func, currentTime: PropTypes.number, @@ -259,8 +246,6 @@ NearStopsAndRoutes.propTypes = { omitLanguageUrl: PropTypes.bool, onClick: PropTypes.func, buttonStyle: PropTypes.objectOf(PropTypes.string), - title: PropTypes.objectOf(PropTypes.string), - modes: PropTypes.object, modeIconColors: PropTypes.objectOf(PropTypes.string), modeSet: PropTypes.string, fontWeights: PropTypes.shape({ @@ -269,7 +254,7 @@ NearStopsAndRoutes.propTypes = { }; NearStopsAndRoutes.defaultProps = { - showTitle: false, + horizontal: true, language: 'fi', LinkComponent: undefined, origin: undefined, @@ -278,7 +263,6 @@ NearStopsAndRoutes.defaultProps = { alertsContext: undefined, onClick: undefined, title: undefined, - modes: undefined, modeIconColors: { 'mode-bus': '#007ac9', 'mode-rail': '#8c4799', diff --git a/digitransit-component/packages/digitransit-component/package.json b/digitransit-component/packages/digitransit-component/package.json index 663e8bbba9..816f75c14d 100644 --- a/digitransit-component/packages/digitransit-component/package.json +++ b/digitransit-component/packages/digitransit-component/package.json @@ -20,7 +20,7 @@ "dependencies": { "@digitransit-component/digitransit-component-autosuggest": "^6.0.4", "@digitransit-component/digitransit-component-autosuggest-panel": "^7.0.4", - "@digitransit-component/digitransit-component-control-panel": "^6.0.2", + "@digitransit-component/digitransit-component-control-panel": "^7.0.0", "@digitransit-component/digitransit-component-favourite-bar": "^4.0.3", "@digitransit-component/digitransit-component-favourite-editing-modal": "^4.0.1", "@digitransit-component/digitransit-component-favourite-modal": "^3.0.1", From b9f44974a8040279150d582764e951dc79e0e2fd Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 30 Dec 2025 14:00:18 +0200 Subject: [PATCH 062/129] feat: use refactored near you button component --- app/component/IndexPage.js | 38 ++++++++++++++--------------- app/configurations/config.waltti.js | 35 -------------------------- app/translations.js | 10 ++++---- yarn.lock | 4 +-- 4 files changed, 25 insertions(+), 62 deletions(-) diff --git a/app/component/IndexPage.js b/app/component/IndexPage.js index b1ce0ba4fb..2e17768cb9 100644 --- a/app/component/IndexPage.js +++ b/app/component/IndexPage.js @@ -229,18 +229,18 @@ class IndexPage extends React.Component { const { intl, config } = this.context; const { colors, fontWeights } = config; const { lang } = this.props; - const transportModes = getTransportModes(config); const nearYouModes = getNearYouModes(config); - - // Styles are defined by which button type is configured (narrow/wide) - const modeTitles = filterObject( - transportModes, - 'availableForSelection', - true, - ); // If nearYouModes is configured, display those. Otherwise, display all configured transport modes - const modes = - nearYouModes?.length > 0 ? nearYouModes : Object.keys(modeTitles); + const modeArray = + nearYouModes.length > 0 + ? nearYouModes + : Object.keys( + filterObject( + getTransportModes(config), + 'availableForSelection', + true, + ), + ); const alertsContext = { currentTime: this.props.currentTime, @@ -248,35 +248,33 @@ class IndexPage extends React.Component { feedIds: config.feedIds, }; - const wideProps = config.narrowNearYouButtons - ? {} + const directionProps = config.narrowNearYouButtons + ? { modeSet: config.iconModeSet, horizontal: true } : { buttonStyle: config.nearYouButton, - title: config.nearYouTitle, - modes: modeTitles, + modeSet: config.nearbyModeSet, }; return config.showNearYouButtons ? ( ) : (

{intl.formatMessage({ - id: 'stop-near-you-title', - defaultMessage: 'Stops and lines near you', + id: 'near-you-search', + defaultMessage: 'Search stops and routes', })}

diff --git a/app/configurations/config.waltti.js b/app/configurations/config.waltti.js index 866831c2ab..94e111db02 100644 --- a/app/configurations/config.waltti.js +++ b/app/configurations/config.waltti.js @@ -69,71 +69,36 @@ export default { bus: { availableForSelection: true, defaultValue: true, - nearYouLabel: { - fi: 'Bussit ja lähipysäkit kartalla', - sv: 'Bussar och hållplatser på kartan', - en: 'Buses and nearby stops on map', - }, }, rail: { availableForSelection: false, defaultValue: false, - nearYouLabel: { - fi: 'Junat ja lähiasemat kartalla', - sv: 'Tåg och stationer på kartan', - en: 'Trains and nearby stations on map', - }, }, tram: { availableForSelection: false, defaultValue: false, - nearYouLabel: { - fi: 'Raitiovaunut ja lähipysäkit kartalla', - sv: 'Spårvagnar och hållplatser på kartan', - en: 'Trams and nearby stops on map', - }, }, subway: { availableForSelection: false, defaultValue: false, - nearYouLabel: { - fi: 'Metrot ja lähiasemat kartalla', - sv: 'Metro och stationer på kartan', - en: 'Metro and nearby stations on map', - }, }, citybike: { availableForSelection: false, defaultValue: false, - nearYouLabel: { - fi: 'Lähimmät kaupunkipyöräasemat', - sv: 'Närmaste cykelstationer', - en: 'The closest city bike stations', - }, }, airplane: { availableForSelection: false, defaultValue: false, - nearYouLabel: { - fi: 'Lähimmät lentoasemat', - sv: 'Närmaste flygplatser', - en: 'The closest airports', - }, }, ferry: { availableForSelection: false, defaultValue: false, - nearYouLabel: { - fi: 'Lähimmät lauttalaiturit', - sv: 'Närmaste färjekajer', - en: 'The closest ferry piers', - }, }, funicular: { diff --git a/app/translations.js b/app/translations.js index a9b7d39d22..99a503d5cf 100644 --- a/app/translations.js +++ b/app/translations.js @@ -519,6 +519,7 @@ const translations = { 'more-settings': 'Erweiterte Einstellungen', 'move-on-map': 'Position auf der Karte hat sich geändert', navigate: 'Navigieren', + 'near-you-search': 'Suche nach Haltestellen oder Linien', nearest: '{ mode } in der Nähe', 'nearest-stops': 'Nächstgelegene Haltestellen', 'nearest-stops-bus': 'Nächstgelegene Bushaltestellen', @@ -713,7 +714,6 @@ const translations = { 'Sie haben die Standortabfrage nicht freigegeben.', 'stop-near-you-modal-info': 'Zur Nutzung der Suche nach Haltestellen in der Nähe wird Zugriff auf die Standortabfrage benötigt.', - 'stop-near-you-title': 'Suche nach Haltestellen oder Linien', 'stop-number': 'Haltestellennummer', 'stop-page.description': 'Haltestelle - {name} {code}, {desc}', 'stop-page.title': 'Haltestelle - {name} {code}', @@ -1370,6 +1370,7 @@ const translations = { 'Departs at {time} from {stopName} {stopOrStation}', 'navileg-start-schedule': '{mode} {route} scheduled departure {time}', 'navileg-walk': 'Walk to', + 'near-you-search': 'Search for stops and routes', nearest: '{ mode } near you', 'nearest-favourites': 'Stops nearby me', 'nearest-favourites-browse-stops': 'Browse and select stops', @@ -1668,7 +1669,6 @@ const translations = { 'stop-near-you-modal-header': 'You have not enabled location services', 'stop-near-you-modal-info': 'Using the nearby stops function requires location access.', - 'stop-near-you-title': 'Search for stops and routes', 'stop-near-you-update-alert': 'Nearest stops updated', 'stop-number': 'Stop number', 'stop-page.description': 'Stop {name} - {code}', @@ -2695,6 +2695,7 @@ const translations = { 'navileg-start-schedule': '{mode} {route} aikataulun mukainen lähtö klo {time}', 'navileg-walk': 'Kävele', + 'near-you-search': 'Linja- ja pysäkkihaku', nearest: 'Lähimmät {mode}', 'nearest-favourites': 'Omat lähipysäkit', 'nearest-favourites-browse-stops': 'Selaa ja valitse pysäkkejä', @@ -2990,7 +2991,6 @@ const translations = { 'stop-near-you-modal-header': 'Et ole sallinut paikannusta', 'stop-near-you-modal-info': 'Lähipysäkkien käyttö edellyttää tietoa sijainnista.', - 'stop-near-you-title': 'Linja- ja pysäkkihaku', 'stop-near-you-update-alert': 'Lähimmät pysäkit päivitetty', 'stop-number': 'Pysäkkinumero', 'stop-page.description': 'Pysäkki - {name} {code}, {desc}', @@ -4205,6 +4205,7 @@ const translations = { 'move-on-map': 'Rozglądaj się po mapie', 'move-to-tab': 'Przejdź do karty {number}', navigate: 'Nawiguj', + 'near-you-search': 'Szukaj przystanków i tras', nearest: '{ mode } w Twojej okolicy', 'nearest-favourites': 'Przystanki w pobliżu', 'nearest-favourites-browse-stops': 'Przeglądaj i wybieraj przystanki', @@ -4475,7 +4476,6 @@ const translations = { 'stop-near-you-modal-header': 'Nie masz włączonych usług lokalizacji', 'stop-near-you-modal-info': 'Korzystanie z funkcji najbliższych przystanków wymaga włączenia dostępu do lokalizacji.', - 'stop-near-you-title': 'Szukaj przystanków i tras', 'stop-near-you-update-alert': 'Zaktualizowano najbliższe przystanki', 'stop-number': 'Numer przystanku', 'stop-page.description': 'Przystanek {name} - {code}', @@ -5649,6 +5649,7 @@ const translations = { 'Avgår klockan {time} från {stopName} {stopOrStation}', 'navileg-start-schedule': '{mode} {route} avgång enligt tidtabell {time}', 'navileg-walk': 'Gå till', + 'near-you-search': 'Sök hållplatser och linjer', nearest: 'Närmaste { mode }', 'nearest-favourites': 'Hållplatser nära mig', 'nearest-favourites-browse-stops': 'Bläddra och välj hållplatser', @@ -5951,7 +5952,6 @@ const translations = { 'stop-near-you-modal-header': 'Du har inte aktiverat positionering', 'stop-near-you-modal-info': 'Användning av funktion ”hållplatserna nära dig” förutsätter information om din position.', - 'stop-near-you-title': 'Sök hållplatser och linjer', 'stop-near-you-update-alert': 'Närliggande hållplatser uppdaterade', 'stop-number': 'Hållplatsnummer', 'stop-page.description': 'Hållplats {name} - {code}', diff --git a/yarn.lock b/yarn.lock index 2f74658238..e72d433fa2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2049,7 +2049,7 @@ __metadata: languageName: unknown linkType: soft -"@digitransit-component/digitransit-component-control-panel@^6.0.2, @digitransit-component/digitransit-component-control-panel@workspace:digitransit-component/packages/digitransit-component-control-panel": +"@digitransit-component/digitransit-component-control-panel@^7.0.0, @digitransit-component/digitransit-component-control-panel@workspace:digitransit-component/packages/digitransit-component-control-panel": version: 0.0.0-use.local resolution: "@digitransit-component/digitransit-component-control-panel@workspace:digitransit-component/packages/digitransit-component-control-panel" peerDependencies: @@ -2204,7 +2204,7 @@ __metadata: dependencies: "@digitransit-component/digitransit-component-autosuggest": ^6.0.4 "@digitransit-component/digitransit-component-autosuggest-panel": ^7.0.4 - "@digitransit-component/digitransit-component-control-panel": ^6.0.2 + "@digitransit-component/digitransit-component-control-panel": ^7.0.0 "@digitransit-component/digitransit-component-favourite-bar": ^4.0.3 "@digitransit-component/digitransit-component-favourite-editing-modal": ^4.0.1 "@digitransit-component/digitransit-component-favourite-modal": ^3.0.1 From 24cb10d629ad3887cad38a439d3f067d91e72c89 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 30 Dec 2025 15:03:16 +0200 Subject: [PATCH 063/129] fix: new bugs after refactoring --- app/component/IndexPage.js | 3 ++- .../digitransit-component-control-panel/src/index.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/component/IndexPage.js b/app/component/IndexPage.js index 2e17768cb9..6b5e4ac7f0 100644 --- a/app/component/IndexPage.js +++ b/app/component/IndexPage.js @@ -249,10 +249,11 @@ class IndexPage extends React.Component { }; const directionProps = config.narrowNearYouButtons - ? { modeSet: config.iconModeSet, horizontal: true } + ? { modeSet: config.iconModeSet } : { buttonStyle: config.nearYouButton, modeSet: config.nearbyModeSet, + horizontal: false, }; return config.showNearYouButtons ? ( diff --git a/digitransit-component/packages/digitransit-component-control-panel/src/index.js b/digitransit-component/packages/digitransit-component-control-panel/src/index.js index 35fb29be0a..04340caefb 100644 --- a/digitransit-component/packages/digitransit-component-control-panel/src/index.js +++ b/digitransit-component/packages/digitransit-component-control-panel/src/index.js @@ -169,7 +169,7 @@ function NearStopsAndRoutes({ )} - {t(mode, language)} + {t(mode, { lng: language })} ); @@ -216,8 +216,8 @@ function NearStopsAndRoutes({
{buttons} From 9420f619a4de87b1d0395654d9240ea133588da4 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 30 Dec 2025 15:13:20 +0200 Subject: [PATCH 064/129] chore: remove unused config --- app/configurations/config.kotka.js | 5 ----- app/configurations/config.kouvola.js | 5 ----- app/configurations/config.mikkeli.js | 5 ----- app/configurations/config.tampere.js | 1 + app/configurations/config.walttiOpas.js | 5 ----- 5 files changed, 1 insertion(+), 20 deletions(-) diff --git a/app/configurations/config.kotka.js b/app/configurations/config.kotka.js index c6fdf9cefd..0cdcb601f0 100644 --- a/app/configurations/config.kotka.js +++ b/app/configurations/config.kotka.js @@ -25,11 +25,6 @@ export default configMerger(walttiConfig, { bus: { availableForSelection: true, defaultValue: true, - nearYouLabel: { - fi: 'Lähipysäkit kartalla', - sv: 'Hållplatser på kartan', - en: 'Nearby stops on map', - }, }, citybike: { availableForSelection: true, diff --git a/app/configurations/config.kouvola.js b/app/configurations/config.kouvola.js index 042930431a..61ded70b4e 100644 --- a/app/configurations/config.kouvola.js +++ b/app/configurations/config.kouvola.js @@ -29,11 +29,6 @@ export default configMerger(walttiConfig, { bus: { availableForSelection: true, defaultValue: true, - nearYouLabel: { - fi: 'Lähipysäkit kartalla', - sv: 'Hållplatser på kartan', - en: 'Nearby stops on map', - }, }, citybike: { availableForSelection: true, diff --git a/app/configurations/config.mikkeli.js b/app/configurations/config.mikkeli.js index 9704ad12b8..e5038e2ad8 100644 --- a/app/configurations/config.mikkeli.js +++ b/app/configurations/config.mikkeli.js @@ -28,11 +28,6 @@ export default configMerger(walttiConfig, { bus: { availableForSelection: true, defaultValue: true, - nearYouLabel: { - fi: 'Lähipysäkit kartalla', - sv: 'Hållplatser på kartan', - en: 'Nearby stops on map', - }, }, }, socialMedia: { diff --git a/app/configurations/config.tampere.js b/app/configurations/config.tampere.js index 24c116b3af..6b4c492192 100644 --- a/app/configurations/config.tampere.js +++ b/app/configurations/config.tampere.js @@ -333,6 +333,7 @@ export default configMerger(walttiConfig, { }, nearYouModes: ['bus', 'tram', 'rail', 'citybike'], + narrowNearYouButtons: true, bikeBoardingModes: { RAIL: { showNotification: true }, diff --git a/app/configurations/config.walttiOpas.js b/app/configurations/config.walttiOpas.js index 87fe932e35..80c4969229 100644 --- a/app/configurations/config.walttiOpas.js +++ b/app/configurations/config.walttiOpas.js @@ -21,11 +21,6 @@ export default configMerger(walttiConfig, { bus: { availableForSelection: true, defaultValue: true, - nearYouLabel: { - fi: 'Bussit ja lähipysäkit kartalla', - sv: 'Bussar och hållplatser på kartan', - en: 'Buses and nearby stops on map', - }, }, }, From b28af44599c4a917570ee1b1c51dfcb7cb4df08a Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 30 Dec 2025 15:26:35 +0200 Subject: [PATCH 065/129] fix: use nearyou consistently (no more nearbys) --- app/component/IndexPage.js | 2 +- app/component/map/NearYouMap.js | 8 ++++---- app/component/nearyou/NearYouContainer.js | 16 ++++++++-------- app/component/nearyou/NearYouPage.js | 4 ++-- app/configurations/config.default.js | 10 +++++----- app/configurations/config.hsl.js | 4 ++-- app/configurations/config.waltti.js | 4 ++-- app/util/sortUtils.js | 4 ++-- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/app/component/IndexPage.js b/app/component/IndexPage.js index 6b5e4ac7f0..d85f8600bf 100644 --- a/app/component/IndexPage.js +++ b/app/component/IndexPage.js @@ -252,7 +252,7 @@ class IndexPage extends React.Component { ? { modeSet: config.iconModeSet } : { buttonStyle: config.nearYouButton, - modeSet: config.nearbyModeSet, + modeSet: config.nearYouModeSet, horizontal: false, }; diff --git a/app/component/map/NearYouMap.js b/app/component/map/NearYouMap.js index aadb962f8e..03001b419a 100644 --- a/app/component/map/NearYouMap.js +++ b/app/component/map/NearYouMap.js @@ -17,8 +17,8 @@ import { changeRealTimeClientTopics, } from '../../action/realTimeClientAction'; import { - sortNearbyRentalStations, - sortNearbyStops, + sortNearYouRentalStations, + sortNearYouStops, } from '../../util/sortUtils'; import ItineraryLine from './ItineraryLine'; import { @@ -274,11 +274,11 @@ function NearYouMap( }); sortedEdges = filteredCityBikeEdges .slice() - .sort(sortNearbyRentalStations(favouriteIds)); + .sort(sortNearYouRentalStations(favouriteIds)); } else { sortedEdges = stops.nearest.edges .slice() - .sort(sortNearbyStops(favouriteIds, walkRoutingThreshold)); + .sort(sortNearYouStops(favouriteIds, walkRoutingThreshold)); } sortedEdges.unshift( diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index e7524847c2..315f9c5d1a 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -6,8 +6,8 @@ import { configShape, relayShape } from '../../util/shapes'; import StopNearYouContainer from './StopNearYouContainer'; import withBreakpoint from '../../util/withBreakpoint'; import { - sortNearbyRentalStations, - sortNearbyStops, + sortNearYouRentalStations, + sortNearYouStops, } from '../../util/sortUtils'; import VehicleRentalStationNearYou from './VehicleRentalStationNearYou'; import Loading from '../Loading'; @@ -76,7 +76,7 @@ function NearYouContainer( const fetchMore = edges.filter( stop => !(stop.node.place.stoptimesWithoutPatterns?.length === 0), - ).length < 5 && refetches.current < config.maxNearbyStopRefetches; + ).length < 5 && refetches.current < config.maxNearYouStopRefetches; if (fetchMore) { showMore(true); } @@ -95,7 +95,7 @@ function NearYouContainer( loadingDone(); }, []); - const createNearbyStops = () => { + const createNearYouStops = () => { if (!places?.nearest) { return []; } @@ -114,12 +114,12 @@ function NearYouContainer( }); sorted = filteredCityBikeStopEdges .slice(0, 5) - .sort(sortNearbyRentalStations(favouriteIds)); + .sort(sortNearYouRentalStations(favouriteIds)); sorted.push(...filteredCityBikeStopEdges.slice(5)); } else { sorted = edges .slice(0, 5) - .sort(sortNearbyStops(favouriteIds, walkRoutingThreshold)); + .sort(sortNearYouStops(favouriteIds, walkRoutingThreshold)); sorted.push(...edges.slice(5)); } @@ -158,13 +158,13 @@ function NearYouContainer( return stops; }; - const stops = createNearbyStops(); + const stops = createNearYouStops(); const alerts = stops .flatMap(stop => stop?.props?.stop?.routes || []) .flatMap(route => route?.alerts || []) .filter(alert => alert.alertSeverityLevel === 'SEVERE'); const noStopsFound = - !stops.length && refetches >= config.maxNearbyStopRefetches && !loading; + !stops.length && refetches >= config.maxNearYouStopRefetches && !loading; return ( <> {renderDisruptionBanner && ( diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 7c9706f663..d58a222798 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -193,8 +193,8 @@ function NearYouPage( lat: searchPosition.lat, lon: searchPosition.lon, maxResults: 10, - first: config.maxNearbyStopAmount, - maxDistance: config.maxNearbyStopDistance[queryMode.toLowerCase()], + first: config.maxNearYouStopAmount, + maxDistance: config.maxNearYouStopDistance[queryMode.toLowerCase()], filterByModes: qModes, filterByPlaceTypes: placeTypes, omitNonPickups: config.omitNonPickups, diff --git a/app/configurations/config.default.js b/app/configurations/config.default.js index e5611d5151..cf24200ed9 100644 --- a/app/configurations/config.default.js +++ b/app/configurations/config.default.js @@ -163,15 +163,15 @@ export default { minimalRegexp: /.{2,}/, }, - nearbyRoutes: { + nearYouRoutes: { radius: 10000, bucketSize: 1000, }, omitNonPickups: true, - maxNearbyStopAmount: 5, - maxNearbyStopRefetches: 5, - maxNearbyStopDistance: { + maxNearYouStopAmount: 5, + maxNearYouStopRefetches: 5, + maxNearYouStopDistance: { favorite: 20000, bus: 50000, tram: 20000, @@ -344,7 +344,7 @@ export default { sv: 'Köp ett abonnemang för en dag, en vecka eller för en hel säsong', en: 'Buy a daily, weekly or season pass', }, - maxNearbyRentalVehicleAmount: 5, + maxNearYouRentalVehicleAmount: 5, maxDistanceToRentalVehiclesInMeters: 100, maxMinutesToRentalJourneyStart: 60, maxMinutesToRentalJourneyEnd: 720, diff --git a/app/configurations/config.hsl.js b/app/configurations/config.hsl.js index 0ddd8c63bb..f5e38dbc9a 100644 --- a/app/configurations/config.hsl.js +++ b/app/configurations/config.hsl.js @@ -108,7 +108,7 @@ export default { loginAnalyticsEventName: 'user-hsl-id', loginAnalyticsKey: 'hsl-id', - nearbyRoutes: { + nearYouRoutes: { radius: 500, bucketSize: 100, }, @@ -335,7 +335,7 @@ export default { en: 'HSL', }, - maxNearbyStopDistance: { + maxNearYouStopDistance: { favorite: 20000, bus: 20000, tram: 20000, diff --git a/app/configurations/config.waltti.js b/app/configurations/config.waltti.js index 94e111db02..39436850cd 100644 --- a/app/configurations/config.waltti.js +++ b/app/configurations/config.waltti.js @@ -123,8 +123,8 @@ export default { en: 'Timetables and routes', }, nearYouModes: ['bus'], - nearbyModeSet: 'waltti', - maxNearbyStopDistance: { + nearYouModeSet: 'waltti', + maxNearYouStopDistance: { bus: 30000, tram: 30000, rail: 50000, diff --git a/app/util/sortUtils.js b/app/util/sortUtils.js index 4f439f48bc..75f3f385aa 100644 --- a/app/util/sortUtils.js +++ b/app/util/sortUtils.js @@ -3,7 +3,7 @@ * * @param {Set} favouriteRentalStationsIds stationIds of favourite bike rental stations. */ -export const sortNearbyRentalStations = favouriteRentalStationsIds => { +export const sortNearYouRentalStations = favouriteRentalStationsIds => { return (first, second) => { const firstIsClose = first.node.distance < 1500; const secondIsClose = second.node.distance < 1500; @@ -29,7 +29,7 @@ export const sortNearbyRentalStations = favouriteRentalStationsIds => { * @param {Set} favouriteStopIds gtfsIds of favourite stops and stations. * @param distanceThreshold maximum distance with which the stops are priorized */ -export const sortNearbyStops = (favouriteStopIds, distanceThreshold) => { +export const sortNearYouStops = (favouriteStopIds, distanceThreshold) => { return (first, second) => { const firstStopOrStationId = first.node.place.gtfsId; const firstStopOrStationIsClose = first.node.distance < distanceThreshold; From 2321b8a88d3266e516465d588f64e26cfe8124fb Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 31 Dec 2025 09:52:02 +0200 Subject: [PATCH 066/129] fix: remove dead Ctrlpanel props --- app/component/IndexPage.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/app/component/IndexPage.js b/app/component/IndexPage.js index d85f8600bf..f3b5aed9b7 100644 --- a/app/component/IndexPage.js +++ b/app/component/IndexPage.js @@ -382,13 +382,7 @@ class IndexPage extends React.Component {

- + - + Date: Wed, 31 Dec 2025 10:11:10 +0200 Subject: [PATCH 067/129] fix: route page should not crash if current week has no departures --- app/component/routepage/RoutePatternSelect.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/component/routepage/RoutePatternSelect.js b/app/component/routepage/RoutePatternSelect.js index a2278e9e02..b531d70303 100644 --- a/app/component/routepage/RoutePatternSelect.js +++ b/app/component/routepage/RoutePatternSelect.js @@ -134,6 +134,10 @@ export default function RoutePatternSelect( { currentPattern, optionArray, onSelectChange, className }, { config, router }, ) { + if (!currentPattern) { + return null; + } + // flatten optionArray to an ungrouped 1-D array const flattenedOptions = optionArray.reduce( (options, group) => options.concat(group.options), @@ -256,7 +260,7 @@ export default function RoutePatternSelect( } RoutePatternSelect.propTypes = { - currentPattern: patternShape.isRequired, + currentPattern: patternShape, optionArray: PropTypes.arrayOf( PropTypes.shape({ name: PropTypes.string, @@ -267,6 +271,10 @@ RoutePatternSelect.propTypes = { className: PropTypes.string.isRequired, }; +RoutePatternSelect.defaultProps = { + currentPattern: undefined, +}; + RoutePatternSelect.contextTypes = { config: configShape.isRequired, router: routerShape.isRequired, From dd00b28030acb7f23177df7e8d2389970360d3ff Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 31 Dec 2025 10:39:28 +0200 Subject: [PATCH 068/129] fix: remove references to nonexistent style class --- app/component/routepage/RouteControlPanel.js | 4 +--- app/component/stop/StopPageTabs.js | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/component/routepage/RouteControlPanel.js b/app/component/routepage/RouteControlPanel.js index 26a0811a3c..d688078596 100644 --- a/app/component/routepage/RouteControlPanel.js +++ b/app/component/routepage/RouteControlPanel.js @@ -408,9 +408,7 @@ class RouteControlPanel extends React.Component { let disruptionIcon; if (disruptionClassName === 'active-disruption-alert') { - disruptionIcon = ( - - ); + disruptionIcon = ; } else if (disruptionClassName === 'active-service-alert') { disruptionIcon = ; } diff --git a/app/component/stop/StopPageTabs.js b/app/component/stop/StopPageTabs.js index 3f20df83c1..fa351c8c46 100644 --- a/app/component/stop/StopPageTabs.js +++ b/app/component/stop/StopPageTabs.js @@ -67,9 +67,7 @@ function StopPageTabs({ stop }, { match }) { maxAlertSeverity === AlertSeverityLevelType.Unknown ) { disruptionClassName = 'active-disruption-alert'; - disruptionIcon = ( - - ); + disruptionIcon = ; } else if (maxAlertSeverity === AlertSeverityLevelType.Info) { disruptionClassName = 'active-service-alert'; disruptionIcon = ; From 1a8c1f0739d97480db5c821af1a0efa200da9f47 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 31 Dec 2025 10:51:48 +0200 Subject: [PATCH 069/129] fix: add missing caution icon to default sprite sheet --- static/assets/svg-sprite.default.svg | 29 ++++++++++++++++------------ static/assets/svg-sprite.hsl.svg | 21 ++++++++++---------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/static/assets/svg-sprite.default.svg b/static/assets/svg-sprite.default.svg index 8f4184f552..d737818dd1 100644 --- a/static/assets/svg-sprite.default.svg +++ b/static/assets/svg-sprite.default.svg @@ -45,12 +45,27 @@ + + + + + + + + + - - + + + + + + + + @@ -58,11 +73,6 @@ - - - - - @@ -1127,11 +1137,6 @@ - - - - - diff --git a/static/assets/svg-sprite.hsl.svg b/static/assets/svg-sprite.hsl.svg index 34bfd903df..ed8910949b 100644 --- a/static/assets/svg-sprite.hsl.svg +++ b/static/assets/svg-sprite.hsl.svg @@ -355,25 +355,31 @@ - - + + + + + + + + - + - + - + @@ -1111,11 +1117,6 @@ - - - - - From feed0efd22c912a18ca4c014382b4a6d994b7b6e Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 31 Dec 2025 12:09:24 +0200 Subject: [PATCH 070/129] fix: only info icon needs background circle --- app/component/DepartureRow.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/app/component/DepartureRow.js b/app/component/DepartureRow.js index aeca23b1f1..365f44cabe 100644 --- a/app/component/DepartureRow.js +++ b/app/component/DepartureRow.js @@ -47,7 +47,8 @@ export default function DepartureRow( ); let icon; let iconColor; - let backgroundShape; + let background; + let backgroundClass; let sr; if ( route?.alerts?.filter(alert => isAlertValid(alert, props.currentTime)) @@ -61,13 +62,15 @@ export default function DepartureRow( })} ); - icon = - alert.alertSeverityLevel !== 'INFO' - ? 'icon_caution-white-excl-stroke' - : 'icon_info'; - iconColor = alert.alertSeverityLevel !== 'INFO' ? '#DC0451' : '#888'; - backgroundShape = - alert.alertSeverityLevel !== 'INFO' ? undefined : 'circle'; + if (alert.alertSeverityLevel === 'INFO') { + icon = 'icon_info'; + iconColor = '#888'; + background = ; + backgroundClass = 'circle'; + } else { + icon = 'icon_caution-white-excl-stroke'; + iconColor = '#DC0451'; + } } const headsign = departure.headsign || @@ -174,10 +177,10 @@ export default function DepartureRow( {icon && ( <> } + background={background} /> {sr} From 6869970a23007861a6be71611fcbc7c3f9d8cea7 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 31 Dec 2025 12:30:00 +0200 Subject: [PATCH 071/129] fix: remove hard coded svg colors --- app/component/routepage/RouteControlPanel.js | 4 +++- app/component/stop/StopPageTabs.js | 4 +++- static/assets/svg-sprite.default.svg | 6 +++--- static/assets/svg-sprite.hsl.svg | 6 +++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/component/routepage/RouteControlPanel.js b/app/component/routepage/RouteControlPanel.js index d688078596..b83e665307 100644 --- a/app/component/routepage/RouteControlPanel.js +++ b/app/component/routepage/RouteControlPanel.js @@ -408,7 +408,9 @@ class RouteControlPanel extends React.Component { let disruptionIcon; if (disruptionClassName === 'active-disruption-alert') { - disruptionIcon = ; + disruptionIcon = ( + + ); } else if (disruptionClassName === 'active-service-alert') { disruptionIcon = ; } diff --git a/app/component/stop/StopPageTabs.js b/app/component/stop/StopPageTabs.js index fa351c8c46..849f7893f2 100644 --- a/app/component/stop/StopPageTabs.js +++ b/app/component/stop/StopPageTabs.js @@ -67,7 +67,9 @@ function StopPageTabs({ stop }, { match }) { maxAlertSeverity === AlertSeverityLevelType.Unknown ) { disruptionClassName = 'active-disruption-alert'; - disruptionIcon = ; + disruptionIcon = ( + + ); } else if (maxAlertSeverity === AlertSeverityLevelType.Info) { disruptionClassName = 'active-service-alert'; disruptionIcon = ; diff --git a/static/assets/svg-sprite.default.svg b/static/assets/svg-sprite.default.svg index d737818dd1..abe098fd5a 100644 --- a/static/assets/svg-sprite.default.svg +++ b/static/assets/svg-sprite.default.svg @@ -51,15 +51,15 @@ - + - + - + diff --git a/static/assets/svg-sprite.hsl.svg b/static/assets/svg-sprite.hsl.svg index ed8910949b..771e5e83ad 100644 --- a/static/assets/svg-sprite.hsl.svg +++ b/static/assets/svg-sprite.hsl.svg @@ -362,15 +362,15 @@ - + - + - + From 5ebad4d204a47e77674cce218f4e029827376b89 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 31 Dec 2025 12:57:08 +0200 Subject: [PATCH 072/129] feat: support bike and car park modes in CtrlPanel --- .../src/helpers/translations.js | 6 ++++++ .../digitransit-component-control-panel/src/index.js | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js b/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js index ede7486be3..7415e5936c 100644 --- a/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js +++ b/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js @@ -22,6 +22,8 @@ const translations = { rail: 'Trains and nearby stations on map', subway: 'Metro and nearby stations on map', tram: 'Trams and nearby stops on map', + 'bike-park': 'The closest bike parks', + 'car-park': 'The closest car parks', title: 'Nearby stops and routes', }, }, @@ -35,6 +37,8 @@ const translations = { rail: 'Junat ja lähiasemat kartalla', subway: 'Metrot ja lähiasemat kartalla', tram: 'Raitiovaunut ja lähipysäkit kartalla', + 'bike-park': 'Lähimmät pyöräparkit', + 'car-park': 'Lähimmät autoparkit', title: 'Lähipysäkit ja linjat', }, }, @@ -61,6 +65,8 @@ const translations = { rail: 'Tåg och stationer på kartan', subway: 'Metro och stationer på kartan', tram: 'Spårvagnar och hållplatser på kartan', + 'bike-park': 'Närmaste cykelparkering', + 'car-park': 'Närmaste bilparkering', title: 'Hållplatser och linjer nära dig', }, }, diff --git a/digitransit-component/packages/digitransit-component-control-panel/src/index.js b/digitransit-component/packages/digitransit-component-control-panel/src/index.js index 04340caefb..4c6effd180 100644 --- a/digitransit-component/packages/digitransit-component-control-panel/src/index.js +++ b/digitransit-component/packages/digitransit-component-control-panel/src/index.js @@ -79,10 +79,18 @@ const validNearYouModes = [ 'airplane', 'ferry', 'citybike', + 'bike-park', + 'car-park', ]; function getIconName(mode, modeSet) { - return modeSet === 'default' ? `mode-${mode}` : `mode-${modeSet}-${mode}`; + switch (mode) { + case 'bike-park': + case 'car-park': + return mode; + default: + return modeSet === 'default' ? `mode-${mode}` : `mode-${modeSet}-${mode}`; + } } function NearStopsAndRoutes({ From 7df4b4db3335ed3308e9f3caa7604f1002247305 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 31 Dec 2025 13:08:39 +0200 Subject: [PATCH 073/129] feat: update near you title and some translations --- .../src/helpers/translations.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js b/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js index 7415e5936c..54c0559057 100644 --- a/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js +++ b/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js @@ -17,14 +17,14 @@ const translations = { airplane: 'The closest airports', bus: 'Buses and nearby stops on map', citybike: 'The closest city bike stations', - favorite: 'Stops nearby me', + favorite: 'Favorites near you', ferry: 'The closest ferry piers', rail: 'Trains and nearby stations on map', subway: 'Metro and nearby stations on map', tram: 'Trams and nearby stops on map', 'bike-park': 'The closest bike parks', 'car-park': 'The closest car parks', - title: 'Nearby stops and routes', + title: 'Near you', }, }, fi: { @@ -32,14 +32,14 @@ const translations = { airplane: 'Lähimmät lentoasemat', bus: 'Bussit ja lähipysäkit kartalla', citybike: 'Lähimmät kaupunkipyöräasemat', - favorite: 'Omat lähipysäkit', + favorite: 'Lähimmät suosikit', ferry: 'Lähimmät lauttalaiturit', rail: 'Junat ja lähiasemat kartalla', subway: 'Metrot ja lähiasemat kartalla', tram: 'Raitiovaunut ja lähipysäkit kartalla', 'bike-park': 'Lähimmät pyöräparkit', 'car-park': 'Lähimmät autoparkit', - title: 'Lähipysäkit ja linjat', + title: 'Lähelläsi', }, }, pl: { @@ -67,7 +67,7 @@ const translations = { tram: 'Spårvagnar och hållplatser på kartan', 'bike-park': 'Närmaste cykelparkering', 'car-park': 'Närmaste bilparkering', - title: 'Hållplatser och linjer nära dig', + title: 'Nära dig', }, }, }; From 5fc9b06b9e0a0e97fbcd9b6fd5861e3a90105129 Mon Sep 17 00:00:00 2001 From: Janne Antikainen Date: Fri, 2 Jan 2026 08:16:15 +0200 Subject: [PATCH 074/129] remove unnecessary check --- 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 dd37dd4358..8058a877f4 100644 --- a/app/util/legUtils.js +++ b/app/util/legUtils.js @@ -530,7 +530,7 @@ export function getTotalBikingDistance(itinerary) { export function getTotalDrivingDistance(itinerary, config = {}) { // Don't rely only driving legs when calculating the one way journey. - if (config?.emphasizeOneWayJourney) { + if (config.emphasizeOneWayJourney) { return sumDistances(itinerary.legs); } return sumDistances(itinerary.legs.filter(isDrivingLeg)); From 0c11ff831e31728564af0723183b11940bebff34 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 2 Jan 2026 09:37:55 +0200 Subject: [PATCH 075/129] feat: new component for near you parks --- app/component/nearyou/ParkNearYou.js | 87 ++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 app/component/nearyou/ParkNearYou.js diff --git a/app/component/nearyou/ParkNearYou.js b/app/component/nearyou/ParkNearYou.js new file mode 100644 index 0000000000..8c526c95ec --- /dev/null +++ b/app/component/nearyou/ParkNearYou.js @@ -0,0 +1,87 @@ +import React, { useEffect, useRef } from 'react'; +import PropTypes from 'prop-types'; +import { Link } from 'found'; +import { graphql, createRefetchContainer } from 'react-relay'; +import { PREFIX_BIKEPARK, PREFIX_CARPARK } from '../../util/path'; +import { isKeyboardSelectionEvent } from '../../util/browser'; +import { parkShape, relayShape } from '../../util/shapes'; +import ParkAndRideContent from '../ParkAndRideContent'; + +const ParkNearYou = ({ park, relay, currentTime, isParentTabActive, mode }) => { + const timeRef = useRef(currentTime); + + useEffect(() => { + const { vehicleParkingId } = park; + if (isParentTabActive && currentTime - timeRef.current > 30) { + relay.refetch( + oldVariables => { + return { ...oldVariables, vehicleParkingId }; + }, + null, + null, + { force: true }, // query variables stay the same between refetches + ); + timeRef.current = currentTime; + } + }, [currentTime, isParentTabActive]); + + const prefix = mode === 'BIKE_PARK' ? PREFIX_BIKEPARK : PREFIX_CARPARK; + return ( + +
+
+
+ { + e.stopPropagation(); + }} + onKeyPress={e => { + if (isKeyboardSelectionEvent(e)) { + e.stopPropagation(); + } + }} + to={`/${prefix}/${park.vehicleParkingId}`} + > +

{park.name}

+ +
+
+ +
+
+ ); +}; + +ParkNearYou.propTypes = { + park: parkShape.isRequired, + currentTime: PropTypes.number, + isParentTabActive: PropTypes.bool, + relay: relayShape.isRequired, + mode: PropTypes.string.isRequired, +}; + +ParkNearYou.defaultProps = { + currentTime: undefined, + isParentTabActive: false, +}; + +const containerComponent = createRefetchContainer( + ParkNearYou, + { + park: graphql` + fragment ParkNearYou_park on VehicleParking { + ...ParkContainer_vehicleParking + vehicleParkingId + } + `, + }, + graphql` + query ParkNearYouRefetchQuery($vehicleParkingId: String!) { + vehicleParking(id: $vehicleParkingId) { + ...ParkNearYou_park + } + } + `, +); + +export { containerComponent as default, ParkNearYou as Component }; From 6a16ab5a88ea3874a847ac9cdefd152700dcbb12 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 2 Jan 2026 09:38:40 +0200 Subject: [PATCH 076/129] feat: park support in map wrapper --- app/component/nearyou/MapWrapper.js | 28 +++++++++++++++++++++------- app/configurations/config.tampere.js | 2 +- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/app/component/nearyou/MapWrapper.js b/app/component/nearyou/MapWrapper.js index 04e7597881..c0bf286fb3 100644 --- a/app/component/nearyou/MapWrapper.js +++ b/app/component/nearyou/MapWrapper.js @@ -11,6 +11,8 @@ import NearYouMapContainer from './NearYouMapContainer'; import NearYouFavouritesMapContainer from './NearYouFavouritesMapContainer'; import { mapLayerShape } from '../../store/MapLayerStore'; +const TransitStopModes = ['BUS', 'FERRY', 'RAIL', 'SUBWAY', 'TRAM']; + export default function MapWrapper( { match, @@ -78,21 +80,33 @@ export default function MapWrapper( ); } - const citybike = mode === 'CITYBIKE'; const filteredMapLayers = { ...mapLayers, - citybike, - citybikeOverrideMinZoom: citybike, + citybike: mode === 'CITYBIKE', + parkAndRide: mode === 'CAR_PARK', + parkAndRideForBikes: mode === 'BIKE_PARK', + citybikeOverrideMinZoom: mode === 'CITYBIKE', }; if (!config.map.showLayerSelector) { filteredMapLayers.stop = {}; - if (!citybike) { + if (TransitStopModes.includes(mode)) { filteredMapLayers.stop[mode.toLowerCase()] = true; } } - const favouriteIds = citybike - ? new Set(favouriteVehicleStationIds) - : new Set([...favouriteStopIds, ...favouriteStationIds]); + let favouriteIds; + switch (mode) { + case 'CITYBIKE': + favouriteIds = new Set(favouriteVehicleStationIds); + break; + case 'BIKE_PARK': + case 'CAR_PARK': + favouriteIds = new Set(); + break; + default: + favouriteIds = new Set([...favouriteStopIds, ...favouriteStationIds]); + break; + } + return ( Date: Fri, 2 Jan 2026 12:27:41 +0200 Subject: [PATCH 077/129] feat: support parks in NearYouContainer --- app/component/nearyou/MapWrapper.js | 8 ++++---- app/component/nearyou/NearYouContainer.js | 16 ++++++++++++++++ app/component/nearyou/ParkNearYou.js | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/app/component/nearyou/MapWrapper.js b/app/component/nearyou/MapWrapper.js index c0bf286fb3..6e7e68bd6c 100644 --- a/app/component/nearyou/MapWrapper.js +++ b/app/component/nearyou/MapWrapper.js @@ -82,9 +82,9 @@ export default function MapWrapper( const filteredMapLayers = { ...mapLayers, + parkAndRide: mode === 'CARPARK', + parkAndRideForBikes: mode === 'BIKEPARK', citybike: mode === 'CITYBIKE', - parkAndRide: mode === 'CAR_PARK', - parkAndRideForBikes: mode === 'BIKE_PARK', citybikeOverrideMinZoom: mode === 'CITYBIKE', }; if (!config.map.showLayerSelector) { @@ -98,8 +98,8 @@ export default function MapWrapper( case 'CITYBIKE': favouriteIds = new Set(favouriteVehicleStationIds); break; - case 'BIKE_PARK': - case 'CAR_PARK': + case 'BIKEPARK': + case 'CARPARK': favouriteIds = new Set(); break; default: diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index 315f9c5d1a..b85967f788 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -10,6 +10,7 @@ import { sortNearYouStops, } from '../../util/sortUtils'; import VehicleRentalStationNearYou from './VehicleRentalStationNearYou'; +import ParkNearYou from './ParkNearYou'; import Loading from '../Loading'; import Icon from '../Icon'; import { getDefaultNetworks } from '../../util/vehicleRentalUtils'; @@ -116,6 +117,8 @@ function NearYouContainer( .slice(0, 5) .sort(sortNearYouRentalStations(favouriteIds)); sorted.push(...filteredCityBikeStopEdges.slice(5)); + } else if (mode === 'BIKEPARK' || mode === 'CARPARK') { + sorted = edges; } else { sorted = edges .slice(0, 5) @@ -150,6 +153,16 @@ function NearYouContainer( isParentTabActive={isParentTabActive} /> ); + case 'VehicleParking': + return ( + + ); default: return null; } @@ -289,6 +302,9 @@ const refetchContainer = createPaginationContainer( networkId } } + ... on VehicleParking { + ...ParkNearYou_park + } ... on Stop { ...StopNearYouContainer_stop @arguments( diff --git a/app/component/nearyou/ParkNearYou.js b/app/component/nearyou/ParkNearYou.js index 8c526c95ec..0d3fb311a4 100644 --- a/app/component/nearyou/ParkNearYou.js +++ b/app/component/nearyou/ParkNearYou.js @@ -25,7 +25,7 @@ const ParkNearYou = ({ park, relay, currentTime, isParentTabActive, mode }) => { } }, [currentTime, isParentTabActive]); - const prefix = mode === 'BIKE_PARK' ? PREFIX_BIKEPARK : PREFIX_CARPARK; + const prefix = mode === 'BIKEPARK' ? PREFIX_BIKEPARK : PREFIX_CARPARK; return (
From 5cde0b9f5bbf80a08e2d569d83618fc795f4b090 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 2 Jan 2026 13:06:54 +0200 Subject: [PATCH 078/129] feat: NearYouMap supports parks --- app/component/map/NearYouMap.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/component/map/NearYouMap.js b/app/component/map/NearYouMap.js index 03001b419a..3f5e5179eb 100644 --- a/app/component/map/NearYouMap.js +++ b/app/component/map/NearYouMap.js @@ -114,6 +114,8 @@ const handleBounds = (location, edges) => { return bounds; }; +const nonTransit = ['CITYBIKE', 'BIKEPARK', 'CARPARK']; + function NearYouMap( { breakpoint, @@ -138,11 +140,11 @@ function NearYouMap( const clientOn = useRef(false); const mwtRef = useRef(); const { mode } = match.params; - const isTransitMode = mode !== 'CITYBIKE'; const walkRoutingThreshold = mode === 'RAIL' || mode === 'SUBWAY' || mode === 'FERRY' ? 3000 : 1500; const { environment } = relay; const { config } = context; + const isTransitMode = !nonTransit.includes(mode); const fetchPlan = node => { if (node.distance < walkRoutingThreshold) { @@ -263,7 +265,7 @@ function NearYouMap( useEffect(() => { let sortedEdges; if (stops.nearest?.edges) { - if (!isTransitMode) { + if (mode === 'CITYBIKE') { const withNetworks = stops.nearest.edges.filter(edge => { return !!edge.node.place?.rentalNetwork?.networkId; }); @@ -275,10 +277,12 @@ function NearYouMap( sortedEdges = filteredCityBikeEdges .slice() .sort(sortNearYouRentalStations(favouriteIds)); - } else { + } else if (isTransitMode) { sortedEdges = stops.nearest.edges .slice() .sort(sortNearYouStops(favouriteIds, walkRoutingThreshold)); + } else { + sortedEdges = stops.nearest.edges.slice(); } sortedEdges.unshift( From d8de40786306afdaf9f5deb05721829c640a6141 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 2 Jan 2026 13:42:41 +0200 Subject: [PATCH 079/129] feat: support parks in NearYouMapContainer --- app/component/nearyou/NearYouMapContainer.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/component/nearyou/NearYouMapContainer.js b/app/component/nearyou/NearYouMapContainer.js index 95b443a2c2..62436bf1ad 100644 --- a/app/component/nearyou/NearYouMapContainer.js +++ b/app/component/nearyou/NearYouMapContainer.js @@ -38,6 +38,9 @@ const containerComponent = createPaginationContainer( lon stationId } + ... on VehicleParking { + ...ParkNearYou_park + } ... on Stop { gtfsId lat From 3918758049bd1c31997d51dbad06074443106659 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 2 Jan 2026 13:46:46 +0200 Subject: [PATCH 080/129] fix: remove useless prop --- app/component/nearyou/NearYouContainer.js | 7 +------ app/component/nearyou/NearYouPage.js | 1 - app/configurations/config.hsl.js | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index b85967f788..a1bde4ba30 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -26,7 +26,6 @@ function NearYouContainer( withSeparator, prioritizedStops, mode, - renderDisruptionBanner, isParentTabActive, favouriteIds, }, @@ -180,9 +179,7 @@ function NearYouContainer( !stops.length && refetches >= config.maxNearYouStopRefetches && !loading; return ( <> - {renderDisruptionBanner && ( - - )} + {alerts?.length && } {((!relay.hasMore() && !stops.length && !prioritizedStops.length) || (noStopsFound && !prioritizedStops.length)) && ( <> @@ -239,7 +236,6 @@ NearYouContainer.propTypes = { withSeparator: PropTypes.bool, prioritizedStops: PropTypes.arrayOf(PropTypes.string).isRequired, mode: PropTypes.string.isRequired, - renderDisruptionBanner: PropTypes.bool, isParentTabActive: PropTypes.bool, // eslint-disable-next-line favouriteIds: PropTypes.object, @@ -248,7 +244,6 @@ NearYouContainer.propTypes = { NearYouContainer.defaultProps = { places: undefined, withSeparator: false, - renderDisruptionBanner: false, isParentTabActive: false, }; diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index d58a222798..061a47a614 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -426,7 +426,6 @@ function NearYouPage( position={searchPosition} withSeparator={!renderStopRouteSearch} mode={tabMode} - renderDisruptionBanner={tabMode !== 'CITYBIKE'} isParentTabActive={isActive} currentTime={currentTime} favouriteIds={favouriteIds} diff --git a/app/configurations/config.hsl.js b/app/configurations/config.hsl.js index f5e38dbc9a..c1ac3864f1 100644 --- a/app/configurations/config.hsl.js +++ b/app/configurations/config.hsl.js @@ -467,7 +467,7 @@ export default { enabled: true, season: { preSeasonStart: '18.3', - start: '1.4', + start: '1.1', end: '31.10', }, capacity: BIKEAVL_WITHMAX, From a605c0a228cd0f5161d0c91e036153d372555179 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 2 Jan 2026 14:33:50 +0200 Subject: [PATCH 081/129] chore: park modes without hyphen, for consistency --- .../digitransit-component-control-panel/src/index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/digitransit-component/packages/digitransit-component-control-panel/src/index.js b/digitransit-component/packages/digitransit-component-control-panel/src/index.js index 4c6effd180..517a46f783 100644 --- a/digitransit-component/packages/digitransit-component-control-panel/src/index.js +++ b/digitransit-component/packages/digitransit-component-control-panel/src/index.js @@ -79,15 +79,16 @@ const validNearYouModes = [ 'airplane', 'ferry', 'citybike', - 'bike-park', - 'car-park', + 'bikepark', + 'carpark', ]; function getIconName(mode, modeSet) { switch (mode) { - case 'bike-park': - case 'car-park': - return mode; + case 'bikepark': + return 'bike-park'; + case 'carpark': + return 'car-park'; default: return modeSet === 'default' ? `mode-${mode}` : `mode-${modeSet}-${mode}`; } From 527a9d903838f695a01deb567341a943dd8547b0 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 2 Jan 2026 14:38:11 +0200 Subject: [PATCH 082/129] feat: NearYouPage supports parks --- app/component/nearyou/NearYouPage.js | 47 +++++++++++++++++++++------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 061a47a614..7f313af33f 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -179,13 +179,25 @@ function NearYouPage( vehicleRentalStationIds: favouriteVehicleStationIds, }; } - let placeTypes = ['STOP', 'STATION']; - let qModes = [queryMode]; + let placeTypes = []; + let qModes = []; let allowedNetworks = []; - if (queryMode === 'CITYBIKE') { - placeTypes = 'VEHICLE_RENT'; - qModes = ['BICYCLE']; - allowedNetworks = getDefaultNetworks(config); + switch (queryMode) { + case 'CITYBIKE': + placeTypes = 'VEHICLE_RENT'; + qModes = ['BICYCLE']; + allowedNetworks = getDefaultNetworks(config); + break; + case 'BIKEPARK': + placeTypes = 'BIKE_PARK'; + break; + case 'CARPARK': + placeTypes = 'CAR_PARK'; + break; + default: + placeTypes = ['STOP', 'STATION']; + qModes = [queryMode]; + break; } const prioritizedStops = config.prioritizedStopsNearYou[queryMode.toLowerCase()] || []; @@ -358,11 +370,22 @@ function NearYouPage( render={({ props }) => { const prioritizedStops = config.prioritizedStopsNearYou[tabMode.toLowerCase()] || []; - const favouriteIds = - mode === 'CITYBIKE' - ? new Set(favouriteVehicleStationIds) - : new Set([...favouriteStopIds, ...favouriteStationIds]); - + let favIds; + switch (mode) { + case 'CITYBIKE': + favIds = new Set(favouriteVehicleStationIds); + break; + case 'BIKEPARK': + case 'CARPARK': + favIds = new Set(); + break; + default: + favIds = new Set([ + ...favouriteStopIds, + ...favouriteStationIds, + ]); + break; + } return (
{renderStopRouteSearch && ( @@ -428,7 +451,7 @@ function NearYouPage( mode={tabMode} isParentTabActive={isActive} currentTime={currentTime} - favouriteIds={favouriteIds} + favouriteIds={favIds} /> ) : (
From f115b13b0f65361606b88112339101dc2cd5c866 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 2 Jan 2026 15:18:03 +0200 Subject: [PATCH 083/129] fix: rename park capacity Relay does not allow using same field name with different type in a query which returns both parent types --- app/component/ParkAndRideContent.js | 2 +- app/component/ParkContainer.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/component/ParkAndRideContent.js b/app/component/ParkAndRideContent.js index f0f78c1a86..898202535e 100644 --- a/app/component/ParkAndRideContent.js +++ b/app/component/ParkAndRideContent.js @@ -37,7 +37,7 @@ function ParkAndRideContent( spacesAvailable = vehicleParking.availability?.bicycleSpaces; } else { spacesAvailable = vehicleParking.availability?.carSpaces; - maxCapacity = vehicleParking.capacity?.carSpaces || 1; + maxCapacity = vehicleParking.parkCapacity?.carSpaces || 1; } const { diff --git a/app/component/ParkContainer.js b/app/component/ParkContainer.js index 1da8696a5e..3fb359e087 100644 --- a/app/component/ParkContainer.js +++ b/app/component/ParkContainer.js @@ -8,7 +8,7 @@ const containerComponent = createFragmentContainer(ParkAndRideContent, { bicycleSpaces carSpaces } - capacity { + parkCapacity: capacity { carSpaces } name From 4c7cd26563e2120c1b98692ea4663fc091295e6d Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 2 Jan 2026 15:23:10 +0200 Subject: [PATCH 084/129] chore: tune --- app/component/nearyou/NearYouContainer.js | 1 + app/component/nearyou/NearYouMapContainer.js | 4 +++- app/configurations/config.tampere.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index a1bde4ba30..5b4816bf53 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -299,6 +299,7 @@ const refetchContainer = createPaginationContainer( } ... on VehicleParking { ...ParkNearYou_park + vehicleParkingId } ... on Stop { ...StopNearYouContainer_stop diff --git a/app/component/nearyou/NearYouMapContainer.js b/app/component/nearyou/NearYouMapContainer.js index 62436bf1ad..d4a378b313 100644 --- a/app/component/nearyou/NearYouMapContainer.js +++ b/app/component/nearyou/NearYouMapContainer.js @@ -39,7 +39,9 @@ const containerComponent = createPaginationContainer( stationId } ... on VehicleParking { - ...ParkNearYou_park + lat + lon + vehicleParkingId } ... on Stop { gtfsId diff --git a/app/configurations/config.tampere.js b/app/configurations/config.tampere.js index 676442bfab..af668b52cd 100644 --- a/app/configurations/config.tampere.js +++ b/app/configurations/config.tampere.js @@ -332,7 +332,7 @@ export default configMerger(walttiConfig, { }, }, - nearYouModes: ['bus', 'tram', 'rail', 'citybike', 'bike-park'], + nearYouModes: ['bus', 'tram', 'rail', 'citybike', 'bikepark', 'carpark'], narrowNearYouButtons: true, bikeBoardingModes: { From a32c75c0b3953f8d1dc6b67d850f389e3ac2f010 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 2 Jan 2026 15:44:40 +0200 Subject: [PATCH 085/129] fix: add maxDistance to new modes, rename --- app/component/nearyou/NearYouContainer.js | 14 +++++++------- app/component/nearyou/NearYouPage.js | 4 ++-- app/configurations/config.default.js | 8 +++++--- app/configurations/config.hsl.js | 2 +- app/configurations/config.waltti.js | 2 +- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index 5b4816bf53..36fede2e75 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -76,7 +76,7 @@ function NearYouContainer( const fetchMore = edges.filter( stop => !(stop.node.place.stoptimesWithoutPatterns?.length === 0), - ).length < 5 && refetches.current < config.maxNearYouStopRefetches; + ).length < 5 && refetches.current < config.maxNearYouRefetches; if (fetchMore) { showMore(true); } @@ -95,7 +95,7 @@ function NearYouContainer( loadingDone(); }, []); - const createNearYouStops = () => { + const createNearYouPlaces = () => { if (!places?.nearest) { return []; } @@ -170,17 +170,17 @@ function NearYouContainer( return stops; }; - const stops = createNearYouStops(); - const alerts = stops + const items = createNearYouPlaces(); + const alerts = items .flatMap(stop => stop?.props?.stop?.routes || []) .flatMap(route => route?.alerts || []) .filter(alert => alert.alertSeverityLevel === 'SEVERE'); const noStopsFound = - !stops.length && refetches >= config.maxNearYouStopRefetches && !loading; + !items.length && refetches >= config.maxNearYouRefetches && !loading; return ( <> {alerts?.length && } - {((!relay.hasMore() && !stops.length && !prioritizedStops.length) || + {((!relay.hasMore() && !items.length && !prioritizedStops.length) || (noStopsFound && !prioritizedStops.length)) && ( <> {withSeparator &&
} @@ -199,7 +199,7 @@ function NearYouContainer(
)}
- {stops} + {items}
{loading === 2 && (
diff --git a/app/component/nearyou/NearYouPage.js b/app/component/nearyou/NearYouPage.js index 7f313af33f..1a2be9dba8 100644 --- a/app/component/nearyou/NearYouPage.js +++ b/app/component/nearyou/NearYouPage.js @@ -205,8 +205,8 @@ function NearYouPage( lat: searchPosition.lat, lon: searchPosition.lon, maxResults: 10, - first: config.maxNearYouStopAmount, - maxDistance: config.maxNearYouStopDistance[queryMode.toLowerCase()], + first: config.maxNearYouCount, + maxDistance: config.maxNearYouDistance[queryMode.toLowerCase()], filterByModes: qModes, filterByPlaceTypes: placeTypes, omitNonPickups: config.omitNonPickups, diff --git a/app/configurations/config.default.js b/app/configurations/config.default.js index cf24200ed9..9dcd32e34c 100644 --- a/app/configurations/config.default.js +++ b/app/configurations/config.default.js @@ -169,9 +169,9 @@ export default { }, omitNonPickups: true, - maxNearYouStopAmount: 5, - maxNearYouStopRefetches: 5, - maxNearYouStopDistance: { + maxNearYouCount: 5, + maxNearYouRefetches: 5, + maxNearYouDistance: { favorite: 20000, bus: 50000, tram: 20000, @@ -180,6 +180,8 @@ export default { ferry: 50000, citybike: 20000, airplane: 100000, + bikepark: 10000, + carpark: 50000, }, defaultSettings: { diff --git a/app/configurations/config.hsl.js b/app/configurations/config.hsl.js index c1ac3864f1..53161a70f6 100644 --- a/app/configurations/config.hsl.js +++ b/app/configurations/config.hsl.js @@ -335,7 +335,7 @@ export default { en: 'HSL', }, - maxNearYouStopDistance: { + maxNearYouDistance: { favorite: 20000, bus: 20000, tram: 20000, diff --git a/app/configurations/config.waltti.js b/app/configurations/config.waltti.js index 39436850cd..8ba0f5df44 100644 --- a/app/configurations/config.waltti.js +++ b/app/configurations/config.waltti.js @@ -124,7 +124,7 @@ export default { }, nearYouModes: ['bus'], nearYouModeSet: 'waltti', - maxNearYouStopDistance: { + maxNearYouDistance: { bus: 30000, tram: 30000, rail: 50000, From 7a6ad8ea05341a7b4294a71951eea8fabc935be9 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 2 Jan 2026 15:51:48 +0200 Subject: [PATCH 086/129] fix: alert rendering jsx syntax --- app/component/nearyou/NearYouContainer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index 36fede2e75..07251eac05 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -179,7 +179,7 @@ function NearYouContainer( !items.length && refetches >= config.maxNearYouRefetches && !loading; return ( <> - {alerts?.length && } + {alerts?.length ? : null} {((!relay.hasMore() && !items.length && !prioritizedStops.length) || (noStopsFound && !prioritizedStops.length)) && ( <> From 14b3cabfffaa6dcb7e789ffd0ab62857bc2ce568 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 2 Jan 2026 16:07:29 +0200 Subject: [PATCH 087/129] feat: add translations --- app/translations.js | 6 ++++++ .../src/helpers/translations.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/app/translations.js b/app/translations.js index 99a503d5cf..07603934bf 100644 --- a/app/translations.js +++ b/app/translations.js @@ -1380,7 +1380,9 @@ const translations = { 'There are no stops or stations for the selected mode of transport nearby.', 'nearest-stops': 'The closest stops', 'nearest-stops-airplane': 'airports', + 'nearest-stops-bikepark': 'bike parking', 'nearest-stops-bus': 'bus stops', + 'nearest-stops-carpark': 'car parking', 'nearest-stops-citybike': 'bike stations', 'nearest-stops-favorite': 'stops nearby me', 'nearest-stops-ferry': 'ferry piers', @@ -2705,7 +2707,9 @@ const translations = { 'Valitun liikennevälineen asemia tai pysäkkejä ei ole lähialueella.', 'nearest-stops': 'Lähimmät pysäkit', 'nearest-stops-airplane': 'lentoasemat', + 'nearest-stops-bikepark': 'pyöräparkit', 'nearest-stops-bus': 'bussipysäkit', + 'nearest-stops-carpark': 'autoparkit', 'nearest-stops-citybike': 'pyöräasemat', 'nearest-stops-favorite': 'omat lähipysäkit', 'nearest-stops-ferry': 'lauttalaiturit', @@ -5659,7 +5663,9 @@ const translations = { 'Inga stationer eller hållplatser för det valda trafikfordont i närheten.', 'nearest-stops': 'Närliggande hållplatser', 'nearest-stops-airplane': 'flygplatser', + 'nearest-stops-bikepark': 'cykelparkering', 'nearest-stops-bus': 'busshållplatser', + 'nearest-stops-carpark': 'anslutningsparkering', 'nearest-stops-citybike': 'cykelstationer', 'nearest-stops-favorite': 'hållplatser nära mig', 'nearest-stops-ferry': 'färjekajer', diff --git a/digitransit-component/packages/digitransit-component-autosuggest/src/helpers/translations.js b/digitransit-component/packages/digitransit-component-autosuggest/src/helpers/translations.js index 0daf347166..a594a2694d 100644 --- a/digitransit-component/packages/digitransit-component-autosuggest/src/helpers/translations.js +++ b/digitransit-component/packages/digitransit-component-autosuggest/src/helpers/translations.js @@ -145,7 +145,9 @@ const translations = { stop: 'Stop', 'stop-near-you': 'Search stops and routes', 'stop-near-you-airplane': 'Search flights or airports', + 'stop-near-you-bikepark': 'Search bike parks', 'stop-near-you-bus': 'Search bus routes or stops', + 'stop-near-you-carpark': 'Search car parks', 'stop-near-you-citybike': 'Search city bike stations', 'stop-near-you-rail': 'Search train routes or stations', 'stop-near-you-subway': 'Search metro routes or stations ', @@ -230,7 +232,9 @@ const translations = { stop: 'Pysäkki', 'stop-near-you': 'Linja, pysäkki tai asema', 'stop-near-you-airplane': 'Hae lentoja tai lentoasemaa', + 'stop-near-you-bikepark': 'Hae pyöräparkkia', 'stop-near-you-bus': 'Hae bussilinjaa tai pysäkkiä', + 'stop-near-you-carpark': 'Hae autoparkkia', 'stop-near-you-citybike': 'Hae kaupunkipyöräasemaa', 'stop-near-you-rail': 'Hae lähijunaa tai asemaa', 'stop-near-you-subway': 'Hae metrolinjaa tai asemaa', @@ -401,7 +405,9 @@ const translations = { stop: 'Hållplats', 'stop-near-you': 'Sök hållplatser eller linjer', 'stop-near-you-airplane': 'Sök flyg eller flygplatser', + 'stop-near-you-bikepark': 'Sök cykelparkering', 'stop-near-you-bus': 'Sök busslinjer eller hållplatser', + 'stop-near-you-carpark': 'Sök anslutningsparkering', 'stop-near-you-citybike': 'Sök stadscykelstationer', 'stop-near-you-rail': 'Sök närtåger eller stationer', 'stop-near-you-subway': 'Sök metrolinjer eller stationer', From a4b4f626d100cbf6e55137a28269da8c3bfcd056 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 2 Jan 2026 20:15:45 +0200 Subject: [PATCH 088/129] feat: park specific search --- app/component/nearyou/StopRouteSearch.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/component/nearyou/StopRouteSearch.js b/app/component/nearyou/StopRouteSearch.js index 40bbc06edb..b4b54b7131 100644 --- a/app/component/nearyou/StopRouteSearch.js +++ b/app/component/nearyou/StopRouteSearch.js @@ -22,6 +22,19 @@ function StopRouteSearch({ mode, ...rest }, { router, config }) { const selectHandler = item => { router.push(getStopRoutePath(item)); }; + let targets; + switch (mode) { + case 'CITYBIKE': + targets = ['VehicleRentalStations']; + break; + case 'BIKEPARK': + case 'CARPARK': + targets = ['ParkingAreas']; + break; + default: + targets = ['Stops', 'Stations', 'Routes']; + break; + } return (
Date: Mon, 5 Jan 2026 08:51:43 +0200 Subject: [PATCH 089/129] fix: allow map rendering while query is not finished yet Otherwise a white map flashes when near you tab is changed --- app/component/map/NearYouMap.js | 3 ++ app/component/nearyou/MapWrapper.js | 54 +++++++++++++---------------- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/app/component/map/NearYouMap.js b/app/component/map/NearYouMap.js index 3f5e5179eb..dc06933ebf 100644 --- a/app/component/map/NearYouMap.js +++ b/app/component/map/NearYouMap.js @@ -263,6 +263,9 @@ function NearYouMap( }, [uniqueRealtimeTopics]); useEffect(() => { + if (!stops) { + return; + } let sortedEdges; if (stops.nearest?.edges) { if (mode === 'CITYBIKE') { diff --git a/app/component/nearyou/MapWrapper.js b/app/component/nearyou/MapWrapper.js index 6e7e68bd6c..a92112fa22 100644 --- a/app/component/nearyou/MapWrapper.js +++ b/app/component/nearyou/MapWrapper.js @@ -59,23 +59,21 @@ export default function MapWrapper( `} variables={variables} environment={relayEnvironment} - render={({ props }) => { - return props ? ( - - ) : null; - }} + render={({ props }) => ( + + )} /> ); } @@ -141,18 +139,16 @@ export default function MapWrapper( `} variables={variables} environment={relayEnvironment} - render={({ props }) => { - return props ? ( - - ) : null; - }} + render={({ props }) => ( + + )} /> ); } From e9a7e9502accbf281286ba53836290e88eea7d59 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Mon, 5 Jan 2026 11:04:36 +0200 Subject: [PATCH 090/129] feat: add svg for vertical park icons --- .../digitransit-component-icon/src/assets/bike-park-fill.svg | 3 +++ .../src/assets/{bus-waltti.svg => bus-fill.svg} | 0 .../digitransit-component-icon/src/assets/car-park-fill.svg | 3 +++ .../src/assets/{citybike-waltti.svg => citybike-fill.svg} | 0 .../src/assets/{ferry-waltti.svg => ferry-fill.svg} | 0 .../src/assets/{rail-waltti.svg => rail-fill.svg} | 0 .../src/assets/{tram-waltti.svg => tram-fill.svg} | 0 7 files changed, 6 insertions(+) create mode 100644 digitransit-component/packages/digitransit-component-icon/src/assets/bike-park-fill.svg rename digitransit-component/packages/digitransit-component-icon/src/assets/{bus-waltti.svg => bus-fill.svg} (100%) create mode 100644 digitransit-component/packages/digitransit-component-icon/src/assets/car-park-fill.svg rename digitransit-component/packages/digitransit-component-icon/src/assets/{citybike-waltti.svg => citybike-fill.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{ferry-waltti.svg => ferry-fill.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{rail-waltti.svg => rail-fill.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{tram-waltti.svg => tram-fill.svg} (100%) diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bike-park-fill.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bike-park-fill.svg new file mode 100644 index 0000000000..be7ad9030c --- /dev/null +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/bike-park-fill.svg @@ -0,0 +1,3 @@ + + + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bus-waltti.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-fill.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/bus-waltti.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/bus-fill.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/car-park-fill.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/car-park-fill.svg new file mode 100644 index 0000000000..fd39079a38 --- /dev/null +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/car-park-fill.svg @@ -0,0 +1,3 @@ + + + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/citybike-waltti.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/citybike-fill.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/citybike-waltti.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/citybike-fill.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-waltti.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-fill.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/ferry-waltti.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/ferry-fill.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/rail-waltti.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/rail-fill.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/rail-waltti.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/rail-fill.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/tram-waltti.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/tram-fill.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/tram-waltti.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/tram-fill.svg From 154ff6355823753b1a75d71ce99e7ea662ce37c7 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Mon, 5 Jan 2026 11:11:57 +0200 Subject: [PATCH 091/129] fix: Give sensible name for part of icons --- app/configurations/config.tampere.js | 1 - .../digitransit-component-icon/package.json | 2 +- .../digitransit-component-icon/src/index.js | 24 +++++++++++-------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/configurations/config.tampere.js b/app/configurations/config.tampere.js index af668b52cd..82ab9a5f87 100644 --- a/app/configurations/config.tampere.js +++ b/app/configurations/config.tampere.js @@ -333,7 +333,6 @@ export default configMerger(walttiConfig, { }, nearYouModes: ['bus', 'tram', 'rail', 'citybike', 'bikepark', 'carpark'], - narrowNearYouButtons: true, bikeBoardingModes: { RAIL: { showNotification: true }, diff --git a/digitransit-component/packages/digitransit-component-icon/package.json b/digitransit-component/packages/digitransit-component-icon/package.json index 7e3287b913..1f3c59aac6 100644 --- a/digitransit-component/packages/digitransit-component-icon/package.json +++ b/digitransit-component/packages/digitransit-component-icon/package.json @@ -1,6 +1,6 @@ { "name": "@digitransit-component/digitransit-component-icon", - "version": "1.2.0", + "version": "2.0.0", "description": "digitransit-component icon module", "main": "index.js", "files": [ diff --git a/digitransit-component/packages/digitransit-component-icon/src/index.js b/digitransit-component/packages/digitransit-component-icon/src/index.js index 062945446e..777cf8d071 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/index.js +++ b/digitransit-component/packages/digitransit-component-icon/src/index.js @@ -28,6 +28,8 @@ import Plus from './assets/plus.svg'; import Attention from './assets/attention.svg'; import Dropdown from './assets/dropdown.svg'; import CarPark from './assets/car-park.svg'; +import CarParkFill from './assets/car-park-fill.svg'; +import BikeParkFill from './assets/bike-park-fill.svg'; import BikePark from './assets/bike-park.svg'; import Time from './assets/time.svg'; import Ellipsis from './assets/ellipsis.svg'; @@ -53,11 +55,11 @@ import ModeDigiFunicular from './assets/mode_digi_funicular.svg'; import FutureRoute from './assets/icon-route.svg'; import Position from './assets/position.svg'; import SearchStreetName from './assets/search-streetname.svg'; -import BusWaltti from './assets/bus-waltti.svg'; -import FerryWaltti from './assets/ferry-waltti.svg'; -import BikeRentalStationWaltti from './assets/citybike-waltti.svg'; -import RailWaltti from './assets/rail-waltti.svg'; -import TramWaltti from './assets/tram-waltti.svg'; +import BusFill from './assets/bus-fill.svg'; +import FerryFill from './assets/ferry-fill.svg'; +import BikeRentalStationFill from './assets/citybike-fill.svg'; +import RailFill from './assets/rail-fill.svg'; +import TramFill from './assets/tram-fill.svg'; import Check from './assets/check.svg'; import SearchBusStopDefault from './assets/search-bus-stop-default.svg'; import SearchBusStopExpressDefault from './assets/search-bus-stop-express-default.svg'; @@ -139,11 +141,13 @@ const iconMap = { 'mode-digitransit-airplane': ModeAirplane, 'mode-digitransit-subway': Subway, 'mode-digitransit-funicular': ModeDigiFunicular, - 'mode-waltti-bus': BusWaltti, - 'mode-waltti-citybike': BikeRentalStationWaltti, - 'mode-waltti-ferry': FerryWaltti, - 'mode-waltti-rail': RailWaltti, - 'mode-waltti-tram': TramWaltti, + 'bus-fill': BusFill, + 'citybike-fill': BikeRentalStationFill, + 'ferry-fill': FerryFill, + 'rail-fill': RailFill, + 'tram-fill': TramFill, + 'bike-park-fill': BikeParkFill, + 'car-park-fill': CarParkFill, 'future-route': FutureRoute, position: Position, 'search-street-name': SearchStreetName, From 4169d00dda326f9173544ad4cb8dffde9de51c28 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Mon, 5 Jan 2026 11:37:55 +0200 Subject: [PATCH 092/129] chore: major version bump after breaking icon name change --- .../digitransit-component-autosuggest-panel/package.json | 2 +- .../packages/digitransit-component-autosuggest/package.json | 2 +- .../packages/digitransit-component-control-panel/package.json | 2 +- .../digitransit-component-datetimepicker/package.json | 4 ++-- .../packages/digitransit-component-favourite-bar/package.json | 4 ++-- .../package.json | 4 ++-- .../digitransit-component-favourite-modal/package.json | 4 ++-- .../digitransit-component-suggestion-item/package.json | 4 ++-- .../digitransit-component-traffic-now-link/package.json | 4 ++-- .../packages/digitransit-component/package.json | 4 ++-- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/digitransit-component/packages/digitransit-component-autosuggest-panel/package.json b/digitransit-component/packages/digitransit-component-autosuggest-panel/package.json index f9b5f19b84..5280da5c09 100644 --- a/digitransit-component/packages/digitransit-component-autosuggest-panel/package.json +++ b/digitransit-component/packages/digitransit-component-autosuggest-panel/package.json @@ -29,7 +29,7 @@ "license": "(AGPL-3.0 OR EUPL-1.2)", "peerDependencies": { "@digitransit-component/digitransit-component-autosuggest": "^6.0.4", - "@digitransit-component/digitransit-component-icon": "^1.2.0", + "@digitransit-component/digitransit-component-icon": "^2.0.0", "@hsl-fi/sass": "^0.2.0", "classnames": "2.5.1", "i18next": "^22.5.1", diff --git a/digitransit-component/packages/digitransit-component-autosuggest/package.json b/digitransit-component/packages/digitransit-component-autosuggest/package.json index 84efda3b07..0d8a39168c 100644 --- a/digitransit-component/packages/digitransit-component-autosuggest/package.json +++ b/digitransit-component/packages/digitransit-component-autosuggest/package.json @@ -36,7 +36,7 @@ }, "peerDependencies": { "@digitransit-component/digitransit-component-dialog-modal": "^2.0.0", - "@digitransit-component/digitransit-component-icon": "^1.2.0", + "@digitransit-component/digitransit-component-icon": "^2.0.0", "@digitransit-component/digitransit-component-suggestion-item": "^2.3.1", "@hsl-fi/sass": "^0.2.0", "classnames": "2.5.1", diff --git a/digitransit-component/packages/digitransit-component-control-panel/package.json b/digitransit-component/packages/digitransit-component-control-panel/package.json index ee5131b7f1..4e7966be55 100644 --- a/digitransit-component/packages/digitransit-component-control-panel/package.json +++ b/digitransit-component/packages/digitransit-component-control-panel/package.json @@ -29,7 +29,7 @@ "author": "Digitransit Authors", "license": "(AGPL-3.0 OR EUPL-1.2)", "peerDependencies": { - "@digitransit-component/digitransit-component-icon": "^1.2.0", + "@digitransit-component/digitransit-component-icon": "^2.0.0", "@hsl-fi/sass": "^0.2.0", "classnames": "2.5.1", "i18next": "^22.5.1", diff --git a/digitransit-component/packages/digitransit-component-datetimepicker/package.json b/digitransit-component/packages/digitransit-component-datetimepicker/package.json index a07bfd3af3..fdc86d1bb6 100644 --- a/digitransit-component/packages/digitransit-component-datetimepicker/package.json +++ b/digitransit-component/packages/digitransit-component-datetimepicker/package.json @@ -1,6 +1,6 @@ { "name": "@digitransit-component/digitransit-component-datetimepicker", - "version": "4.0.2", + "version": "5.0.0", "description": "digitransit-component datetimepicker module", "main": "index.js", "files": [ @@ -29,7 +29,7 @@ "author": "Digitransit Authors", "license": "(AGPL-3.0 OR EUPL-1.2)", "peerDependencies": { - "@digitransit-component/digitransit-component-icon": "^1.2.0", + "@digitransit-component/digitransit-component-icon": "^2.0.0", "classnames": "2.5.1", "i18next": "^22.5.1", "lodash": "4.17.21", diff --git a/digitransit-component/packages/digitransit-component-favourite-bar/package.json b/digitransit-component/packages/digitransit-component-favourite-bar/package.json index c0574f197c..1a8d961ba5 100644 --- a/digitransit-component/packages/digitransit-component-favourite-bar/package.json +++ b/digitransit-component/packages/digitransit-component-favourite-bar/package.json @@ -1,6 +1,6 @@ { "name": "@digitransit-component/digitransit-component-favourite-bar", - "version": "4.0.3", + "version": "5.0.0", "description": "digitransit-component favourite-bar module", "main": "index.js", "files": [ @@ -32,7 +32,7 @@ "@digitransit-search-util/digitransit-search-util-uniq-by-label": "^2.1.0" }, "peerDependencies": { - "@digitransit-component/digitransit-component-icon": "^1.2.0", + "@digitransit-component/digitransit-component-icon": "^2.0.0", "@digitransit-component/digitransit-component-suggestion-item": "^2.3.2", "@hsl-fi/sass": "^0.2.0", "@hsl-fi/shimmer": "0.1.2", diff --git a/digitransit-component/packages/digitransit-component-favourite-editing-modal/package.json b/digitransit-component/packages/digitransit-component-favourite-editing-modal/package.json index d8366dc0a8..def252b639 100644 --- a/digitransit-component/packages/digitransit-component-favourite-editing-modal/package.json +++ b/digitransit-component/packages/digitransit-component-favourite-editing-modal/package.json @@ -1,6 +1,6 @@ { "name": "@digitransit-component/digitransit-component-favourite-editing-modal", - "version": "4.0.1", + "version": "5.0.0", "description": "digitransit-component favourite-editing-modal module", "main": "index.js", "files": [ @@ -33,7 +33,7 @@ }, "peerDependencies": { "@digitransit-component/digitransit-component-dialog-modal": "^2.0.0", - "@digitransit-component/digitransit-component-icon": "^1.2.0", + "@digitransit-component/digitransit-component-icon": "^2.0.0", "@hsl-fi/container-spinner": "0.3.2", "@hsl-fi/modal": "^0.3.2", "@hsl-fi/sass": "^0.2.0", diff --git a/digitransit-component/packages/digitransit-component-favourite-modal/package.json b/digitransit-component/packages/digitransit-component-favourite-modal/package.json index 5b0f4fa7e6..be0c8240a3 100644 --- a/digitransit-component/packages/digitransit-component-favourite-modal/package.json +++ b/digitransit-component/packages/digitransit-component-favourite-modal/package.json @@ -1,6 +1,6 @@ { "name": "@digitransit-component/digitransit-component-favourite-modal", - "version": "3.0.1", + "version": "4.0.0", "description": "digitransit-component favourite-modal module", "main": "index.js", "files": [ @@ -29,7 +29,7 @@ "author": "Digitransit Authors", "license": "(AGPL-3.0 OR EUPL-1.2)", "peerDependencies": { - "@digitransit-component/digitransit-component-icon": "^1.2.0", + "@digitransit-component/digitransit-component-icon": "^2.0.0", "@hsl-fi/modal": "^0.3.2", "@hsl-fi/sass": "^0.2.0", "classnames": "2.5.1", diff --git a/digitransit-component/packages/digitransit-component-suggestion-item/package.json b/digitransit-component/packages/digitransit-component-suggestion-item/package.json index 56c42e8032..2cc4493bcd 100644 --- a/digitransit-component/packages/digitransit-component-suggestion-item/package.json +++ b/digitransit-component/packages/digitransit-component-suggestion-item/package.json @@ -1,6 +1,6 @@ { "name": "@digitransit-component/digitransit-component-suggestion-item", - "version": "2.3.2", + "version": "3.0.0", "description": "digitransit-component suggestion-item module", "main": "index.js", "files": [ @@ -29,7 +29,7 @@ "author": "Digitransit Authors", "license": "(AGPL-3.0 OR EUPL-1.2)", "peerDependencies": { - "@digitransit-component/digitransit-component-icon": "^1.2.0", + "@digitransit-component/digitransit-component-icon": "^2.0.0", "@hsl-fi/sass": " ^0.2.0", "classnames": "2.5.1", "prop-types": "^15.8.1", diff --git a/digitransit-component/packages/digitransit-component-traffic-now-link/package.json b/digitransit-component/packages/digitransit-component-traffic-now-link/package.json index a3a70d1237..d2bd1257de 100644 --- a/digitransit-component/packages/digitransit-component-traffic-now-link/package.json +++ b/digitransit-component/packages/digitransit-component-traffic-now-link/package.json @@ -1,6 +1,6 @@ { "name": "@digitransit-component/digitransit-component-traffic-now-link", - "version": "3.0.1", + "version": "4.0.0", "description": "digitransit-component traffic-now-link module", "main": "index.js", "files": [ @@ -29,7 +29,7 @@ "author": "Digitransit Authors", "license": "(AGPL-3.0 OR EUPL-1.2)", "peerDependencies": { - "@digitransit-component/digitransit-component-icon": "^1.2.0", + "@digitransit-component/digitransit-component-icon": "^2.0.0", "@hsl-fi/sass": "^0.2.0", "i18next": "^22.5.1", "prop-types": "^15.8.1", diff --git a/digitransit-component/packages/digitransit-component/package.json b/digitransit-component/packages/digitransit-component/package.json index 816f75c14d..f14c55770c 100644 --- a/digitransit-component/packages/digitransit-component/package.json +++ b/digitransit-component/packages/digitransit-component/package.json @@ -1,6 +1,6 @@ { "name": "@digitransit-component/digitransit-component", - "version": "4.0.2", + "version": "5.0.0", "description": "a JavaScript library for Digitransit", "main": "digitransit-component", "module": "digitransit-component.mjs", @@ -24,7 +24,7 @@ "@digitransit-component/digitransit-component-favourite-bar": "^4.0.3", "@digitransit-component/digitransit-component-favourite-editing-modal": "^4.0.1", "@digitransit-component/digitransit-component-favourite-modal": "^3.0.1", - "@digitransit-component/digitransit-component-icon": "^1.2.0", + "@digitransit-component/digitransit-component-icon": "^2.0.0", "@digitransit-component/digitransit-component-suggestion-item": "^2.3.2", "@digitransit-component/digitransit-component-with-breakpoint": "^1.0.0" }, From 77df3a2fb59939f7b351a63d61518abb943fc003 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Mon, 5 Jan 2026 18:53:52 +0200 Subject: [PATCH 093/129] fix: icon naming chaos --- .../src/assets/airplane.svg | 5 +- .../{bike-park-fill.svg => bikepark-fill.svg} | 0 .../assets/{bike-park.svg => bikepark.svg} | 0 ...on-digitransit.svg => bus-digitransit.svg} | 0 .../{bus-express.svg => bus-express-hsl.svg} | 0 ...s-default.svg => bus-express-stop-hsl.svg} | 0 ...{bus-fill.svg => bus-fill-digitransit.svg} | 0 .../src/assets/{mode_bus.svg => bus-hsl.svg} | 0 .../{bus-local.svg => bus-local-hsl.svg} | 0 ...eplacement.svg => bus-replacement-hsl.svg} | 0 ...gitransit.svg => bus-stop-digitransit.svg} | 0 ...-bus-stop-default.svg => bus-stop-hsl.svg} | 0 .../src/assets/bus.svg | 3 - ...ansit.svg => bustram-stop-digitransit.svg} | 0 .../{car-park-fill.svg => carpark-fill.svg} | 0 .../src/assets/{car-park.svg => carpark.svg} | 0 ..._citybike.svg => citybike-digitransit.svg} | 0 ...fill.svg => citybike-fill-digitransit.svg} | 0 .../{mode_citybike.svg => citybike-hsl.svg} | 0 ...ry.svg => citybike-stop-hsl-secondary.svg} | 0 ...stop-default.svg => citybike-stop-hsl.svg} | 0 .../src/assets/citybike.svg | 7 - ...-digitransit.svg => ferry-digitransit.svg} | 0 ...ry-fill.svg => ferry-fill-digitransit.svg} | 0 ...search-ferry-default.svg => ferry-hsl.svg} | 0 ...transit.svg => ferry-stop-digitransit.svg} | 0 ...ry-stop-default.svg => ferry-stop-hsl.svg} | 0 .../src/assets/ferry.svg | 3 - ..._digi_funicular.svg => funicular-stop.svg} | 0 .../src/assets/mode_airplane.svg | 4 - .../src/assets/mode_ferry.svg | 4 - ...n-digitransit.svg => rail-digitransit.svg} | 0 ...ail-fill.svg => rail-fill-digitransit.svg} | 0 .../assets/{mode_rail.svg => rail-hsl.svg} | 0 ...itransit.svg => rail-stop-digitransit.svg} | 0 ...ail-stop-default.svg => rail-stop-hsl.svg} | 1 - .../src/assets/rail.svg | 3 - .../assets/search-airplane-digitransit.svg | 4 - .../{speedtram.svg => speedtram-hsl.svg} | 0 ...top-default.svg => speedtram-stop-hsl.svg} | 0 ...ode_digi_tram.svg => tram-digitransit.svg} | 0 ...ram-fill.svg => tram-fill-digitransit.svg} | 0 .../assets/{mode_tram.svg => tram-hsl.svg} | 0 ...itransit.svg => tram-stop-digitransit.svg} | 0 ...ram-stop-default.svg => tram-stop-hsl.svg} | 0 .../src/assets/tram.svg | 3 - .../digitransit-component-icon/src/index.js | 199 ++++++++---------- 47 files changed, 93 insertions(+), 143 deletions(-) rename digitransit-component/packages/digitransit-component-icon/src/assets/{bike-park-fill.svg => bikepark-fill.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{bike-park.svg => bikepark.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{search-bus-station-digitransit.svg => bus-digitransit.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{bus-express.svg => bus-express-hsl.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{search-bus-stop-express-default.svg => bus-express-stop-hsl.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{bus-fill.svg => bus-fill-digitransit.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{mode_bus.svg => bus-hsl.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{bus-local.svg => bus-local-hsl.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{bus-replacement.svg => bus-replacement-hsl.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{search-bus-stop-digitransit.svg => bus-stop-digitransit.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{search-bus-stop-default.svg => bus-stop-hsl.svg} (100%) delete mode 100644 digitransit-component/packages/digitransit-component-icon/src/assets/bus.svg rename digitransit-component/packages/digitransit-component-icon/src/assets/{search-bustram-stop-digitransit.svg => bustram-stop-digitransit.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{car-park-fill.svg => carpark-fill.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{car-park.svg => carpark.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{mode_digi_citybike.svg => citybike-digitransit.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{citybike-fill.svg => citybike-fill-digitransit.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{mode_citybike.svg => citybike-hsl.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{citybike-stop-default-secondary.svg => citybike-stop-hsl-secondary.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{citybike-stop-default.svg => citybike-stop-hsl.svg} (100%) delete mode 100644 digitransit-component/packages/digitransit-component-icon/src/assets/citybike.svg rename digitransit-component/packages/digitransit-component-icon/src/assets/{search-ferry-digitransit.svg => ferry-digitransit.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{ferry-fill.svg => ferry-fill-digitransit.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{search-ferry-default.svg => ferry-hsl.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{search-ferry-stop-digitransit.svg => ferry-stop-digitransit.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{search-ferry-stop-default.svg => ferry-stop-hsl.svg} (100%) delete mode 100644 digitransit-component/packages/digitransit-component-icon/src/assets/ferry.svg rename digitransit-component/packages/digitransit-component-icon/src/assets/{mode_digi_funicular.svg => funicular-stop.svg} (100%) delete mode 100644 digitransit-component/packages/digitransit-component-icon/src/assets/mode_airplane.svg delete mode 100644 digitransit-component/packages/digitransit-component-icon/src/assets/mode_ferry.svg rename digitransit-component/packages/digitransit-component-icon/src/assets/{search-rail-station-digitransit.svg => rail-digitransit.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{rail-fill.svg => rail-fill-digitransit.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{mode_rail.svg => rail-hsl.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{search-rail-stop-digitransit.svg => rail-stop-digitransit.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{search-rail-stop-default.svg => rail-stop-hsl.svg} (89%) delete mode 100644 digitransit-component/packages/digitransit-component-icon/src/assets/rail.svg delete mode 100644 digitransit-component/packages/digitransit-component-icon/src/assets/search-airplane-digitransit.svg rename digitransit-component/packages/digitransit-component-icon/src/assets/{speedtram.svg => speedtram-hsl.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{search-speedtram-stop-default.svg => speedtram-stop-hsl.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{mode_digi_tram.svg => tram-digitransit.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{tram-fill.svg => tram-fill-digitransit.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{mode_tram.svg => tram-hsl.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{search-tram-stop-digitransit.svg => tram-stop-digitransit.svg} (100%) rename digitransit-component/packages/digitransit-component-icon/src/assets/{search-tram-stop-default.svg => tram-stop-hsl.svg} (100%) delete mode 100644 digitransit-component/packages/digitransit-component-icon/src/assets/tram.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/airplane.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/airplane.svg index a7075ad7a6..4d61c5b3be 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/airplane.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/airplane.svg @@ -1,3 +1,4 @@ - - + + + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bike-park-fill.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bikepark-fill.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/bike-park-fill.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/bikepark-fill.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bike-park.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bikepark.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/bike-park.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/bikepark.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-bus-station-digitransit.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-digitransit.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/search-bus-station-digitransit.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/bus-digitransit.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bus-express.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-express-hsl.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/bus-express.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/bus-express-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-bus-stop-express-default.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-express-stop-hsl.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/search-bus-stop-express-default.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/bus-express-stop-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bus-fill.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-fill-digitransit.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/bus-fill.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/bus-fill-digitransit.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/mode_bus.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-hsl.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/mode_bus.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/bus-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bus-local.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-local-hsl.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/bus-local.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/bus-local-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bus-replacement.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-replacement-hsl.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/bus-replacement.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/bus-replacement-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-bus-stop-digitransit.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-stop-digitransit.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/search-bus-stop-digitransit.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/bus-stop-digitransit.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-bus-stop-default.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-stop-hsl.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/search-bus-stop-default.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/bus-stop-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bus.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus.svg deleted file mode 100644 index 1fd5e8b159..0000000000 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/bus.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-bustram-stop-digitransit.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bustram-stop-digitransit.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/search-bustram-stop-digitransit.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/bustram-stop-digitransit.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/car-park-fill.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/carpark-fill.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/car-park-fill.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/carpark-fill.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/car-park.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/carpark.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/car-park.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/carpark.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/mode_digi_citybike.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/citybike-digitransit.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/mode_digi_citybike.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/citybike-digitransit.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/citybike-fill.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/citybike-fill-digitransit.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/citybike-fill.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/citybike-fill-digitransit.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/mode_citybike.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/citybike-hsl.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/mode_citybike.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/citybike-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/citybike-stop-default-secondary.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/citybike-stop-hsl-secondary.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/citybike-stop-default-secondary.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/citybike-stop-hsl-secondary.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/citybike-stop-default.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/citybike-stop-hsl.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/citybike-stop-default.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/citybike-stop-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/citybike.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/citybike.svg deleted file mode 100644 index 86e4c8c9b1..0000000000 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/citybike.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-ferry-digitransit.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-digitransit.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/search-ferry-digitransit.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/ferry-digitransit.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-fill.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-fill-digitransit.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/ferry-fill.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/ferry-fill-digitransit.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-ferry-default.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-hsl.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/search-ferry-default.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/ferry-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-ferry-stop-digitransit.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-stop-digitransit.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/search-ferry-stop-digitransit.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/ferry-stop-digitransit.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-ferry-stop-default.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-stop-hsl.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/search-ferry-stop-default.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/ferry-stop-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/ferry.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/ferry.svg deleted file mode 100644 index 51cbd9b836..0000000000 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/ferry.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/mode_digi_funicular.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/funicular-stop.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/mode_digi_funicular.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/funicular-stop.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/mode_airplane.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/mode_airplane.svg deleted file mode 100644 index 7efda18b98..0000000000 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/mode_airplane.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/mode_ferry.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/mode_ferry.svg deleted file mode 100644 index 8615ee5ce8..0000000000 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/mode_ferry.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-rail-station-digitransit.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/rail-digitransit.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/search-rail-station-digitransit.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/rail-digitransit.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/rail-fill.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/rail-fill-digitransit.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/rail-fill.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/rail-fill-digitransit.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/mode_rail.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/rail-hsl.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/mode_rail.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/rail-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-rail-stop-digitransit.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/rail-stop-digitransit.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/search-rail-stop-digitransit.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/rail-stop-digitransit.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-rail-stop-default.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/rail-stop-hsl.svg similarity index 89% rename from digitransit-component/packages/digitransit-component-icon/src/assets/search-rail-stop-default.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/rail-stop-hsl.svg index 45d54a44cb..f6e6fa1ce0 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/search-rail-stop-default.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/rail-stop-hsl.svg @@ -1,6 +1,5 @@ - diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/rail.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/rail.svg deleted file mode 100644 index 870f5248c2..0000000000 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/rail.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-airplane-digitransit.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/search-airplane-digitransit.svg deleted file mode 100644 index 4d61c5b3be..0000000000 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/search-airplane-digitransit.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/speedtram.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/speedtram-hsl.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/speedtram.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/speedtram-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-speedtram-stop-default.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/speedtram-stop-hsl.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/search-speedtram-stop-default.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/speedtram-stop-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/mode_digi_tram.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/tram-digitransit.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/mode_digi_tram.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/tram-digitransit.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/tram-fill.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/tram-fill-digitransit.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/tram-fill.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/tram-fill-digitransit.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/mode_tram.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/tram-hsl.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/mode_tram.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/tram-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-tram-stop-digitransit.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/tram-stop-digitransit.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/search-tram-stop-digitransit.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/tram-stop-digitransit.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-tram-stop-default.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/tram-stop-hsl.svg similarity index 100% rename from digitransit-component/packages/digitransit-component-icon/src/assets/search-tram-stop-default.svg rename to digitransit-component/packages/digitransit-component-icon/src/assets/tram-stop-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/tram.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/tram.svg deleted file mode 100644 index a839b82280..0000000000 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/tram.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/index.js b/digitransit-component/packages/digitransit-component-icon/src/index.js index 777cf8d071..dcd83ca9dd 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/index.js +++ b/digitransit-component/packages/digitransit-component-icon/src/index.js @@ -1,23 +1,17 @@ import PropTypes from 'prop-types'; import React from 'react'; -import Airplane from './assets/airplane.svg'; import Arrow from './assets/arrow.svg'; -import Bus from './assets/bus.svg'; -import Busstop from './assets/bus_stop.svg'; +import Check from './assets/check.svg'; import City from './assets/city.svg'; import Edit from './assets/edit.svg'; -import Ferry from './assets/ferry.svg'; import Home from './assets/home.svg'; import Locate from './assets/locate.svg'; import Place from './assets/place.svg'; -import Rail from './assets/rail.svg'; import School from './assets/school.svg'; import Shopping from './assets/shopping.svg'; import Sport from './assets/sport.svg'; import Star from './assets/star.svg'; import Station from './assets/station.svg'; -import Subway from './assets/subway.svg'; -import Tram from './assets/tram.svg'; import Work from './assets/work.svg'; import Map from './assets/map.svg'; import Close from './assets/close.svg'; @@ -27,10 +21,8 @@ import Search from './assets/search.svg'; import Plus from './assets/plus.svg'; import Attention from './assets/attention.svg'; import Dropdown from './assets/dropdown.svg'; -import CarPark from './assets/car-park.svg'; -import CarParkFill from './assets/car-park-fill.svg'; -import BikeParkFill from './assets/bike-park-fill.svg'; -import BikePark from './assets/bike-park.svg'; +import CarPark from './assets/carpark.svg'; +import BikePark from './assets/bikepark.svg'; import Time from './assets/time.svg'; import Ellipsis from './assets/ellipsis.svg'; import Opposite from './assets/opposite.svg'; @@ -39,77 +31,70 @@ import Calendar from './assets/calendar.svg'; import SelectFromMap from './assets/select-from-map.svg'; import CautionWhite from './assets/caution_white_exclamation.svg'; import Trash from './assets/trash.svg'; -import ModeBus from './assets/mode_bus.svg'; -import ModeBusExpress from './assets/bus-express.svg'; -import ModeBusReplacement from './assets/bus-replacement.svg'; -import ModeSpeedTram from './assets/speedtram.svg'; -import ModeBusLocal from './assets/bus-local.svg'; -import ModeRail from './assets/mode_rail.svg'; -import ModeTram from './assets/mode_tram.svg'; -import ModeFerry from './assets/mode_ferry.svg'; -import ModeBikeRentalStation from './assets/mode_citybike.svg'; -import ModeAirplane from './assets/mode_airplane.svg'; -import ModeDigiTram from './assets/mode_digi_tram.svg'; -import ModeDigiBikeRentalStation from './assets/mode_digi_citybike.svg'; -import ModeDigiFunicular from './assets/mode_digi_funicular.svg'; import FutureRoute from './assets/icon-route.svg'; import Position from './assets/position.svg'; import SearchStreetName from './assets/search-streetname.svg'; -import BusFill from './assets/bus-fill.svg'; -import FerryFill from './assets/ferry-fill.svg'; -import BikeRentalStationFill from './assets/citybike-fill.svg'; -import RailFill from './assets/rail-fill.svg'; -import TramFill from './assets/tram-fill.svg'; -import Check from './assets/check.svg'; -import SearchBusStopDefault from './assets/search-bus-stop-default.svg'; -import SearchBusStopExpressDefault from './assets/search-bus-stop-express-default.svg'; -import SearchSpeedTramStopDefault from './assets/search-speedtram-stop-default.svg'; -import SearchRailStopDefault from './assets/search-rail-stop-default.svg'; -import SearchFerryDefault from './assets/search-ferry-default.svg'; -import SearchFerryStopDefault from './assets/search-ferry-stop-default.svg'; -import CityBikeRentalStationDefault from './assets/citybike-stop-default.svg'; -import CityBikeRentalStationDefaultSecondary from './assets/citybike-stop-default-secondary.svg'; -import SearchTramStopDefault from './assets/search-tram-stop-default.svg'; -import CityBikeRentalStationDigitransit from './assets/citybike-stop-digitransit.svg'; -import CityBikeRentalStationDigitransitSecondary from './assets/citybike-stop-digitransit-secondary.svg'; -import SearchAirplaneDigitransit from './assets/search-airplane-digitransit.svg'; -import SearchBusStationDigitransit from './assets/search-bus-station-digitransit.svg'; -import SearchBusStopDigitransit from './assets/search-bus-stop-digitransit.svg'; -import SearchBusTramStopDigitransit from './assets/search-bustram-stop-digitransit.svg'; -import SearchFerryDigitransit from './assets/search-ferry-digitransit.svg'; -import SearchFerryStopDigitransit from './assets/search-ferry-stop-digitransit.svg'; -import SearchRailStopDigitransit from './assets/search-rail-stop-digitransit.svg'; -import SearchRailStationDigitransit from './assets/search-rail-station-digitransit.svg'; -import SearchTramStopDigitransit from './assets/search-tram-stop-digitransit.svg'; +import Airplane from './assets/airplane.svg'; +import Subway from './assets/subway.svg'; import Funicular from './assets/funicular.svg'; +import FunicularStop from './assets/funicular-stop.svg'; +import BusHsl from './assets/bus-hsl.svg'; +import BusExpressHsl from './assets/bus-express-hsl.svg'; +import BusReplacementHsl from './assets/bus-replacement-hsl.svg'; +import SpeedTramHsl from './assets/speedtram-hsl.svg'; +import BusLocalHsl from './assets/bus-local-hsl.svg'; +import RailHsl from './assets/rail-hsl.svg'; +import TramHsl from './assets/tram-hsl.svg'; +import CityBikeHsl from './assets/citybike-hsl.svg'; +import FerryHsl from './assets/ferry-hsl.svg'; +import BusStopHsl from './assets/bus-stop-hsl.svg'; +import BusStopExpressHsl from './assets/bus-express-stop-hsl.svg'; +import SpeedTramStopHsl from './assets/speedtram-stop-hsl.svg'; +import RailStopHsl from './assets/rail-stop-hsl.svg'; +import FerryStopHsl from './assets/ferry-stop-hsl.svg'; +import CityBikeStopHsl from './assets/citybike-stop-hsl.svg'; +import CityBikeStopHslSecondary from './assets/citybike-stop-hsl-secondary.svg'; +import TramStopHsl from './assets/tram-stop-hsl.svg'; +import CityBikeDigitransit from './assets/citybike-digitransit.svg'; +import BusDigitransit from './assets/bus-digitransit.svg'; +import FerryDigitransit from './assets/ferry-digitransit.svg'; +import RailDigitransit from './assets/rail-digitransit.svg'; +import TramDigitransit from './assets/tram-digitransit.svg'; +import BusStopDigitransit from './assets/bus-stop-digitransit.svg'; +import CityBikeStopDigitransit from './assets/citybike-stop-digitransit.svg'; +import CityBikeStopDigitransitSecondary from './assets/citybike-stop-digitransit-secondary.svg'; +import FerryStopDigitransit from './assets/ferry-stop-digitransit.svg'; +import RailStopDigitransit from './assets/rail-stop-digitransit.svg'; +import TramStopDigitransit from './assets/tram-stop-digitransit.svg'; +import BusTramStopDigitransit from './assets/bustram-stop-digitransit.svg'; +import BusFillDigitransit from './assets/bus-fill-digitransit.svg'; +import CityBikeFillDigitransit from './assets/citybike-fill-digitransit.svg'; +import FerryFillDigitransit from './assets/ferry-fill-digitransit.svg'; +import RailFillDigitransit from './assets/rail-fill-digitransit.svg'; +import TramFillDigitransit from './assets/tram-fill-digitransit.svg'; +import CarParkFill from './assets/carpark-fill.svg'; +import BikeParkFill from './assets/bikepark-fill.svg'; const iconMap = { - airplane: Airplane, arrow: Arrow, - bus: Bus, - busstop: Busstop, caution: CautionWhite, city: City, - citybike: CityBikeRentalStationDefault, + citybike: CityBikeHsl, edit: Edit, - ferry: Ferry, home: Home, locate: Locate, map: Map, place: Place, - rail: Rail, school: School, shopping: Shopping, sport: Sport, star: Star, station: Station, - subway: Subway, - tram: Tram, work: Work, close: Close, 'mapMarker-via': MapmarkerVia, - 'bike-park': BikePark, - 'car-park': CarPark, + bikepark: BikePark, + carpark: CarPark, mapMarker: Mapmarker, search: Search, plus: Plus, @@ -123,58 +108,54 @@ const iconMap = { 'select-from-map': SelectFromMap, 'caution-white': CautionWhite, trash: Trash, - 'mode-bus': ModeBus, - 'mode-bus-express': ModeBusExpress, - 'mode-bus-local': ModeBusLocal, - 'mode-bus-replacement': ModeBusReplacement, - 'mode-speedtram': ModeSpeedTram, - 'mode-rail': ModeRail, - 'mode-tram': ModeTram, - 'mode-subway': Subway, - 'mode-ferry': ModeFerry, - 'mode-citybike': ModeBikeRentalStation, - 'mode-digitransit-bus': SearchBusStationDigitransit, - 'mode-digitransit-rail': SearchRailStationDigitransit, - 'mode-digitransit-ferry': SearchFerryDigitransit, - 'mode-digitransit-tram': ModeDigiTram, - 'mode-digitransit-citybike': ModeDigiBikeRentalStation, - 'mode-digitransit-airplane': ModeAirplane, - 'mode-digitransit-subway': Subway, - 'mode-digitransit-funicular': ModeDigiFunicular, - 'bus-fill': BusFill, - 'citybike-fill': BikeRentalStationFill, - 'ferry-fill': FerryFill, - 'rail-fill': RailFill, - 'tram-fill': TramFill, - 'bike-park-fill': BikeParkFill, - 'car-park-fill': CarParkFill, - 'future-route': FutureRoute, position: Position, 'search-street-name': SearchStreetName, + 'future-route': FutureRoute, check: Check, - 'search-bus-stop-default': SearchBusStopDefault, - 'search-bus-stop-express-default': SearchBusStopExpressDefault, - 'search-speedtram-stop-default': SearchSpeedTramStopDefault, - 'search-rail-stop-default': SearchRailStopDefault, - 'search-ferry-default': SearchFerryDefault, - 'search-ferry-stop-default': SearchFerryStopDefault, - 'search-tram-stop-default': SearchTramStopDefault, - 'citybike-stop-digitransit': CityBikeRentalStationDigitransit, - 'citybike-stop-digitransit-secondary': - CityBikeRentalStationDigitransitSecondary, - 'citybike-stop-default': CityBikeRentalStationDefault, - 'citybike-stop-default-secondary': CityBikeRentalStationDefaultSecondary, - 'search-airplane-digitransit': SearchAirplaneDigitransit, - 'search-bus-station-digitransit': SearchBusStationDigitransit, - 'search-bus-stop-digitransit': SearchBusStopDigitransit, - 'search-bustram-stop-digitransit': SearchBusTramStopDigitransit, - 'search-ferry-digitransit': SearchFerryDigitransit, - 'search-ferry-stop-digitransit': SearchFerryStopDigitransit, - 'search-funicular-stop-digitransit': ModeDigiFunicular, - 'search-rail-stop-digitransit': SearchRailStopDigitransit, - 'search-rail-station-digitransit': SearchRailStationDigitransit, - 'search-tram-stop-digitransit': SearchTramStopDigitransit, + // shared transport modes + airplane: Airplane, + subway: Subway, funicular: Funicular, + 'funicular-stop': FunicularStop, + // HSL + 'bus-hsl': BusHsl, + 'bus-express-hsl': BusExpressHsl, + 'bus-local-hsl': BusLocalHsl, + 'bus-replacement-hsl': BusReplacementHsl, + 'ferry-hsl': FerryHsl, + 'rail-hsl': RailHsl, + 'speedtram-hsl': SpeedTramHsl, + 'tram-hsl': TramHsl, + 'citybike-hsl': CityBikeHsl, + 'bus-stop-hsl': BusStopHsl, + 'bus-stop-express-hsl': BusStopExpressHsl, + 'speedtram-stop-hsl': SpeedTramStopHsl, + 'rail-stop-hsl': RailStopHsl, + 'ferry-stop-hsl': FerryStopHsl, + 'tram-stop-hsl': TramStopHsl, + 'citybike-stop-hsl': CityBikeStopHsl, + 'citybike-stop-hsl-secondary': CityBikeStopHslSecondary, + // digitransit + 'bus-digitransit': BusDigitransit, + 'ferry-digitransit': FerryDigitransit, + 'rail-digitransit': RailDigitransit, + 'tram-digitransit': TramDigitransit, + 'citybike-digitransit': CityBikeDigitransit, + 'citybike-stop-digitransit': CityBikeStopDigitransit, + 'citybike-stop-digitransit-secondary': CityBikeStopDigitransitSecondary, + 'bus-stop-digitransit': BusStopDigitransit, + 'bustram-stop-digitransit': BusTramStopDigitransit, + 'ferry-stop-digitransit': FerryStopDigitransit, + 'rail-stop-digitransit': RailStopDigitransit, + 'tram-stop-digitransit': TramStopDigitransit, + 'bus-fill-digitransit': BusFillDigitransit, + 'citybike-fill-digitransit': CityBikeFillDigitransit, + 'ferry-fill-digitransit': FerryFillDigitransit, + 'rail-fill-digitransit': RailFillDigitransit, + 'tram-fill-digitransit': TramFillDigitransit, + // no theme binding + 'bikepark-fill': BikeParkFill, + 'carpark-fill': CarParkFill, }; /** @@ -201,7 +182,7 @@ const Icon = ({ color, img, height, width, rotate }) => { ? 'position' : img; - const Component = iconMap[iconName] || SearchBusStopDigitransit; + const Component = iconMap[iconName] || BusStopDigitransit; return ; }; From 332f8f6c0f72f196b0348a362c9deb7d8f3bacdd Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 6 Jan 2026 09:57:01 +0200 Subject: [PATCH 094/129] feat: use new icon names in suggestion item --- .../src/index.js | 134 +++++++++--------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js index 076aa66315..ae08db611b 100644 --- a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js +++ b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js @@ -30,7 +30,7 @@ const iconColors = { const getRouteMode = (props, set) => { let eMode; - if (set === 'default') { + if (set === 'hsl') { eMode = extendedModes[props.type]; } return eMode || props.mode?.toLowerCase() || 'bus'; @@ -54,42 +54,43 @@ const iconProps = { ownLocations: ['star'], back: ['arrow'], futureRoute: ['future-route'], - 'BUS-default': ['search-bus-stop-default', 'mode-bus'], - 'BUS-EXPRESS-default': [ - 'search-bus-stop-express-default', - 'mode-bus-express', - ], - 'SPEEDTRAM-default': ['search-speedtram-stop-default', 'mode-speedtram'], - 'BUS-digitransit': ['search-bus-stop-digitransit', 'mode-bus'], - 'BUS-STATION-default': ['mode-bus', 'mode-bus'], - 'BUS-STATION-digitransit': ['search-bus-station-digitransit', 'mode-bus'], - 'FUNICULAR-digitransit': [ - 'search-funicular-stop-digitransit', - 'mode-funicular', - ], - 'RAIL-default': ['search-rail-stop-default', 'mode-rail'], - 'RAIL-digitransit': ['search-rail-stop-digitransit', 'mode-rail'], - 'RAIL-STATION-default': ['mode-rail', 'mode-rail'], - 'RAIL-STATION-digitransit': ['search-rail-station-digitransit', 'mode-rail'], - 'TRAM-default': ['search-tram-stop-default', 'mode-tram'], - 'TRAM-digitransit': ['search-tram-stop-digitransit', 'mode-tram'], - 'SUBWAY-default': ['subway', 'mode-subway'], - 'SUBWAY-digitransit': ['subway', 'mode-subway'], - 'SUBWAY-STATION-default': ['subway', 'mode-subway'], - 'SUBWAY-STATION-digitransit': ['subway', 'mode-subway'], - 'SPEEDTRAM-STATION-default': ['mode-speedtram', 'mode-speedtram'], - 'TRAM-STATION-default': ['mode-tram', 'mode-tram'], - 'TRAM-STATION-digitransit': ['mode-tram', 'mode-tram'], - 'SPEEDTRAM-STATION-digitransit': ['mode-tram', 'mode-tram'], - 'FERRY-STATION-default': ['search-ferry-default', 'mode-ferry'], - 'FERRY-STATION-digitransit': ['search-ferry-digitransit', 'mode-ferry'], - 'FERRY-default': ['search-ferry-stop-default', 'mode-ferry-external'], - 'FERRY-digitransit': ['search-ferry-stop-digitransit', 'mode-ferry-external'], - 'AIRPLANE-digitransit': ['search-airplane-digitransit', 'mode-airplane'], - 'BUS-TRAM-STATION-digitransit': [ - 'search-bustram-stop-digitransit', - 'mode-tram', - ], + + 'BUS-hsl': ['bus-hsl', 'mode-bus'], + 'BUS-stop-hsl': ['bus-stop-hsl', 'mode-bus'], + 'BUS-digitransit': ['bus-digitransit', 'mode-bus'], + 'BUS-stop-digitransit': ['bus-stop-digitransit', 'mode-bus'], + + 'BUS-EXPRESS-hsl': ['bus-stop-express-hsl', 'mode-bus-express'], + 'BUS-EXPRESS-stop-hsl': ['bus-express-stop-hsl', 'mode-bus-express'], + 'BUS-EXPRESS-digitransit': ['bus-digitransit', 'mode-bus'], + 'BUS-EXPRESS-stop-digitransit': ['bus-stop-digitransit', 'mode-bus'], + + 'SPEEDTRAM-hsl': ['speedtram-hsl', 'mode-speedtram'], + 'SPEEDTRAM-digitransit': ['mode-tram', 'mode-tram'], + 'SPEEDTRAM-stop-hsl': ['speedtram-stop-hsl', 'mode-speedtram'], + 'SPEEDTRAM-stop-digitransit': ['tram-stop', 'mode-tram'], + + 'RAIL-hsl': ['rail-hsl', 'mode-rail'], + 'RAIL-stop-hsl': ['rail-stop-hsl', 'mode-rail'], + 'RAIL-digitransit': ['rail-digitransit', 'mode-rail'], + 'RAIL-stop-digitransit': ['rail-stop-digitransit', 'mode-rail'], + + 'TRAM-hsl': ['tram-hsl', 'mode-tram'], + 'TRAM-stop-hsl': ['tram-stop-hsl', 'mode-tram'], + 'TRAM-digitransit': ['tram-digitransit', 'mode-tram'], + 'TRAM-stop-digitransit': ['tram-stop-digitransit', 'mode-tram'], + + 'FERRY-hsl': ['ferry-hsl', 'mode-ferry'], + 'FERRY-stop-hsl': ['ferry-stop-hsl', 'mode-ferry-external'], + 'FERRY-digitransit': ['ferry-digitransit', 'mode-ferry'], + 'FERRY-stop-digitransit': ['ferry-stop-digitransit', 'mode-ferry-external'], + + 'BUS-TRAM-stop-digitransit': ['bustram-stop-digitransit', 'mode-tram'], + + SUBWAY: ['subway', 'mode-subway'], + AIRPLANE: ['airplane', 'mode-airplane'], + FUNICULAR: ['funicular', 'mode-funicular'], + 'FUNICULAR-stop': ['funicular-stop', 'mode-funicular'], }; function isFavourite(item) { @@ -104,6 +105,7 @@ function getAriaDescription(ariaContentArray) { } const stopLayers = ['station', 'stop']; +const noTheme = ['subway', 'airplane', 'funicular']; // common icon in all themes function getIconProperties(item, modeSet, stopCode, modes) { let iconId; @@ -118,9 +120,9 @@ function getIconProperties(item, modeSet, stopCode, modes) { (item.type === 'OldSearch' && item.properties?.mode) ) { const mode = getRouteMode(item.properties, modeSet); - return modeSet === 'default' - ? [`mode-${mode}`, `mode-${mode}`] - : [`mode-${modeSet}-${mode}`, `mode-${mode}`]; + return noTheme.includes(mode) + ? [`${mode}`, `mode-${mode}`] // same for all themes + : [`${mode}-${modeSet}`, `mode-${mode}`]; } if (item.selectedIconId) { iconId = item.selectedIconId; @@ -129,10 +131,10 @@ function getIconProperties(item, modeSet, stopCode, modes) { return [`citybike-stop-${modeSet}`, 'mode-citybike']; } if (item.properties.layer === 'carpark') { - return [`car-park`]; + return [`carpark`]; } if (item.properties.layer === 'bikepark') { - return [`bike-park`]; + return [`bikepark`]; } if ( item.properties.label?.split(',').length === 1 && @@ -145,23 +147,23 @@ function getIconProperties(item, modeSet, stopCode, modes) { } // Use more accurate icons in stop/station search, depending on mode from geocoding if (modes?.length) { - const mode = modes[0]; - if (item.properties.layer === 'station' || (mode === 'FERRY' && stopCode)) { - if (modes.includes('SPEEDTRAM') && modeSet === 'default') { - return iconProps['SPEEDTRAM-STATION-default']; - } - return iconProps[`${mode}-STATION-${modeSet}`]; - } - if (modes.includes('BUS-EXPRESS') && modeSet === 'default') { - return iconProps[`BUS-EXPRESS-${modeSet}`]; - } + // select dominating mode + let mode = modes[0]; if (modes.includes('SPEEDTRAM')) { - return modeSet === 'default' - ? iconProps['SPEEDTRAM-default'] - : iconProps['TRAM-digitransit']; + mode = 'SPEEDTRAM'; + } else if (modes.includes('BUS-EXPRESS')) { + mode = 'BUS-EXPRESS'; } - const props = iconProps[`${mode}-${modeSet}`]; - return props || ['busstop', 'mode-bus']; + // select stop lollipop or mode/station icon + const stopDesc = + item.properties.layer === 'station' || (mode === 'FERRY' && stopCode) + ? '' + : '-stop'; + // is the icon theme specific + const themePostfix = noTheme.includes(mode) ? '' : `-${modeSet}`; + + const props = iconProps[`${mode}${stopDesc}${themePostfix}`]; + return props || ['bus-stop-digitransit', 'mode-bus']; } return iconProps[iconId] || ['place']; } @@ -203,7 +205,7 @@ const SuggestionItem = memo( fontWeights, modeIconColors, getAutoSuggestIcons, - modeSet = 'default', + modeSet, }) => { const [suggestionType, name, label, stopCode, modes, platform] = content || ['', item.name, item.address]; @@ -214,7 +216,7 @@ const SuggestionItem = memo( item.properties?.layer && getAutoSuggestIcons?.[item.properties?.layer] ) { - [iconId, iconColor] = getAutoSuggestIcons[item.properties?.layer](item); + [iconId, iconColor] = getAutoSuggestIcons[item.properties.layer](item); } else { let colorId; [iconId, colorId] = getIconProperties(item, modeSet, stopCode, modes); @@ -504,16 +506,14 @@ SuggestionItem.defaultProps = { modeIconColors: undefined, getAutoSuggestIcons: { citybikes: station => { - if (station.properties.source === 'citybikessmoove') { - return ['citybike-stop-default', '#f2b62d']; - } - if (station.properties.source === 'citybikesvantaa') { - return ['citybike-stop-default-secondary', '#f2b62d']; - } - return ['citybike-stop-default', '#f2b62d']; + const name = + station.properties.source === 'citybikesvantaa' + ? 'citybike-stop-hsl-secondary' + : 'citybike-stop-hsl'; + return [name, iconColors['mode-citybike']]; }, }, - modeSet: undefined, + modeSet: 'hsl', }; export default SuggestionItem; From e0c378861cc4e3535f2451345c4e617110fe1654 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 6 Jan 2026 09:57:32 +0200 Subject: [PATCH 095/129] chore: remove unused icon --- .../digitransit-component-icon/src/assets/bus_stop.svg | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 digitransit-component/packages/digitransit-component-icon/src/assets/bus_stop.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bus_stop.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus_stop.svg deleted file mode 100644 index 14fe00cdfd..0000000000 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/bus_stop.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - From 37a85d4e90ad1e729339d17179c7ed1f1fb57cae Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 6 Jan 2026 09:57:57 +0200 Subject: [PATCH 096/129] fix: translation ids --- .../src/helpers/translations.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js b/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js index 54c0559057..ec56bca811 100644 --- a/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js +++ b/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js @@ -22,8 +22,8 @@ const translations = { rail: 'Trains and nearby stations on map', subway: 'Metro and nearby stations on map', tram: 'Trams and nearby stops on map', - 'bike-park': 'The closest bike parks', - 'car-park': 'The closest car parks', + bikepark: 'The closest bike parks', + carpark: 'The closest car parks', title: 'Near you', }, }, @@ -37,8 +37,8 @@ const translations = { rail: 'Junat ja lähiasemat kartalla', subway: 'Metrot ja lähiasemat kartalla', tram: 'Raitiovaunut ja lähipysäkit kartalla', - 'bike-park': 'Lähimmät pyöräparkit', - 'car-park': 'Lähimmät autoparkit', + bikepark: 'Lähimmät pyöräparkit', + carpark: 'Lähimmät autoparkit', title: 'Lähelläsi', }, }, @@ -65,8 +65,8 @@ const translations = { rail: 'Tåg och stationer på kartan', subway: 'Metro och stationer på kartan', tram: 'Spårvagnar och hållplatser på kartan', - 'bike-park': 'Närmaste cykelparkering', - 'car-park': 'Närmaste bilparkering', + bikepark: 'Närmaste cykelparkering', + carpark: 'Närmaste bilparkering', title: 'Nära dig', }, }, From b51f563df02097b03a55feee9beea0db8fbf1ed6 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 6 Jan 2026 09:59:24 +0200 Subject: [PATCH 097/129] feat: use new icon names in control panel --- .../src/index.js | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/digitransit-component/packages/digitransit-component-control-panel/src/index.js b/digitransit-component/packages/digitransit-component-control-panel/src/index.js index 517a46f783..1c0cbaa99e 100644 --- a/digitransit-component/packages/digitransit-component-control-panel/src/index.js +++ b/digitransit-component/packages/digitransit-component-control-panel/src/index.js @@ -64,7 +64,6 @@ SeparatorLine.defaultProps = { * modeArray={['bus', 'tram', 'subway', 'rail', 'ferry', 'citybike']} * language="fi" * urlPrefix="http://example.com/lahellasi" - * showTitle * alertsContext={alertsContext} * /> * @@ -83,15 +82,12 @@ const validNearYouModes = [ 'carpark', ]; -function getIconName(mode, modeSet) { - switch (mode) { - case 'bikepark': - return 'bike-park'; - case 'carpark': - return 'car-park'; - default: - return modeSet === 'default' ? `mode-${mode}` : `mode-${modeSet}-${mode}`; - } +const noTheme = ['bikepark', 'carpark', 'subway', 'airplane']; // common icon in all themes + +function getIconName(mode, modeSet, horizontal) { + const theme = noTheme.includes[mode] ? '' : `-${modeSet}`; + const fill = horizontal ? '' : '-fill'; // do not render boxed icon for vertical + return `${mode}${fill}${theme}`; } function NearStopsAndRoutes({ @@ -150,7 +146,11 @@ function NearStopsAndRoutes({ {withAlert && ( @@ -170,7 +170,7 @@ function NearStopsAndRoutes({ '--borderRadius': buttonStyle.borderRadius, }} > - + {withAlert && ( @@ -280,7 +280,7 @@ NearStopsAndRoutes.defaultProps = { 'mode-ferry': '#007A97', 'mode-citybike': '#F2B62D', }, - modeSet: 'default', + modeSet: 'hsl', fontWeights: { medium: 500, }, @@ -296,7 +296,6 @@ NearStopsAndRoutes.defaultProps = { * modearray={['bus', 'tram', 'subway', 'rail', 'ferry', 'citybike']} * language="fi" * urlPrefix="http://example.com/lahellasi" - * showTitle * /> * */ From 5c7a2c43c560742c44f4e18ab11e584314658198 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 6 Jan 2026 10:08:45 +0200 Subject: [PATCH 098/129] fix: do not use fake 'waltti' modeset --- app/component/IndexPage.js | 4 ++-- app/configurations/config.hsl.js | 2 +- app/configurations/config.waltti.js | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/component/IndexPage.js b/app/component/IndexPage.js index f3b5aed9b7..3a771a75d3 100644 --- a/app/component/IndexPage.js +++ b/app/component/IndexPage.js @@ -249,16 +249,16 @@ class IndexPage extends React.Component { }; const directionProps = config.narrowNearYouButtons - ? { modeSet: config.iconModeSet } + ? {} : { buttonStyle: config.nearYouButton, - modeSet: config.nearYouModeSet, horizontal: false, }; return config.showNearYouButtons ? ( Date: Tue, 6 Jan 2026 11:41:08 +0200 Subject: [PATCH 099/129] fix: remove duplicate bus express icons --- .../src/assets/bus-express-hsl.svg | 4 - .../src/assets/bus-express-stop-hsl.svg | 6 -- .../digitransit-component-icon/src/index.js | 4 - .../src/index.js | 4 +- yarn.lock | 102 +++++++++++++++--- 5 files changed, 89 insertions(+), 31 deletions(-) delete mode 100644 digitransit-component/packages/digitransit-component-icon/src/assets/bus-express-hsl.svg delete mode 100644 digitransit-component/packages/digitransit-component-icon/src/assets/bus-express-stop-hsl.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bus-express-hsl.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-express-hsl.svg deleted file mode 100644 index 3bed907e35..0000000000 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/bus-express-hsl.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bus-express-stop-hsl.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-express-stop-hsl.svg deleted file mode 100644 index 9dae65e22b..0000000000 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/bus-express-stop-hsl.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/index.js b/digitransit-component/packages/digitransit-component-icon/src/index.js index dcd83ca9dd..8fa047d7fc 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/index.js +++ b/digitransit-component/packages/digitransit-component-icon/src/index.js @@ -39,7 +39,6 @@ import Subway from './assets/subway.svg'; import Funicular from './assets/funicular.svg'; import FunicularStop from './assets/funicular-stop.svg'; import BusHsl from './assets/bus-hsl.svg'; -import BusExpressHsl from './assets/bus-express-hsl.svg'; import BusReplacementHsl from './assets/bus-replacement-hsl.svg'; import SpeedTramHsl from './assets/speedtram-hsl.svg'; import BusLocalHsl from './assets/bus-local-hsl.svg'; @@ -48,7 +47,6 @@ import TramHsl from './assets/tram-hsl.svg'; import CityBikeHsl from './assets/citybike-hsl.svg'; import FerryHsl from './assets/ferry-hsl.svg'; import BusStopHsl from './assets/bus-stop-hsl.svg'; -import BusStopExpressHsl from './assets/bus-express-stop-hsl.svg'; import SpeedTramStopHsl from './assets/speedtram-stop-hsl.svg'; import RailStopHsl from './assets/rail-stop-hsl.svg'; import FerryStopHsl from './assets/ferry-stop-hsl.svg'; @@ -119,7 +117,6 @@ const iconMap = { 'funicular-stop': FunicularStop, // HSL 'bus-hsl': BusHsl, - 'bus-express-hsl': BusExpressHsl, 'bus-local-hsl': BusLocalHsl, 'bus-replacement-hsl': BusReplacementHsl, 'ferry-hsl': FerryHsl, @@ -128,7 +125,6 @@ const iconMap = { 'tram-hsl': TramHsl, 'citybike-hsl': CityBikeHsl, 'bus-stop-hsl': BusStopHsl, - 'bus-stop-express-hsl': BusStopExpressHsl, 'speedtram-stop-hsl': SpeedTramStopHsl, 'rail-stop-hsl': RailStopHsl, 'ferry-stop-hsl': FerryStopHsl, diff --git a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js index ae08db611b..468b38c5fe 100644 --- a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js +++ b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js @@ -60,8 +60,8 @@ const iconProps = { 'BUS-digitransit': ['bus-digitransit', 'mode-bus'], 'BUS-stop-digitransit': ['bus-stop-digitransit', 'mode-bus'], - 'BUS-EXPRESS-hsl': ['bus-stop-express-hsl', 'mode-bus-express'], - 'BUS-EXPRESS-stop-hsl': ['bus-express-stop-hsl', 'mode-bus-express'], + 'BUS-EXPRESS-hsl': ['bus-hsl', 'mode-bus-express'], + 'BUS-EXPRESS-stop-hsl': ['bus-stop-hsl', 'mode-bus-express'], 'BUS-EXPRESS-digitransit': ['bus-digitransit', 'mode-bus'], 'BUS-EXPRESS-stop-digitransit': ['bus-stop-digitransit', 'mode-bus'], diff --git a/yarn.lock b/yarn.lock index e72d433fa2..a5e7a99c79 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2008,7 +2008,7 @@ __metadata: resolution: "@digitransit-component/digitransit-component-autosuggest-panel@workspace:digitransit-component/packages/digitransit-component-autosuggest-panel" peerDependencies: "@digitransit-component/digitransit-component-autosuggest": ^6.0.4 - "@digitransit-component/digitransit-component-icon": ^1.2.0 + "@digitransit-component/digitransit-component-icon": ^2.0.0 "@hsl-fi/sass": ^0.2.0 classnames: 2.5.1 i18next: ^22.5.1 @@ -2033,7 +2033,7 @@ __metadata: "@hsl-fi/hooks": ^1.2.4 peerDependencies: "@digitransit-component/digitransit-component-dialog-modal": ^2.0.0 - "@digitransit-component/digitransit-component-icon": ^1.2.0 + "@digitransit-component/digitransit-component-icon": ^2.0.0 "@digitransit-component/digitransit-component-suggestion-item": ^2.3.1 "@hsl-fi/sass": ^0.2.0 classnames: 2.5.1 @@ -2053,7 +2053,7 @@ __metadata: version: 0.0.0-use.local resolution: "@digitransit-component/digitransit-component-control-panel@workspace:digitransit-component/packages/digitransit-component-control-panel" peerDependencies: - "@digitransit-component/digitransit-component-icon": ^1.2.0 + "@digitransit-component/digitransit-component-icon": ^2.0.0 "@hsl-fi/sass": ^0.2.0 classnames: 2.5.1 i18next: ^22.5.1 @@ -2067,7 +2067,7 @@ __metadata: version: 0.0.0-use.local resolution: "@digitransit-component/digitransit-component-datetimepicker@workspace:digitransit-component/packages/digitransit-component-datetimepicker" peerDependencies: - "@digitransit-component/digitransit-component-icon": ^1.2.0 + "@digitransit-component/digitransit-component-icon": ^2.0.0 classnames: 2.5.1 i18next: ^22.5.1 lodash: 4.17.21 @@ -2097,13 +2097,34 @@ __metadata: languageName: unknown linkType: soft -"@digitransit-component/digitransit-component-favourite-bar@^4.0.3, @digitransit-component/digitransit-component-favourite-bar@workspace:digitransit-component/packages/digitransit-component-favourite-bar": +"@digitransit-component/digitransit-component-favourite-bar@npm:^4.0.3": + version: 4.0.3 + resolution: "@digitransit-component/digitransit-component-favourite-bar@npm:4.0.3" + dependencies: + "@digitransit-search-util/digitransit-search-util-uniq-by-label": ^2.1.0 + peerDependencies: + "@digitransit-component/digitransit-component-icon": ^1.2.0 + "@digitransit-component/digitransit-component-suggestion-item": ^2.3.2 + "@hsl-fi/sass": ^0.2.0 + "@hsl-fi/shimmer": 0.1.2 + classnames: 2.5.1 + i18next: ^22.5.1 + lodash: 4.17.21 + lodash-es: 4.17.21 + prop-types: ^15.8.1 + react: ^16.13.0 + react-i18next: ^12.3.1 + checksum: e7f5ed33b4634d540f085cf21d584703c735360f760b20fc593aa76a1b9e9621b2d5680eb68fb0a781f37db8553fedf2fabe3053310883ebb1997d226a03a090 + languageName: node + linkType: hard + +"@digitransit-component/digitransit-component-favourite-bar@workspace:digitransit-component/packages/digitransit-component-favourite-bar": version: 0.0.0-use.local resolution: "@digitransit-component/digitransit-component-favourite-bar@workspace:digitransit-component/packages/digitransit-component-favourite-bar" dependencies: "@digitransit-search-util/digitransit-search-util-uniq-by-label": ^2.1.0 peerDependencies: - "@digitransit-component/digitransit-component-icon": ^1.2.0 + "@digitransit-component/digitransit-component-icon": ^2.0.0 "@digitransit-component/digitransit-component-suggestion-item": ^2.3.2 "@hsl-fi/sass": ^0.2.0 "@hsl-fi/shimmer": 0.1.2 @@ -2117,14 +2138,34 @@ __metadata: languageName: unknown linkType: soft -"@digitransit-component/digitransit-component-favourite-editing-modal@^4.0.1, @digitransit-component/digitransit-component-favourite-editing-modal@workspace:digitransit-component/packages/digitransit-component-favourite-editing-modal": +"@digitransit-component/digitransit-component-favourite-editing-modal@npm:^4.0.1": + version: 4.0.1 + resolution: "@digitransit-component/digitransit-component-favourite-editing-modal@npm:4.0.1" + dependencies: + "@digitransit-search-util/digitransit-search-util-uniq-by-label": ^2.1.0 + peerDependencies: + "@digitransit-component/digitransit-component-dialog-modal": ^2.0.0 + "@digitransit-component/digitransit-component-icon": ^1.2.0 + "@hsl-fi/container-spinner": 0.3.2 + "@hsl-fi/modal": ^0.3.2 + "@hsl-fi/sass": ^0.2.0 + i18next: ^22.5.1 + prop-types: ^15.8.1 + react: ^16.13.0 + react-i18next: ^12.3.1 + react-sortablejs: 2.0.11 + checksum: dce9339d2fee0f31d770cd0ca3053affddfa182f679e0913097d99588b00baf659dc4acab5f233ae275830683ebfc23291eb79a2d8fa017ce5b2a24240ef1021 + languageName: node + linkType: hard + +"@digitransit-component/digitransit-component-favourite-editing-modal@workspace:digitransit-component/packages/digitransit-component-favourite-editing-modal": version: 0.0.0-use.local resolution: "@digitransit-component/digitransit-component-favourite-editing-modal@workspace:digitransit-component/packages/digitransit-component-favourite-editing-modal" dependencies: "@digitransit-search-util/digitransit-search-util-uniq-by-label": ^2.1.0 peerDependencies: "@digitransit-component/digitransit-component-dialog-modal": ^2.0.0 - "@digitransit-component/digitransit-component-icon": ^1.2.0 + "@digitransit-component/digitransit-component-icon": ^2.0.0 "@hsl-fi/container-spinner": 0.3.2 "@hsl-fi/modal": ^0.3.2 "@hsl-fi/sass": ^0.2.0 @@ -2136,11 +2177,29 @@ __metadata: languageName: unknown linkType: soft -"@digitransit-component/digitransit-component-favourite-modal@^3.0.1, @digitransit-component/digitransit-component-favourite-modal@workspace:digitransit-component/packages/digitransit-component-favourite-modal": +"@digitransit-component/digitransit-component-favourite-modal@npm:^3.0.1": + version: 3.0.1 + resolution: "@digitransit-component/digitransit-component-favourite-modal@npm:3.0.1" + peerDependencies: + "@digitransit-component/digitransit-component-icon": ^1.2.0 + "@hsl-fi/modal": ^0.3.2 + "@hsl-fi/sass": ^0.2.0 + classnames: 2.5.1 + i18next: ^22.5.1 + lodash: 4.17.21 + lodash-es: 4.17.21 + prop-types: ^15.8.1 + react: ^16.13.0 + react-i18next: ^12.3.1 + checksum: 753b67486ea29ce2e116ce3a0c406d522f203a136b6e6b56ec0d9119a495eaceeb01240ae21d5ca3810dd54aeafbcb38cd90f51f11fedf6413477dd087a6ef39 + languageName: node + linkType: hard + +"@digitransit-component/digitransit-component-favourite-modal@workspace:digitransit-component/packages/digitransit-component-favourite-modal": version: 0.0.0-use.local resolution: "@digitransit-component/digitransit-component-favourite-modal@workspace:digitransit-component/packages/digitransit-component-favourite-modal" peerDependencies: - "@digitransit-component/digitransit-component-icon": ^1.2.0 + "@digitransit-component/digitransit-component-icon": ^2.0.0 "@hsl-fi/modal": ^0.3.2 "@hsl-fi/sass": ^0.2.0 classnames: 2.5.1 @@ -2153,7 +2212,7 @@ __metadata: languageName: unknown linkType: soft -"@digitransit-component/digitransit-component-icon@^1.2.0, @digitransit-component/digitransit-component-icon@workspace:digitransit-component/packages/digitransit-component-icon": +"@digitransit-component/digitransit-component-icon@^2.0.0, @digitransit-component/digitransit-component-icon@workspace:digitransit-component/packages/digitransit-component-icon": version: 0.0.0-use.local resolution: "@digitransit-component/digitransit-component-icon@workspace:digitransit-component/packages/digitransit-component-icon" peerDependencies: @@ -2162,11 +2221,24 @@ __metadata: languageName: unknown linkType: soft -"@digitransit-component/digitransit-component-suggestion-item@^2.3.2, @digitransit-component/digitransit-component-suggestion-item@workspace:digitransit-component/packages/digitransit-component-suggestion-item": +"@digitransit-component/digitransit-component-suggestion-item@npm:^2.3.2": + version: 2.3.2 + resolution: "@digitransit-component/digitransit-component-suggestion-item@npm:2.3.2" + peerDependencies: + "@digitransit-component/digitransit-component-icon": ^1.2.0 + "@hsl-fi/sass": " ^0.2.0" + classnames: 2.5.1 + prop-types: ^15.8.1 + react: ^16.13.0 + checksum: 8c18020de8b9d7dd78d350e7db4f842cb4eca53e9f4b40159931b4916966ae273de487a6f84413a59d432e26157d2b279a5644aee181832a3c472a5327341615 + languageName: node + linkType: hard + +"@digitransit-component/digitransit-component-suggestion-item@workspace:digitransit-component/packages/digitransit-component-suggestion-item": version: 0.0.0-use.local resolution: "@digitransit-component/digitransit-component-suggestion-item@workspace:digitransit-component/packages/digitransit-component-suggestion-item" peerDependencies: - "@digitransit-component/digitransit-component-icon": ^1.2.0 + "@digitransit-component/digitransit-component-icon": ^2.0.0 "@hsl-fi/sass": " ^0.2.0" classnames: 2.5.1 prop-types: ^15.8.1 @@ -2178,7 +2250,7 @@ __metadata: version: 0.0.0-use.local resolution: "@digitransit-component/digitransit-component-traffic-now-link@workspace:digitransit-component/packages/digitransit-component-traffic-now-link" peerDependencies: - "@digitransit-component/digitransit-component-icon": ^1.2.0 + "@digitransit-component/digitransit-component-icon": ^2.0.0 "@hsl-fi/sass": ^0.2.0 i18next: ^22.5.1 prop-types: ^15.8.1 @@ -2208,7 +2280,7 @@ __metadata: "@digitransit-component/digitransit-component-favourite-bar": ^4.0.3 "@digitransit-component/digitransit-component-favourite-editing-modal": ^4.0.1 "@digitransit-component/digitransit-component-favourite-modal": ^3.0.1 - "@digitransit-component/digitransit-component-icon": ^1.2.0 + "@digitransit-component/digitransit-component-icon": ^2.0.0 "@digitransit-component/digitransit-component-suggestion-item": ^2.3.2 "@digitransit-component/digitransit-component-with-breakpoint": ^1.0.0 peerDependencies: From b691b18f93116fa6e4a94af32ae863ba605871eb Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Tue, 6 Jan 2026 13:48:04 +0200 Subject: [PATCH 100/129] fix: update dependency versions --- .../package.json | 2 +- .../package.json | 2 +- .../digitransit-component/package.json | 8 +- yarn.lock | 92 ++----------------- 4 files changed, 16 insertions(+), 88 deletions(-) diff --git a/digitransit-component/packages/digitransit-component-autosuggest/package.json b/digitransit-component/packages/digitransit-component-autosuggest/package.json index 0d8a39168c..1225c86701 100644 --- a/digitransit-component/packages/digitransit-component-autosuggest/package.json +++ b/digitransit-component/packages/digitransit-component-autosuggest/package.json @@ -37,7 +37,7 @@ "peerDependencies": { "@digitransit-component/digitransit-component-dialog-modal": "^2.0.0", "@digitransit-component/digitransit-component-icon": "^2.0.0", - "@digitransit-component/digitransit-component-suggestion-item": "^2.3.1", + "@digitransit-component/digitransit-component-suggestion-item": "^3.0.0", "@hsl-fi/sass": "^0.2.0", "classnames": "2.5.1", "i18next": "^22.5.1", diff --git a/digitransit-component/packages/digitransit-component-favourite-bar/package.json b/digitransit-component/packages/digitransit-component-favourite-bar/package.json index 1a8d961ba5..f65c2495ab 100644 --- a/digitransit-component/packages/digitransit-component-favourite-bar/package.json +++ b/digitransit-component/packages/digitransit-component-favourite-bar/package.json @@ -33,7 +33,7 @@ }, "peerDependencies": { "@digitransit-component/digitransit-component-icon": "^2.0.0", - "@digitransit-component/digitransit-component-suggestion-item": "^2.3.2", + "@digitransit-component/digitransit-component-suggestion-item": "^3.0.0", "@hsl-fi/sass": "^0.2.0", "@hsl-fi/shimmer": "0.1.2", "classnames": "2.5.1", diff --git a/digitransit-component/packages/digitransit-component/package.json b/digitransit-component/packages/digitransit-component/package.json index f14c55770c..e3433612e6 100644 --- a/digitransit-component/packages/digitransit-component/package.json +++ b/digitransit-component/packages/digitransit-component/package.json @@ -21,11 +21,11 @@ "@digitransit-component/digitransit-component-autosuggest": "^6.0.4", "@digitransit-component/digitransit-component-autosuggest-panel": "^7.0.4", "@digitransit-component/digitransit-component-control-panel": "^7.0.0", - "@digitransit-component/digitransit-component-favourite-bar": "^4.0.3", - "@digitransit-component/digitransit-component-favourite-editing-modal": "^4.0.1", - "@digitransit-component/digitransit-component-favourite-modal": "^3.0.1", + "@digitransit-component/digitransit-component-favourite-bar": "^5.0.0", + "@digitransit-component/digitransit-component-favourite-editing-modal": "^5.0.0", + "@digitransit-component/digitransit-component-favourite-modal": "^4.0.0", "@digitransit-component/digitransit-component-icon": "^2.0.0", - "@digitransit-component/digitransit-component-suggestion-item": "^2.3.2", + "@digitransit-component/digitransit-component-suggestion-item": "^3.0.0", "@digitransit-component/digitransit-component-with-breakpoint": "^1.0.0" }, "peerDependencies": { diff --git a/yarn.lock b/yarn.lock index a5e7a99c79..8fd55bc56d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2034,7 +2034,7 @@ __metadata: peerDependencies: "@digitransit-component/digitransit-component-dialog-modal": ^2.0.0 "@digitransit-component/digitransit-component-icon": ^2.0.0 - "@digitransit-component/digitransit-component-suggestion-item": ^2.3.1 + "@digitransit-component/digitransit-component-suggestion-item": ^3.0.0 "@hsl-fi/sass": ^0.2.0 classnames: 2.5.1 i18next: ^22.5.1 @@ -2097,35 +2097,14 @@ __metadata: languageName: unknown linkType: soft -"@digitransit-component/digitransit-component-favourite-bar@npm:^4.0.3": - version: 4.0.3 - resolution: "@digitransit-component/digitransit-component-favourite-bar@npm:4.0.3" - dependencies: - "@digitransit-search-util/digitransit-search-util-uniq-by-label": ^2.1.0 - peerDependencies: - "@digitransit-component/digitransit-component-icon": ^1.2.0 - "@digitransit-component/digitransit-component-suggestion-item": ^2.3.2 - "@hsl-fi/sass": ^0.2.0 - "@hsl-fi/shimmer": 0.1.2 - classnames: 2.5.1 - i18next: ^22.5.1 - lodash: 4.17.21 - lodash-es: 4.17.21 - prop-types: ^15.8.1 - react: ^16.13.0 - react-i18next: ^12.3.1 - checksum: e7f5ed33b4634d540f085cf21d584703c735360f760b20fc593aa76a1b9e9621b2d5680eb68fb0a781f37db8553fedf2fabe3053310883ebb1997d226a03a090 - languageName: node - linkType: hard - -"@digitransit-component/digitransit-component-favourite-bar@workspace:digitransit-component/packages/digitransit-component-favourite-bar": +"@digitransit-component/digitransit-component-favourite-bar@^5.0.0, @digitransit-component/digitransit-component-favourite-bar@workspace:digitransit-component/packages/digitransit-component-favourite-bar": version: 0.0.0-use.local resolution: "@digitransit-component/digitransit-component-favourite-bar@workspace:digitransit-component/packages/digitransit-component-favourite-bar" dependencies: "@digitransit-search-util/digitransit-search-util-uniq-by-label": ^2.1.0 peerDependencies: "@digitransit-component/digitransit-component-icon": ^2.0.0 - "@digitransit-component/digitransit-component-suggestion-item": ^2.3.2 + "@digitransit-component/digitransit-component-suggestion-item": ^3.0.0 "@hsl-fi/sass": ^0.2.0 "@hsl-fi/shimmer": 0.1.2 classnames: 2.5.1 @@ -2138,27 +2117,7 @@ __metadata: languageName: unknown linkType: soft -"@digitransit-component/digitransit-component-favourite-editing-modal@npm:^4.0.1": - version: 4.0.1 - resolution: "@digitransit-component/digitransit-component-favourite-editing-modal@npm:4.0.1" - dependencies: - "@digitransit-search-util/digitransit-search-util-uniq-by-label": ^2.1.0 - peerDependencies: - "@digitransit-component/digitransit-component-dialog-modal": ^2.0.0 - "@digitransit-component/digitransit-component-icon": ^1.2.0 - "@hsl-fi/container-spinner": 0.3.2 - "@hsl-fi/modal": ^0.3.2 - "@hsl-fi/sass": ^0.2.0 - i18next: ^22.5.1 - prop-types: ^15.8.1 - react: ^16.13.0 - react-i18next: ^12.3.1 - react-sortablejs: 2.0.11 - checksum: dce9339d2fee0f31d770cd0ca3053affddfa182f679e0913097d99588b00baf659dc4acab5f233ae275830683ebfc23291eb79a2d8fa017ce5b2a24240ef1021 - languageName: node - linkType: hard - -"@digitransit-component/digitransit-component-favourite-editing-modal@workspace:digitransit-component/packages/digitransit-component-favourite-editing-modal": +"@digitransit-component/digitransit-component-favourite-editing-modal@^5.0.0, @digitransit-component/digitransit-component-favourite-editing-modal@workspace:digitransit-component/packages/digitransit-component-favourite-editing-modal": version: 0.0.0-use.local resolution: "@digitransit-component/digitransit-component-favourite-editing-modal@workspace:digitransit-component/packages/digitransit-component-favourite-editing-modal" dependencies: @@ -2177,25 +2136,7 @@ __metadata: languageName: unknown linkType: soft -"@digitransit-component/digitransit-component-favourite-modal@npm:^3.0.1": - version: 3.0.1 - resolution: "@digitransit-component/digitransit-component-favourite-modal@npm:3.0.1" - peerDependencies: - "@digitransit-component/digitransit-component-icon": ^1.2.0 - "@hsl-fi/modal": ^0.3.2 - "@hsl-fi/sass": ^0.2.0 - classnames: 2.5.1 - i18next: ^22.5.1 - lodash: 4.17.21 - lodash-es: 4.17.21 - prop-types: ^15.8.1 - react: ^16.13.0 - react-i18next: ^12.3.1 - checksum: 753b67486ea29ce2e116ce3a0c406d522f203a136b6e6b56ec0d9119a495eaceeb01240ae21d5ca3810dd54aeafbcb38cd90f51f11fedf6413477dd087a6ef39 - languageName: node - linkType: hard - -"@digitransit-component/digitransit-component-favourite-modal@workspace:digitransit-component/packages/digitransit-component-favourite-modal": +"@digitransit-component/digitransit-component-favourite-modal@^4.0.0, @digitransit-component/digitransit-component-favourite-modal@workspace:digitransit-component/packages/digitransit-component-favourite-modal": version: 0.0.0-use.local resolution: "@digitransit-component/digitransit-component-favourite-modal@workspace:digitransit-component/packages/digitransit-component-favourite-modal" peerDependencies: @@ -2221,20 +2162,7 @@ __metadata: languageName: unknown linkType: soft -"@digitransit-component/digitransit-component-suggestion-item@npm:^2.3.2": - version: 2.3.2 - resolution: "@digitransit-component/digitransit-component-suggestion-item@npm:2.3.2" - peerDependencies: - "@digitransit-component/digitransit-component-icon": ^1.2.0 - "@hsl-fi/sass": " ^0.2.0" - classnames: 2.5.1 - prop-types: ^15.8.1 - react: ^16.13.0 - checksum: 8c18020de8b9d7dd78d350e7db4f842cb4eca53e9f4b40159931b4916966ae273de487a6f84413a59d432e26157d2b279a5644aee181832a3c472a5327341615 - languageName: node - linkType: hard - -"@digitransit-component/digitransit-component-suggestion-item@workspace:digitransit-component/packages/digitransit-component-suggestion-item": +"@digitransit-component/digitransit-component-suggestion-item@^3.0.0, @digitransit-component/digitransit-component-suggestion-item@workspace:digitransit-component/packages/digitransit-component-suggestion-item": version: 0.0.0-use.local resolution: "@digitransit-component/digitransit-component-suggestion-item@workspace:digitransit-component/packages/digitransit-component-suggestion-item" peerDependencies: @@ -2277,11 +2205,11 @@ __metadata: "@digitransit-component/digitransit-component-autosuggest": ^6.0.4 "@digitransit-component/digitransit-component-autosuggest-panel": ^7.0.4 "@digitransit-component/digitransit-component-control-panel": ^7.0.0 - "@digitransit-component/digitransit-component-favourite-bar": ^4.0.3 - "@digitransit-component/digitransit-component-favourite-editing-modal": ^4.0.1 - "@digitransit-component/digitransit-component-favourite-modal": ^3.0.1 + "@digitransit-component/digitransit-component-favourite-bar": ^5.0.0 + "@digitransit-component/digitransit-component-favourite-editing-modal": ^5.0.0 + "@digitransit-component/digitransit-component-favourite-modal": ^4.0.0 "@digitransit-component/digitransit-component-icon": ^2.0.0 - "@digitransit-component/digitransit-component-suggestion-item": ^2.3.2 + "@digitransit-component/digitransit-component-suggestion-item": ^3.0.0 "@digitransit-component/digitransit-component-with-breakpoint": ^1.0.0 peerDependencies: "@digitransit-component/digitransit-component-dialog-modal": ^2.0.0 From ff0a3e759625a6315920aa72b50e3b8171bdab15 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 09:14:51 +0200 Subject: [PATCH 101/129] Revert "Merge pull request #5604 from HSLdevcom/AB#150-enable-car-ferries-for-kela" This reverts commit 2750cf905adc45cb59ef882b2966a45e0cac8b2d, reversing changes made to a63e9a010444afbb38881fbddb1c29754d7c9e50. --- app/component/itinerary/StreetModeSelectorButton.js | 2 +- app/configurations/config.kela.js | 4 +--- app/util/legUtils.js | 6 +----- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/app/component/itinerary/StreetModeSelectorButton.js b/app/component/itinerary/StreetModeSelectorButton.js index 540879aacc..f9ebaf11b9 100644 --- a/app/component/itinerary/StreetModeSelectorButton.js +++ b/app/component/itinerary/StreetModeSelectorButton.js @@ -42,7 +42,7 @@ export default function StreetModeSelectorButton( break; case streetHash.carAndVehicle: distance = displayDistance( - getTotalDrivingDistance(itinerary, config), + getTotalDrivingDistance(itinerary), config, intl.formatNumber, ); diff --git a/app/configurations/config.kela.js b/app/configurations/config.kela.js index f217b4a0d9..bd98d4d70f 100644 --- a/app/configurations/config.kela.js +++ b/app/configurations/config.kela.js @@ -49,9 +49,7 @@ export default { }, ], }, - carBoardingModes: { - FERRY: { showNotification: false }, - }, + transportModes: { citybike: { availableForSelection: false, diff --git a/app/util/legUtils.js b/app/util/legUtils.js index 8058a877f4..966527156e 100644 --- a/app/util/legUtils.js +++ b/app/util/legUtils.js @@ -528,11 +528,7 @@ export function getTotalBikingDistance(itinerary) { return sumDistances(itinerary.legs.filter(isBikingLeg)); } -export function getTotalDrivingDistance(itinerary, config = {}) { - // Don't rely only driving legs when calculating the one way journey. - if (config.emphasizeOneWayJourney) { - return sumDistances(itinerary.legs); - } +export function getTotalDrivingDistance(itinerary) { return sumDistances(itinerary.legs.filter(isDrivingLeg)); } From c11a5451b177cc0233496ed8f84b29a064c72763 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 09:15:24 +0200 Subject: [PATCH 102/129] Revert "Reapply "Reapply "Merge pull request #5584 from HSLdevcom/AB#203""" This reverts commit a63e9a010444afbb38881fbddb1c29754d7c9e50. --- app/configurations/config.hsl.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app/configurations/config.hsl.js b/app/configurations/config.hsl.js index 0ddd8c63bb..cb9482a85c 100644 --- a/app/configurations/config.hsl.js +++ b/app/configurations/config.hsl.js @@ -116,7 +116,6 @@ export default { defaultSettings: { walkSpeed: 1.28, showBikeAndParkItineraries: true, - transferPenalty: 120, }, /** From 9836269b5f4d4b329181690ccd369fc7dd11bb9d Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 10:35:17 +0200 Subject: [PATCH 103/129] fix: use proper array.includes call --- .../packages/digitransit-component-control-panel/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/digitransit-component/packages/digitransit-component-control-panel/src/index.js b/digitransit-component/packages/digitransit-component-control-panel/src/index.js index 1c0cbaa99e..276aa908a2 100644 --- a/digitransit-component/packages/digitransit-component-control-panel/src/index.js +++ b/digitransit-component/packages/digitransit-component-control-panel/src/index.js @@ -85,7 +85,7 @@ const validNearYouModes = [ const noTheme = ['bikepark', 'carpark', 'subway', 'airplane']; // common icon in all themes function getIconName(mode, modeSet, horizontal) { - const theme = noTheme.includes[mode] ? '' : `-${modeSet}`; + const theme = noTheme.includes(mode) ? '' : `-${modeSet}`; const fill = horizontal ? '' : '-fill'; // do not render boxed icon for vertical return `${mode}${fill}${theme}`; } From e3b770202a6210c795742c11215ad9f6adbb52bd Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 10:36:08 +0200 Subject: [PATCH 104/129] chore: refactor more --- .../src/index.js | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js index 468b38c5fe..af82438d1a 100644 --- a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js +++ b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js @@ -107,6 +107,19 @@ function getAriaDescription(ariaContentArray) { const stopLayers = ['station', 'stop']; const noTheme = ['subway', 'airplane', 'funicular']; // common icon in all themes +function getIconProps(mode, isStop, modeSet) { + // select stop lollipop or mode/station icon + const stopDesc = isStop ? '-stop' : ''; + // is the icon theme specific + const themePostfix = noTheme.includes(mode) ? '' : `-${modeSet}`; + return ( + iconProps[`${mode}${stopDesc}${themePostfix}`] || [ + 'bus-stop-digitransit', + 'mode-bus', + ] + ); +} + function getIconProperties(item, modeSet, stopCode, modes) { let iconId; @@ -120,9 +133,7 @@ function getIconProperties(item, modeSet, stopCode, modes) { (item.type === 'OldSearch' && item.properties?.mode) ) { const mode = getRouteMode(item.properties, modeSet); - return noTheme.includes(mode) - ? [`${mode}`, `mode-${mode}`] // same for all themes - : [`${mode}-${modeSet}`, `mode-${mode}`]; + return getIconProps(mode, false, modeSet); } if (item.selectedIconId) { iconId = item.selectedIconId; @@ -154,16 +165,9 @@ function getIconProperties(item, modeSet, stopCode, modes) { } else if (modes.includes('BUS-EXPRESS')) { mode = 'BUS-EXPRESS'; } - // select stop lollipop or mode/station icon - const stopDesc = - item.properties.layer === 'station' || (mode === 'FERRY' && stopCode) - ? '' - : '-stop'; - // is the icon theme specific - const themePostfix = noTheme.includes(mode) ? '' : `-${modeSet}`; - - const props = iconProps[`${mode}${stopDesc}${themePostfix}`]; - return props || ['bus-stop-digitransit', 'mode-bus']; + const station = + item.properties.layer === 'station' || (mode === 'FERRY' && stopCode); + return getIconProps(mode, !station, modeSet); } return iconProps[iconId] || ['place']; } From f20b21cd86d179643505f37e07d16ee849faa87e Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 11:21:11 +0200 Subject: [PATCH 105/129] fix: remove redundant icon mappings Generate regular icon binding with code, no need for a map --- .../src/index.js | 67 ++++++------------- 1 file changed, 21 insertions(+), 46 deletions(-) diff --git a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js index af82438d1a..8fe69b02ed 100644 --- a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js +++ b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js @@ -39,7 +39,6 @@ const getRouteMode = (props, set) => { const iconProps = { bikestation: ['citybike'], currentPosition: ['locate'], - stop: ['busstop'], locality: ['city'], station: ['station'], localadmin: ['city'], @@ -55,42 +54,16 @@ const iconProps = { back: ['arrow'], futureRoute: ['future-route'], - 'BUS-hsl': ['bus-hsl', 'mode-bus'], - 'BUS-stop-hsl': ['bus-stop-hsl', 'mode-bus'], - 'BUS-digitransit': ['bus-digitransit', 'mode-bus'], - 'BUS-stop-digitransit': ['bus-stop-digitransit', 'mode-bus'], - - 'BUS-EXPRESS-hsl': ['bus-hsl', 'mode-bus-express'], - 'BUS-EXPRESS-stop-hsl': ['bus-stop-hsl', 'mode-bus-express'], - 'BUS-EXPRESS-digitransit': ['bus-digitransit', 'mode-bus'], - 'BUS-EXPRESS-stop-digitransit': ['bus-stop-digitransit', 'mode-bus'], - - 'SPEEDTRAM-hsl': ['speedtram-hsl', 'mode-speedtram'], - 'SPEEDTRAM-digitransit': ['mode-tram', 'mode-tram'], - 'SPEEDTRAM-stop-hsl': ['speedtram-stop-hsl', 'mode-speedtram'], - 'SPEEDTRAM-stop-digitransit': ['tram-stop', 'mode-tram'], - - 'RAIL-hsl': ['rail-hsl', 'mode-rail'], - 'RAIL-stop-hsl': ['rail-stop-hsl', 'mode-rail'], - 'RAIL-digitransit': ['rail-digitransit', 'mode-rail'], - 'RAIL-stop-digitransit': ['rail-stop-digitransit', 'mode-rail'], - - 'TRAM-hsl': ['tram-hsl', 'mode-tram'], - 'TRAM-stop-hsl': ['tram-stop-hsl', 'mode-tram'], - 'TRAM-digitransit': ['tram-digitransit', 'mode-tram'], - 'TRAM-stop-digitransit': ['tram-stop-digitransit', 'mode-tram'], - - 'FERRY-hsl': ['ferry-hsl', 'mode-ferry'], - 'FERRY-stop-hsl': ['ferry-stop-hsl', 'mode-ferry-external'], - 'FERRY-digitransit': ['ferry-digitransit', 'mode-ferry'], - 'FERRY-stop-digitransit': ['ferry-stop-digitransit', 'mode-ferry-external'], - - 'BUS-TRAM-stop-digitransit': ['bustram-stop-digitransit', 'mode-tram'], - - SUBWAY: ['subway', 'mode-subway'], - AIRPLANE: ['airplane', 'mode-airplane'], - FUNICULAR: ['funicular', 'mode-funicular'], - 'FUNICULAR-stop': ['funicular-stop', 'mode-funicular'], + // map unusual transport modes + 'bus-express-hsl': ['bus-hsl', 'mode-bus-express'], + 'bus-express-stop-hsl': ['bus-stop-hsl', 'mode-bus-express'], + 'bus-express-digitransit': ['bus-digitransit', 'mode-bus'], + 'bus-express-stop-digitransit': ['bus-stop-digitransit', 'mode-bus'], + 'speedtram-digitransit': ['mode-tram', 'mode-tram'], + 'speedtram-stop-digitransit': ['tram-stop-digitransit', 'mode-tram'], + 'ferry-stop-hsl': ['ferry-stop-hsl', 'mode-ferry-external'], + 'ferry-stop-digitransit': ['ferry-stop-digitransit', 'mode-ferry-external'], + 'bus-tram-stop-digitransit': ['bustram-stop-digitransit', 'mode-tram'], }; function isFavourite(item) { @@ -114,8 +87,8 @@ function getIconProps(mode, isStop, modeSet) { const themePostfix = noTheme.includes(mode) ? '' : `-${modeSet}`; return ( iconProps[`${mode}${stopDesc}${themePostfix}`] || [ - 'bus-stop-digitransit', - 'mode-bus', + `${mode}${stopDesc}${themePostfix}`, + `mode-${mode}`, ] ); } @@ -158,15 +131,17 @@ function getIconProperties(item, modeSet, stopCode, modes) { } // Use more accurate icons in stop/station search, depending on mode from geocoding if (modes?.length) { - // select dominating mode - let mode = modes[0]; + let station = item.properties.layer === 'station'; + let mode; // select dominating mode if (modes.includes('SPEEDTRAM')) { - mode = 'SPEEDTRAM'; - } else if (modes.includes('BUS-EXPRESS')) { - mode = 'BUS-EXPRESS'; + mode = 'speedtram'; + } else if (modes.includes('BUS-EXPRESS' && !station)) { + mode = 'bus-express'; + } else { + mode = modes[0].toLowerCase(); } - const station = - item.properties.layer === 'station' || (mode === 'FERRY' && stopCode); + station = station || (mode === 'ferry' && stopCode); + return getIconProps(mode, !station, modeSet); } return iconProps[iconId] || ['place']; From d600afce4b1976f29b47b1b93afd729b680fd626 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 11:39:53 +0200 Subject: [PATCH 106/129] feat: theme colors for parks --- app/configurations/config.default.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/configurations/config.default.js b/app/configurations/config.default.js index 9dcd32e34c..eac280459c 100644 --- a/app/configurations/config.default.js +++ b/app/configurations/config.default.js @@ -387,6 +387,8 @@ export default { 'mode-scooter': '#C5CAD2', 'mode-taxi': '#647693', 'mode-replacement-bus': '#DC0451', + 'mode-bikepark': '#f2b62d', + 'mode-carpark': '#007ac9', }, }, iconModeSet: 'digitransit', From 980af6da3c7873fec39448382ad8e29cf9c72ee9 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 11:46:35 +0200 Subject: [PATCH 107/129] fix: add missing default theme colors --- .../packages/digitransit-component-control-panel/src/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/digitransit-component/packages/digitransit-component-control-panel/src/index.js b/digitransit-component/packages/digitransit-component-control-panel/src/index.js index 276aa908a2..7e90afc669 100644 --- a/digitransit-component/packages/digitransit-component-control-panel/src/index.js +++ b/digitransit-component/packages/digitransit-component-control-panel/src/index.js @@ -273,12 +273,15 @@ NearStopsAndRoutes.defaultProps = { onClick: undefined, title: undefined, modeIconColors: { + 'mode-airplane': '#0046ad', 'mode-bus': '#007ac9', 'mode-rail': '#8c4799', 'mode-tram': '#008151', 'mode-subway': '#ed8c00', 'mode-ferry': '#007A97', 'mode-citybike': '#F2B62D', + 'mode-bikepark': '#f2b62d', + 'mode-carpark': '#007ac9', }, modeSet: 'hsl', fontWeights: { From 65049f986e3776004dec638cc16537ae92646679 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 12:03:50 +0200 Subject: [PATCH 108/129] fix: scale new park fill svg to fit the round container in vertical buttons --- .../digitransit-component-icon/src/assets/bikepark-fill.svg | 4 +--- .../digitransit-component-icon/src/assets/carpark-fill.svg | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bikepark-fill.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bikepark-fill.svg index be7ad9030c..6b05d58b83 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/bikepark-fill.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/bikepark-fill.svg @@ -1,3 +1 @@ - - - + \ No newline at end of file diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/carpark-fill.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/carpark-fill.svg index fd39079a38..ebf35c3af2 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/carpark-fill.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/carpark-fill.svg @@ -1,3 +1 @@ - - - + \ No newline at end of file From d8b33a38f2ff32578401cb150d85e26e4a2c7481 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 13:28:05 +0200 Subject: [PATCH 109/129] fix: add mapping for subway-stop --- .../packages/digitransit-component-suggestion-item/src/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js index 8fe69b02ed..6b206ddaf8 100644 --- a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js +++ b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js @@ -55,6 +55,7 @@ const iconProps = { futureRoute: ['future-route'], // map unusual transport modes + 'subway-stop': ['subway', 'mode-subway'], 'bus-express-hsl': ['bus-hsl', 'mode-bus-express'], 'bus-express-stop-hsl': ['bus-stop-hsl', 'mode-bus-express'], 'bus-express-digitransit': ['bus-digitransit', 'mode-bus'], From 8a0b64b03c48bdcf55e96905c7ce3adc65c5dfbc Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 13:28:38 +0200 Subject: [PATCH 110/129] fix: Icon library to obey configured colors Almost half of transit mode related icons rendered a hard coded color --- .../packages/digitransit-component-icon/src/assets/arrow.svg | 2 -- .../digitransit-component-icon/src/assets/bus-local-hsl.svg | 2 +- .../src/assets/bus-replacement-hsl.svg | 2 +- .../digitransit-component-icon/src/assets/bus-stop-hsl.svg | 2 +- .../digitransit-component-icon/src/assets/carpark.svg | 2 +- .../packages/digitransit-component-icon/src/assets/check.svg | 2 +- .../src/assets/citybike-fill-digitransit.svg | 4 ++-- .../digitransit-component-icon/src/assets/ferry-hsl.svg | 2 +- .../digitransit-component-icon/src/assets/speedtram-hsl.svg | 2 +- .../src/assets/speedtram-stop-hsl.svg | 4 ++-- .../packages/digitransit-component-icon/src/assets/subway.svg | 2 +- .../digitransit-component-icon/src/assets/tram-stop-hsl.svg | 4 ++-- 12 files changed, 14 insertions(+), 16 deletions(-) diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/arrow.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/arrow.svg index 3df4ef3b39..0f18ea5784 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/arrow.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/arrow.svg @@ -1,6 +1,4 @@ - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bus-local-hsl.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-local-hsl.svg index d8b62a8e00..e7287fb1aa 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/bus-local-hsl.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-local-hsl.svg @@ -1,4 +1,4 @@ - + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bus-replacement-hsl.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-replacement-hsl.svg index 57db6e0cd3..ea4605ac66 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/bus-replacement-hsl.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-replacement-hsl.svg @@ -1,4 +1,4 @@ - + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/bus-stop-hsl.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-stop-hsl.svg index b3d08dd947..dac9ef2e6e 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/bus-stop-hsl.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/bus-stop-hsl.svg @@ -1,6 +1,6 @@ - + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/carpark.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/carpark.svg index 67a0f01717..3e067992ad 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/carpark.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/carpark.svg @@ -1,4 +1,4 @@ - + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/check.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/check.svg index c1c1352aef..06932b8e63 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/check.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/check.svg @@ -1,3 +1,3 @@ - + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/citybike-fill-digitransit.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/citybike-fill-digitransit.svg index 4adf3990f3..541ba911a2 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/citybike-fill-digitransit.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/citybike-fill-digitransit.svg @@ -1,4 +1,4 @@ - - + + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-hsl.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-hsl.svg index 872adc64d7..a44e33d9bc 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-hsl.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-hsl.svg @@ -1,4 +1,4 @@ - + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/speedtram-hsl.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/speedtram-hsl.svg index 781c6f22e2..eb377f7299 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/speedtram-hsl.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/speedtram-hsl.svg @@ -1,4 +1,4 @@ - + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/speedtram-stop-hsl.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/speedtram-stop-hsl.svg index 0d8f69b541..41f123aa52 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/speedtram-stop-hsl.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/speedtram-stop-hsl.svg @@ -1,6 +1,6 @@ - - + + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/subway.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/subway.svg index 624c9848ab..aa72345469 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/subway.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/subway.svg @@ -1,6 +1,6 @@ - + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/tram-stop-hsl.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/tram-stop-hsl.svg index 3ed9e47f0e..ab152be585 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/tram-stop-hsl.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/tram-stop-hsl.svg @@ -1,6 +1,6 @@ - - + + From d356a70d81cdc5692e557f403ee4cdf569322ad3 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 15:05:08 +0200 Subject: [PATCH 111/129] fix: remove duplicate icons --- .../src/assets/mapmarker-via.svg | 3 --- .../src/assets/select-from-map.svg | 7 ------- .../packages/digitransit-component-icon/src/index.js | 4 ---- .../src/index.js | 11 ++++++----- 4 files changed, 6 insertions(+), 19 deletions(-) delete mode 100644 digitransit-component/packages/digitransit-component-icon/src/assets/mapmarker-via.svg delete mode 100644 digitransit-component/packages/digitransit-component-icon/src/assets/select-from-map.svg diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/mapmarker-via.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/mapmarker-via.svg deleted file mode 100644 index 4df92c509c..0000000000 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/mapmarker-via.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/select-from-map.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/select-from-map.svg deleted file mode 100644 index 38da9594c3..0000000000 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/select-from-map.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/index.js b/digitransit-component/packages/digitransit-component-icon/src/index.js index 8fa047d7fc..c6e73f539b 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/index.js +++ b/digitransit-component/packages/digitransit-component-icon/src/index.js @@ -16,7 +16,6 @@ import Work from './assets/work.svg'; import Map from './assets/map.svg'; import Close from './assets/close.svg'; import Mapmarker from './assets/mapmarker.svg'; -import MapmarkerVia from './assets/mapmarker-via.svg'; import Search from './assets/search.svg'; import Plus from './assets/plus.svg'; import Attention from './assets/attention.svg'; @@ -28,7 +27,6 @@ import Ellipsis from './assets/ellipsis.svg'; import Opposite from './assets/opposite.svg'; import Viapoint from './assets/viapoint.svg'; import Calendar from './assets/calendar.svg'; -import SelectFromMap from './assets/select-from-map.svg'; import CautionWhite from './assets/caution_white_exclamation.svg'; import Trash from './assets/trash.svg'; import FutureRoute from './assets/icon-route.svg'; @@ -90,7 +88,6 @@ const iconMap = { station: Station, work: Work, close: Close, - 'mapMarker-via': MapmarkerVia, bikepark: BikePark, carpark: CarPark, mapMarker: Mapmarker, @@ -103,7 +100,6 @@ const iconMap = { opposite: Opposite, viapoint: Viapoint, calendar: Calendar, - 'select-from-map': SelectFromMap, 'caution-white': CautionWhite, trash: Trash, position: Position, diff --git a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js index 6b206ddaf8..1058f27733 100644 --- a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js +++ b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js @@ -13,15 +13,16 @@ const extendedModes = { }; const iconColors = { - 'mode-airplane': '#0046AD', + 'mode-airplane': '#0046ad', 'mode-bus': '#007ac9', - 'mode-bus-express': '#CA4000', + 'mode-bus-express': '#ca4000', 'mode-bus-local': '#007ac9', + 'mode-bus-replacement': '#dc0451', 'mode-rail': '#8c4799', 'mode-tram': '#008151', - 'mode-speedtram': '#007E79', + 'mode-speedtram': '#007e79', 'mode-subway': '#ed8c00', - 'mode-ferry': '#007A97', + 'mode-ferry': '#007a97', 'mode-ferry-external': '#666666', 'mode-funicular': '#ff00ff', 'mode-citybike': '#f2b62d', @@ -49,7 +50,7 @@ const iconProps = { 'icon-icon_sport': ['sport'], 'icon-icon_school': ['school'], 'icon-icon_shopping': ['shopping'], - selectFromMap: ['select-from-map'], + selectFromMap: ['map'], ownLocations: ['star'], back: ['arrow'], futureRoute: ['future-route'], From 6a45c69e31a7db927ed20d61709a73b089a429ee Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 15:42:01 +0200 Subject: [PATCH 112/129] fix: app code uses replacement-bus not bus-replacement This is inconsistent but invert the word order in libraries for now --- app/configurations/config.default.js | 8 ++++---- .../packages/digitransit-component-icon/src/index.js | 2 +- .../digitransit-component-suggestion-item/src/index.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/configurations/config.default.js b/app/configurations/config.default.js index eac280459c..953ab9ae56 100644 --- a/app/configurations/config.default.js +++ b/app/configurations/config.default.js @@ -377,16 +377,16 @@ export default { iconColors: { 'mode-airplane': '#0046ad', 'mode-bus': '#007ac9', + 'mode-replacement-bus': '#dc0451', 'mode-tram': '#008151', - 'mode-subway': '#CA4000', + 'mode-subway': '#ca4000', 'mode-rail': '#8c4799', - 'mode-ferry': '#007A97', + 'mode-ferry': '#007a97', 'mode-ferry-external': '#666666', 'mode-citybike': '#f2b62d', 'mode-citybike-secondary': '#333333', - 'mode-scooter': '#C5CAD2', + 'mode-scooter': '#c5cad2', 'mode-taxi': '#647693', - 'mode-replacement-bus': '#DC0451', 'mode-bikepark': '#f2b62d', 'mode-carpark': '#007ac9', }, diff --git a/digitransit-component/packages/digitransit-component-icon/src/index.js b/digitransit-component/packages/digitransit-component-icon/src/index.js index c6e73f539b..be4b7c7ad6 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/index.js +++ b/digitransit-component/packages/digitransit-component-icon/src/index.js @@ -114,7 +114,7 @@ const iconMap = { // HSL 'bus-hsl': BusHsl, 'bus-local-hsl': BusLocalHsl, - 'bus-replacement-hsl': BusReplacementHsl, + 'replacement-bus-hsl': BusReplacementHsl, 'ferry-hsl': FerryHsl, 'rail-hsl': RailHsl, 'speedtram-hsl': SpeedTramHsl, diff --git a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js index 1058f27733..efa1b6d295 100644 --- a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js +++ b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js @@ -8,7 +8,7 @@ import styles from './helpers/styles.scss'; const extendedModes = { 702: 'bus-express', 704: 'bus-local', - 714: 'bus-replacement', + 714: 'replacement-bus', 900: 'speedtram', }; @@ -17,7 +17,7 @@ const iconColors = { 'mode-bus': '#007ac9', 'mode-bus-express': '#ca4000', 'mode-bus-local': '#007ac9', - 'mode-bus-replacement': '#dc0451', + 'mode-replacement-bus': '#dc0451', 'mode-rail': '#8c4799', 'mode-tram': '#008151', 'mode-speedtram': '#007e79', From ef8579bff9fa8fc27f7cc33e16f4992fb777146c Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 15:46:56 +0200 Subject: [PATCH 113/129] chore: optimize Icon library svgs --- .../src/assets/ferry-stop-digitransit.svg | 16 +++++----------- .../src/assets/ferry-stop-hsl.svg | 11 +++-------- .../src/assets/funicular-stop.svg | 4 +--- .../src/assets/map.svg | 2 -- .../src/assets/search-streetname.svg | 2 +- .../src/assets/star.svg | 2 -- .../src/assets/subway.svg | 2 -- .../src/assets/trash.svg | 2 -- .../src/assets/viapoint.svg | 2 +- 9 files changed, 11 insertions(+), 32 deletions(-) diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-stop-digitransit.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-stop-digitransit.svg index 3cd7c27614..9632e03a27 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-stop-digitransit.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-stop-digitransit.svg @@ -1,13 +1,7 @@ - - - - - - - - - - - + + + + + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-stop-hsl.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-stop-hsl.svg index f82193af1d..d55212217d 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-stop-hsl.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/ferry-stop-hsl.svg @@ -1,10 +1,5 @@ - - - - - - - - + + + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/funicular-stop.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/funicular-stop.svg index faa4881527..120a48492e 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/funicular-stop.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/funicular-stop.svg @@ -1,7 +1,5 @@ - - - + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/map.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/map.svg index 69892011fc..ae694b4bca 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/map.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/map.svg @@ -1,7 +1,5 @@ - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/search-streetname.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/search-streetname.svg index 2d48c42016..f453d68a90 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/search-streetname.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/search-streetname.svg @@ -1,3 +1,3 @@ - + diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/star.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/star.svg index 20b08b16a3..5257073d60 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/star.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/star.svg @@ -1,6 +1,4 @@ - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/subway.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/subway.svg index aa72345469..0e5f597939 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/subway.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/subway.svg @@ -1,6 +1,4 @@ - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/trash.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/trash.svg index 411b77cc99..4665fe3bd0 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/trash.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/trash.svg @@ -1,7 +1,5 @@ - - diff --git a/digitransit-component/packages/digitransit-component-icon/src/assets/viapoint.svg b/digitransit-component/packages/digitransit-component-icon/src/assets/viapoint.svg index fddd435b2a..0212ee6eb8 100644 --- a/digitransit-component/packages/digitransit-component-icon/src/assets/viapoint.svg +++ b/digitransit-component/packages/digitransit-component-icon/src/assets/viapoint.svg @@ -1,3 +1,3 @@ - + From 6c047b1467b7a4f8f6cde688906360c39185dd86 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 16:04:39 +0200 Subject: [PATCH 114/129] feat: map park colors --- .../digitransit-component-suggestion-item/src/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js index efa1b6d295..2269e0586f 100644 --- a/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js +++ b/digitransit-component/packages/digitransit-component-suggestion-item/src/index.js @@ -27,6 +27,8 @@ const iconColors = { 'mode-funicular': '#ff00ff', 'mode-citybike': '#f2b62d', 'mode-citybike-secondary': '#333333', + 'mode-bikepark': '#f2b62d', + 'mode-carpark': '#007ac9', }; const getRouteMode = (props, set) => { @@ -80,6 +82,7 @@ function getAriaDescription(ariaContentArray) { } const stopLayers = ['station', 'stop']; +const parkLayers = ['bikepark', 'carpark']; const noTheme = ['subway', 'airplane', 'funicular']; // common icon in all themes function getIconProps(mode, isStop, modeSet) { @@ -116,11 +119,8 @@ function getIconProperties(item, modeSet, stopCode, modes) { if (item.properties.layer === 'bikestation') { return [`citybike-stop-${modeSet}`, 'mode-citybike']; } - if (item.properties.layer === 'carpark') { - return [`carpark`]; - } - if (item.properties.layer === 'bikepark') { - return [`bikepark`]; + if (parkLayers.includes(item.properties.layer)) { + return [item.properties.layer, `mode-${item.properties.layer}`]; } if ( item.properties.label?.split(',').length === 1 && From bd0e664e6407cc96d3135cd60a7ef2c60b917db3 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 17:27:43 +0200 Subject: [PATCH 115/129] chore: enable parks for HSL --- app/configurations/config.hsl.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/configurations/config.hsl.js b/app/configurations/config.hsl.js index b3f7a3d6a9..af0b6bc8c0 100644 --- a/app/configurations/config.hsl.js +++ b/app/configurations/config.hsl.js @@ -568,6 +568,8 @@ export default { 'rail', 'ferry', 'citybike', + 'bikepark', + 'carpark', ], narrowNearYouButtons: true, From 97aea3ea2c525d7c4dc3c0d05c3b20ff5db1b7fc Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 17:33:37 +0200 Subject: [PATCH 116/129] chore: update nearyou translations --- .../src/helpers/translations.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js b/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js index ec56bca811..6f55c13bfa 100644 --- a/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js +++ b/digitransit-component/packages/digitransit-component-control-panel/src/helpers/translations.js @@ -37,8 +37,8 @@ const translations = { rail: 'Junat ja lähiasemat kartalla', subway: 'Metrot ja lähiasemat kartalla', tram: 'Raitiovaunut ja lähipysäkit kartalla', - bikepark: 'Lähimmät pyöräparkit', - carpark: 'Lähimmät autoparkit', + bikepark: 'Lähimmät liityntäpysäköinnit pyörille', + carpark: 'Lähimmät liityntäpysäköinnit autoille', title: 'Lähelläsi', }, }, @@ -65,8 +65,8 @@ const translations = { rail: 'Tåg och stationer på kartan', subway: 'Metro och stationer på kartan', tram: 'Spårvagnar och hållplatser på kartan', - bikepark: 'Närmaste cykelparkering', - carpark: 'Närmaste bilparkering', + bikepark: 'Närmaste anslutningsparkering för cyklar', + carpark: 'Närmaste anslutningsparkering för bilar', title: 'Nära dig', }, }, From babc42c71de62ee10481e4eccc53bdfd8ff8c574 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Wed, 7 Jan 2026 19:59:56 +0200 Subject: [PATCH 117/129] fix: return null not undefined from react component --- app/component/nearyou/CityBikeInfo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/component/nearyou/CityBikeInfo.js b/app/component/nearyou/CityBikeInfo.js index cc1f0da127..9fb0268e7f 100644 --- a/app/component/nearyou/CityBikeInfo.js +++ b/app/component/nearyou/CityBikeInfo.js @@ -36,7 +36,7 @@ const CityBikeInfo = ({ lang }, { config }) => { ).url; if (!showCityBikeTeaser || !(buyUrl || networkUrl)) { - return undefined; + return null; } return (
From 30b29d38f91533d337cb168ede38d2dff970ddf0 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 8 Jan 2026 08:46:37 +0200 Subject: [PATCH 118/129] Reapply "Reapply "Reapply "Merge pull request #5584 from HSLdevcom/AB#203""" This reverts commit c11a5451b177cc0233496ed8f84b29a064c72763. --- app/configurations/config.hsl.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/configurations/config.hsl.js b/app/configurations/config.hsl.js index cb9482a85c..0ddd8c63bb 100644 --- a/app/configurations/config.hsl.js +++ b/app/configurations/config.hsl.js @@ -116,6 +116,7 @@ export default { defaultSettings: { walkSpeed: 1.28, showBikeAndParkItineraries: true, + transferPenalty: 120, }, /** From 577222ac332354ce6fb79e22b4703ef17f6543ad Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 8 Jan 2026 08:46:51 +0200 Subject: [PATCH 119/129] Reapply "Merge pull request #5604 from HSLdevcom/AB#150-enable-car-ferries-for-kela" This reverts commit ff0a3e759625a6315920aa72b50e3b8171bdab15. --- app/component/itinerary/StreetModeSelectorButton.js | 2 +- app/configurations/config.kela.js | 4 +++- app/util/legUtils.js | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/component/itinerary/StreetModeSelectorButton.js b/app/component/itinerary/StreetModeSelectorButton.js index f9ebaf11b9..540879aacc 100644 --- a/app/component/itinerary/StreetModeSelectorButton.js +++ b/app/component/itinerary/StreetModeSelectorButton.js @@ -42,7 +42,7 @@ export default function StreetModeSelectorButton( break; case streetHash.carAndVehicle: distance = displayDistance( - getTotalDrivingDistance(itinerary), + getTotalDrivingDistance(itinerary, config), config, intl.formatNumber, ); diff --git a/app/configurations/config.kela.js b/app/configurations/config.kela.js index bd98d4d70f..f217b4a0d9 100644 --- a/app/configurations/config.kela.js +++ b/app/configurations/config.kela.js @@ -49,7 +49,9 @@ export default { }, ], }, - + carBoardingModes: { + FERRY: { showNotification: false }, + }, transportModes: { citybike: { availableForSelection: false, diff --git a/app/util/legUtils.js b/app/util/legUtils.js index 966527156e..8058a877f4 100644 --- a/app/util/legUtils.js +++ b/app/util/legUtils.js @@ -528,7 +528,11 @@ export function getTotalBikingDistance(itinerary) { return sumDistances(itinerary.legs.filter(isBikingLeg)); } -export function getTotalDrivingDistance(itinerary) { +export function getTotalDrivingDistance(itinerary, config = {}) { + // Don't rely only driving legs when calculating the one way journey. + if (config.emphasizeOneWayJourney) { + return sumDistances(itinerary.legs); + } return sumDistances(itinerary.legs.filter(isDrivingLeg)); } From c643e807791db112dd01f62a8c55d5fe6bc7646a Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 8 Jan 2026 08:49:16 +0200 Subject: [PATCH 120/129] chore: 3 min transafer penalty for HSL --- app/configurations/config.hsl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/configurations/config.hsl.js b/app/configurations/config.hsl.js index 0ddd8c63bb..5d246b2e22 100644 --- a/app/configurations/config.hsl.js +++ b/app/configurations/config.hsl.js @@ -116,7 +116,7 @@ export default { defaultSettings: { walkSpeed: 1.28, showBikeAndParkItineraries: true, - transferPenalty: 120, + transferPenalty: 180, }, /** From 36ebb2e3680581a74604c7427c95463e1b2b084a Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 8 Jan 2026 09:20:09 +0200 Subject: [PATCH 121/129] fix: react key props --- app/component/nearyou/NearYouContainer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index 07251eac05..242630ae91 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -155,7 +155,7 @@ function NearYouContainer( case 'VehicleParking': return (
{loading === 1 && ( -
+
)} -
+
{items}
{loading === 2 && ( -
+
)} From f80f26bde5acce4f39eab328b37b90d0f6a49f1a Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 8 Jan 2026 10:26:34 +0200 Subject: [PATCH 122/129] fix: allow map rendering without props from favorite query --- .../nearyou/NearYouFavouritesMapContainer.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/component/nearyou/NearYouFavouritesMapContainer.js b/app/component/nearyou/NearYouFavouritesMapContainer.js index 094d8f8622..4cad933774 100644 --- a/app/component/nearyou/NearYouFavouritesMapContainer.js +++ b/app/component/nearyou/NearYouFavouritesMapContainer.js @@ -12,7 +12,11 @@ import { function NearYouFavouritesMapContainer(props) { const { stops, stations, vehicleStations, position } = props; - const favs = [...stops, ...stations, ...vehicleStations]; + const favs = [ + ...(stops || []), + ...(stations || []), + ...(vehicleStations || []), + ]; const edges = favs .filter(s => s) .map(stop => { @@ -29,12 +33,18 @@ function NearYouFavouritesMapContainer(props) { } NearYouFavouritesMapContainer.propTypes = { - stops: PropTypes.arrayOf(stopShape).isRequired, - stations: PropTypes.arrayOf(stationShape).isRequired, - vehicleStations: PropTypes.arrayOf(vehicleRentalStationShape).isRequired, + stops: PropTypes.arrayOf(stopShape), + stations: PropTypes.arrayOf(stationShape), + vehicleStations: PropTypes.arrayOf(vehicleRentalStationShape), position: locationShape.isRequired, }; +NearYouFavouritesMapContainer.defaultProps = { + stops: [], + stations: [], + vehicleStations: [], +}; + const containerComponent = createFragmentContainer( NearYouFavouritesMapContainer, { From 97cb2582c51fb8c14c6fdee58f992dc2857e6eff Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 8 Jan 2026 10:28:07 +0200 Subject: [PATCH 123/129] fix: more query fields for parking --- app/component/nearyou/NearYouContainer.js | 1 + app/component/nearyou/ParkNearYou.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index 242630ae91..3e1d1bb748 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -299,6 +299,7 @@ const refetchContainer = createPaginationContainer( } ... on VehicleParking { ...ParkNearYou_park + name vehicleParkingId } ... on Stop { diff --git a/app/component/nearyou/ParkNearYou.js b/app/component/nearyou/ParkNearYou.js index 0d3fb311a4..fae4c1e301 100644 --- a/app/component/nearyou/ParkNearYou.js +++ b/app/component/nearyou/ParkNearYou.js @@ -71,6 +71,7 @@ const containerComponent = createRefetchContainer( park: graphql` fragment ParkNearYou_park on VehicleParking { ...ParkContainer_vehicleParking + name vehicleParkingId } `, @@ -79,6 +80,7 @@ const containerComponent = createRefetchContainer( query ParkNearYouRefetchQuery($vehicleParkingId: String!) { vehicleParking(id: $vehicleParkingId) { ...ParkNearYou_park + name } } `, From ea2a8556ced7e59e301653e8a7a7b4d3a1b7396a Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 8 Jan 2026 10:57:55 +0200 Subject: [PATCH 124/129] chore: tune query fields It seems that inclusion of a fragement with alias fields does not work --- app/component/nearyou/NearYouContainer.js | 2 ++ app/component/nearyou/ParkNearYou.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index 3e1d1bb748..505ea353a7 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -300,6 +300,8 @@ const refetchContainer = createPaginationContainer( ... on VehicleParking { ...ParkNearYou_park name + lat + lon vehicleParkingId } ... on Stop { diff --git a/app/component/nearyou/ParkNearYou.js b/app/component/nearyou/ParkNearYou.js index fae4c1e301..68a2148d08 100644 --- a/app/component/nearyou/ParkNearYou.js +++ b/app/component/nearyou/ParkNearYou.js @@ -72,6 +72,8 @@ const containerComponent = createRefetchContainer( fragment ParkNearYou_park on VehicleParking { ...ParkContainer_vehicleParking name + lat + lon vehicleParkingId } `, @@ -80,7 +82,6 @@ const containerComponent = createRefetchContainer( query ParkNearYouRefetchQuery($vehicleParkingId: String!) { vehicleParking(id: $vehicleParkingId) { ...ParkNearYou_park - name } } `, From 8f4efcd506f9e372bf1271badd994f4ba2eb83c8 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 8 Jan 2026 11:49:08 +0200 Subject: [PATCH 125/129] fix: relay wants null not undefined from query --- app/component/nearyou/MapWrapper.js | 60 +++++++++++++++++------------ 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/app/component/nearyou/MapWrapper.js b/app/component/nearyou/MapWrapper.js index a92112fa22..5387bde0b8 100644 --- a/app/component/nearyou/MapWrapper.js +++ b/app/component/nearyou/MapWrapper.js @@ -59,21 +59,28 @@ export default function MapWrapper( `} variables={variables} environment={relayEnvironment} - render={({ props }) => ( - - )} + render={({ props }) => { + const mapProps = props || { + stops: null, + stations: null, + vehicleStations: null, + }; + return ( + + ); + }} /> ); } @@ -139,16 +146,19 @@ export default function MapWrapper( `} variables={variables} environment={relayEnvironment} - render={({ props }) => ( - - )} + render={({ props }) => { + const mapProps = props || { stops: null, prioritizedStops: null }; + return ( + + ); + }} /> ); } From aaf1f9068bbf8804987b5fe435e093aa0f98ce61 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 8 Jan 2026 14:08:49 +0200 Subject: [PATCH 126/129] feat: optional park info --- app/component/ParkAndRideContent.js | 56 ++++++++++++++++------------ app/component/nearyou/ParkNearYou.js | 6 ++- 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/app/component/ParkAndRideContent.js b/app/component/ParkAndRideContent.js index 898202535e..c8c7b33b0f 100644 --- a/app/component/ParkAndRideContent.js +++ b/app/component/ParkAndRideContent.js @@ -11,14 +11,16 @@ import { PREFIX_BIKEPARK, PREFIX_CARPARK } from '../util/path'; import { DATE_FORMAT } from '../constants'; function ParkAndRideContent( - { vehicleParking, error, currentLanguage }, + { vehicleParking, error, currentLanguage, mode, showInfo }, { config, intl, router, match }, ) { // throw error when relay query fails if (error) { throw error.message; } - const bikePark = match.location.pathname.includes(PREFIX_BIKEPARK); + const bikePark = mode + ? mode === 'BIKEPARK' + : match.location.pathname.includes(PREFIX_BIKEPARK); if (!vehicleParking) { const path = bikePark ? PREFIX_BIKEPARK : PREFIX_CARPARK; router.replace(`/${path}`); @@ -205,29 +207,31 @@ function ParkAndRideContent( )}
-
-

- {intl.formatMessage({ id: `${prePostFix}-disclaimer-header` })} -

-
- {intl.formatMessage({ id: `${prePostFix}-disclaimer` })} + {showInfo && ( +
+

+ {intl.formatMessage({ id: `${prePostFix}-disclaimer-header` })} +

+
+ {intl.formatMessage({ id: `${prePostFix}-disclaimer` })} +
+ {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} + {config.parkAndRide.url && ( + { + e.stopPropagation(); + }} + className="external-link" + href={config.parkAndRide.url[lang]} + target="_blank" + rel="noreferrer" + > + {intl.formatMessage({ id: `${prePostFix}-disclaimer-link` })}{' '} + › + + )}
- {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} - {config.parkAndRide.url && ( - { - e.stopPropagation(); - }} - className="external-link" - href={config.parkAndRide.url[lang]} - target="_blank" - rel="noreferrer" - > - {intl.formatMessage({ id: `${prePostFix}-disclaimer-link` })}{' '} - › - - )} -
+ )}
); } @@ -236,11 +240,15 @@ ParkAndRideContent.propTypes = { vehicleParking: parkShape, error: errorShape, currentLanguage: PropTypes.string.isRequired, + mode: PropTypes.oneOf(['CARPARK', 'BIKEPARK']), + showInfo: PropTypes.bool, }; ParkAndRideContent.defaultProps = { vehicleParking: undefined, error: undefined, + mode: undefined, + showInfo: true, }; ParkAndRideContent.contextTypes = { diff --git a/app/component/nearyou/ParkNearYou.js b/app/component/nearyou/ParkNearYou.js index 68a2148d08..e15eb8bfb2 100644 --- a/app/component/nearyou/ParkNearYou.js +++ b/app/component/nearyou/ParkNearYou.js @@ -46,7 +46,11 @@ const ParkNearYou = ({ park, relay, currentTime, isParentTabActive, mode }) => {
- +
); From 7ee124913c0ec27fed9299ca2968e87a543a189e Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 8 Jan 2026 14:39:34 +0200 Subject: [PATCH 127/129] fix: back button is optional in park card --- app/component/ParkAndRideContent.js | 5 ++++- app/component/ParkOrStationHeader.js | 14 +++++++++----- app/component/nearyou/ParkNearYou.js | 12 ++++++------ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/app/component/ParkAndRideContent.js b/app/component/ParkAndRideContent.js index c8c7b33b0f..e6fdf43f9b 100644 --- a/app/component/ParkAndRideContent.js +++ b/app/component/ParkAndRideContent.js @@ -11,7 +11,7 @@ import { PREFIX_BIKEPARK, PREFIX_CARPARK } from '../util/path'; import { DATE_FORMAT } from '../constants'; function ParkAndRideContent( - { vehicleParking, error, currentLanguage, mode, showInfo }, + { vehicleParking, error, currentLanguage, mode, showInfo, backButton }, { config, intl, router, match }, ) { // throw error when relay query fails @@ -148,6 +148,7 @@ function ParkAndRideContent(
@@ -242,6 +243,7 @@ ParkAndRideContent.propTypes = { currentLanguage: PropTypes.string.isRequired, mode: PropTypes.oneOf(['CARPARK', 'BIKEPARK']), showInfo: PropTypes.bool, + backButton: PropTypes.bool, }; ParkAndRideContent.defaultProps = { @@ -249,6 +251,7 @@ ParkAndRideContent.defaultProps = { error: undefined, mode: undefined, showInfo: true, + backButton: true, }; ParkAndRideContent.contextTypes = { diff --git a/app/component/ParkOrStationHeader.js b/app/component/ParkOrStationHeader.js index 01cb60afb4..4f8009ae96 100644 --- a/app/component/ParkOrStationHeader.js +++ b/app/component/ParkOrStationHeader.js @@ -3,17 +3,17 @@ import React, { useEffect, useState } from 'react'; import { FormattedMessage } from 'react-intl'; import { configShape } from '../util/shapes'; import StopCode from './StopCode'; +import withBreakpoint from '../util/withBreakpoint'; import BackButton from './BackButton'; import { getJson } from '../util/xhrPromise'; import getZoneId from '../util/zoneIconUtils'; import ZoneIcon from './ZoneIcon'; -import withBreakpoint from '../util/withBreakpoint'; import { hasVehicleRentalCode } from '../util/vehicleRentalUtils'; import { getIdWithoutFeed } from '../util/feedScopedIdUtils'; import FavouriteVehicleRentalStationContainer from './FavouriteVehicleRentalStationContainer'; const ParkOrBikeStationHeader = ( - { parkOrStation, breakpoint, parkType }, + { parkOrStation, breakpoint, parkType, backButton }, { config }, ) => { const [zoneId, setZoneId] = useState(undefined); @@ -48,7 +48,7 @@ const ParkOrBikeStationHeader = ( return (
- {breakpoint === 'large' && ( + {breakpoint === 'large' && backButton && ( { }} to={`/${prefix}/${park.vehicleParkingId}`} > -

{park.name}

+
-
); From c3287225d759dd26307662ef4917c760867dceee Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 8 Jan 2026 15:14:02 +0200 Subject: [PATCH 128/129] fix: remove double shadow in park and rental mobile views --- app/component/bike-park-rental-station.scss | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/component/bike-park-rental-station.scss b/app/component/bike-park-rental-station.scss index 1e153d99ea..1569ca4409 100644 --- a/app/component/bike-park-rental-station.scss +++ b/app/component/bike-park-rental-station.scss @@ -2,11 +2,7 @@ .bike-station-page-container { height: calc(100% - 20rem); padding: 18px 1.563em 2em; - background-color: white; - border-radius: 15px 15px 0 0; - box-shadow: 0 -5px 5px 0 rgba(0, 0, 0, 0.2); position: relative; - top: -15px; margin: 0; .citybike-full-station-guide { From 73d3c7b782e86a93bdded1972ccc31edf59c32d1 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Thu, 8 Jan 2026 15:52:44 +0200 Subject: [PATCH 129/129] fix: add all relevant parking props to nearyou query --- app/component/nearyou/NearYouContainer.js | 3 --- app/component/nearyou/ParkNearYou.js | 11 ++++++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/component/nearyou/NearYouContainer.js b/app/component/nearyou/NearYouContainer.js index 505ea353a7..242630ae91 100644 --- a/app/component/nearyou/NearYouContainer.js +++ b/app/component/nearyou/NearYouContainer.js @@ -299,9 +299,6 @@ const refetchContainer = createPaginationContainer( } ... on VehicleParking { ...ParkNearYou_park - name - lat - lon vehicleParkingId } ... on Stop { diff --git a/app/component/nearyou/ParkNearYou.js b/app/component/nearyou/ParkNearYou.js index ffb004cf73..db1261133b 100644 --- a/app/component/nearyou/ParkNearYou.js +++ b/app/component/nearyou/ParkNearYou.js @@ -75,10 +75,19 @@ const containerComponent = createRefetchContainer( park: graphql` fragment ParkNearYou_park on VehicleParking { ...ParkContainer_vehicleParking + vehicleParkingId name lat lon - vehicleParkingId + availability { + bicycleSpaces + carSpaces + } + parkCapacity: capacity { + carSpaces + } + tags + realtime } `, },