diff --git a/app/component/ItineraryPage.js b/app/component/ItineraryPage.js index ea8c1e26e9..de469e3006 100644 --- a/app/component/ItineraryPage.js +++ b/app/component/ItineraryPage.js @@ -971,7 +971,9 @@ class ItineraryPage extends React.Component { ]?.legs.some(leg => leg.from?.vehicleRentalStation); const mapLayerOptions = itineraryContainsDepartureFromVehicleRentalStation - ? addBikeStationMapForRentalVehicleItineraries(itineraries) + ? addBikeStationMapForRentalVehicleItineraries( + this.context.config.enableLockedMapLayers, + ) : this.props.mapLayerOptions; const objectsToHide = getRentalStationsToHideOnMap( @@ -1650,10 +1652,10 @@ class ItineraryPage extends React.Component { } } -const ItineraryPageWithBreakpoint = withBreakpoint(props => ( +const ItineraryPageWithBreakpoint = withBreakpoint((props, context) => ( {({ environment }) => ( - + )} )); @@ -1661,15 +1663,21 @@ const ItineraryPageWithBreakpoint = withBreakpoint(props => ( const ItineraryPageWithStores = connectToStores( ItineraryPageWithBreakpoint, ['MapLayerStore'], - ({ getStore }) => ({ + ({ config, getStore }) => ({ mapLayers: getStore('MapLayerStore').getMapLayers({ notThese: ['stop', 'citybike', 'vehicles'], }), - mapLayerOptions: getMapLayerOptions({ - lockedMapLayers: ['vehicles', 'citybike', 'stop'], - selectedMapLayers: ['vehicles'], - }), + mapLayerOptions: getMapLayerOptions( + { + lockedMapLayers: ['vehicles', 'citybike', 'stop'], + selectedMapLayers: ['vehicles'], + }, + config.enableLockedMapLayers, + ), }), + { + config: PropTypes.object, + }, ); const containerComponent = createRefetchContainer( diff --git a/app/component/ItineraryPageUtils.js b/app/component/ItineraryPageUtils.js index bae8d3d7e8..23a1833f43 100644 --- a/app/component/ItineraryPageUtils.js +++ b/app/component/ItineraryPageUtils.js @@ -322,11 +322,16 @@ export function updateClient(itineraryTopics, context) { startClient(itineraryTopics, context); } -export function addBikeStationMapForRentalVehicleItineraries() { - return getMapLayerOptions({ - lockedMapLayers: ['vehicles', 'citybike', 'stop'], - selectedMapLayers: ['vehicles', 'citybike'], - }); +export function addBikeStationMapForRentalVehicleItineraries( + enableLockedMapLayers, +) { + return getMapLayerOptions( + { + lockedMapLayers: ['vehicles', 'citybike', 'stop'], + selectedMapLayers: ['vehicles', 'citybike'], + }, + enableLockedMapLayers, + ); } /** diff --git a/app/component/StopsNearYouPage.js b/app/component/StopsNearYouPage.js index 83ed34c405..d3b8f238d7 100644 --- a/app/component/StopsNearYouPage.js +++ b/app/component/StopsNearYouPage.js @@ -105,10 +105,13 @@ class StopsNearYouPage extends React.Component { const showCityBikeTeaser = !readMessageIds.includes('citybike_teaser'); if (this.context.config.map.showLayerSelector) { const { mode } = this.props.match.params; - const mapLayerOptions = getMapLayerOptions({ - lockedMapLayers: ['vehicles', 'citybike', 'stop'], - selectedMapLayers: ['vehicles', mode.toLowerCase()], - }); + const mapLayerOptions = getMapLayerOptions( + { + lockedMapLayers: ['vehicles', 'citybike', 'stop'], + selectedMapLayers: ['vehicles', mode.toLowerCase()], + }, + this.context.config.enableLockedMapLayers, + ); this.setState({ showCityBikeTeaser, mapLayerOptions }); } else { this.setState({ showCityBikeTeaser }); @@ -197,10 +200,13 @@ class StopsNearYouPage extends React.Component { setMapLayerOptions = () => { const { mode } = this.props.match.params; - const mapLayerOptions = getMapLayerOptions({ - lockedMapLayers: ['vehicles', 'citybike', 'stop'], - selectedMapLayers: ['vehicles', mode.toLowerCase()], - }); + const mapLayerOptions = getMapLayerOptions( + { + lockedMapLayers: ['vehicles', 'citybike', 'stop'], + selectedMapLayers: ['vehicles', mode.toLowerCase()], + }, + this.context.config.enableLockedMapLayers, + ); this.setState({ mapLayerOptions }); }; diff --git a/app/component/map/RoutePageMap.js b/app/component/map/RoutePageMap.js index ab79034f7e..1b637ae519 100644 --- a/app/component/map/RoutePageMap.js +++ b/app/component/map/RoutePageMap.js @@ -183,14 +183,17 @@ class RoutePageMap extends React.Component { const RoutePageMapWithVehicles = connectToStores( withBreakpoint(RoutePageMap), ['RealTimeInformationStore', 'MapLayerStore'], - ({ getStore }, { trip }) => { + ({ config, getStore }, { trip }) => { const mapLayers = getStore('MapLayerStore').getMapLayers({ notThese: ['stop', 'vehicles'], }); - const mapLayerOptions = getMapLayerOptions({ - lockedMapLayers: ['vehicles', 'stop', 'citybike'], - selectedMapLayers: ['vehicles'], - }); + const mapLayerOptions = getMapLayerOptions( + { + lockedMapLayers: ['vehicles', 'stop', 'citybike'], + selectedMapLayers: ['vehicles'], + }, + config.enableLockedMapLayers, + ); if (trip) { const { vehicles } = getStore('RealTimeInformationStore'); const tripStart = getStartTime( @@ -227,6 +230,9 @@ const RoutePageMapWithVehicles = connectToStores( } return { mapLayers, mapLayerOptions }; }, + { + config: PropTypes.object, + }, ); export default createFragmentContainer(RoutePageMapWithVehicles, { diff --git a/app/component/map/StopPageMap.js b/app/component/map/StopPageMap.js index e57ed7535a..93a51a4570 100644 --- a/app/component/map/StopPageMap.js +++ b/app/component/map/StopPageMap.js @@ -236,10 +236,13 @@ const StopPageMapWithStores = connectToStores( } const mapLayers = getStore(MapLayerStore).getMapLayers(ml); const mode = getModeFromProps(props); - const mapLayerOptions = getMapLayerOptions({ - lockedMapLayers: ['vehicles', mode], - selectedMapLayers: ['vehicles', mode], - }); + const mapLayerOptions = getMapLayerOptions( + { + lockedMapLayers: ['vehicles', mode], + selectedMapLayers: ['vehicles', mode], + }, + config.enableLockedMapLayers, + ); return { locationState, currentTime, diff --git a/app/configurations/config.herrenberg.js b/app/configurations/config.herrenberg.js index a5b1e233cc..0298a57826 100644 --- a/app/configurations/config.herrenberg.js +++ b/app/configurations/config.herrenberg.js @@ -453,6 +453,8 @@ export default configMerger(parentConfig, { layers, + enableLockedMapLayers: false, + staticMessagesUrl: STATIC_MESSAGE_URL, featuresUrl: FEATURES_URL, diff --git a/app/util/mapLayerUtils.js b/app/util/mapLayerUtils.js index 568c29ffec..e95f9f04ef 100644 --- a/app/util/mapLayerUtils.js +++ b/app/util/mapLayerUtils.js @@ -94,7 +94,10 @@ export const isFeatureLayerEnabled = ( return isLayerEnabled(layerName, mapLayers); }; -export const getMapLayerOptions = (options = {}) => { +export const getMapLayerOptions = ( + options = {}, + enableLockedMapLayers = true, +) => { const layerOptions = { parkAndRide: { isLocked: false, @@ -147,7 +150,7 @@ export const getMapLayerOptions = (options = {}) => { }; lockedMapLayers.forEach(key => { // Stop keyword locks every mode - if (key === 'stop') { + if (enableLockedMapLayers && key === 'stop') { Object.keys(layerOptions[key]).forEach(subKey => { if (layerOptions[key][subKey]) { layerOptions[key][subKey].isLocked = true;