-
Notifications
You must be signed in to change notification settings - Fork 58
Select scooter mode when starting trip from scooter in nearby view #1449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 3 commits
5cb8ab5
85993ff
29d5d3f
4605c6e
18a74a4
c58f43f
0302899
c40127a
c9da892
d3d2245
310a889
3eff88c
3f3664c
7dfffc1
672843a
2796903
1cd63d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,8 @@ import { connect } from 'react-redux' | |
| import { GeolocateControl, NavigationControl } from 'react-map-gl' | ||
| import { getCurrentDate } from '@opentripplanner/core-utils/lib/time' | ||
| import { injectIntl } from 'react-intl' | ||
| import { MapLocationActionArg } from '@opentripplanner/types' | ||
| import { QueryParamChangeEvent } from '@opentripplanner/trip-form/lib/types' | ||
| import BaseMap from '@opentripplanner/base-map' | ||
| import generateOTP2TileLayers from '@opentripplanner/otp2-tile-overlay' | ||
| import React, { Component } from 'react' | ||
|
|
@@ -21,7 +23,9 @@ import { ComponentContext } from '../../util/contexts' | |
| import { getActiveItinerary, getActiveSearch } from '../../util/state' | ||
| import { getCurrentPosition } from '../../actions/location' | ||
| import { MainPanelContent } from '../../actions/ui-constants' | ||
| import { onSettingsUpdate } from '../form/util' | ||
| import { setLocation, setMapPopupLocationAndGeocode } from '../../actions/map' | ||
| import { setQueryParam } from '../../actions/form' | ||
| import { setViewedStop } from '../../actions/ui' | ||
| import { updateOverlayVisibility } from '../../actions/config' | ||
| import TransitOperatorIcons from '../util/connected-transit-operator-icons' | ||
|
|
@@ -278,13 +282,15 @@ class DefaultMap extends Component { | |
| carRentalQuery, | ||
| carRentalStations, | ||
| config, | ||
| currentQuery, | ||
| getCurrentPosition, | ||
| intl, | ||
| itinerary, | ||
| mapConfig, | ||
| nearbyViewActive, | ||
| pending, | ||
| setLocation, | ||
| setQueryParam, | ||
| setViewedStop, | ||
| vehicleRentalQuery, | ||
| vehicleRentalStations, | ||
|
|
@@ -319,6 +325,23 @@ class DefaultMap extends Component { | |
| const baseLayerUrls = baseLayersWithNames?.map((bl) => bl.url) | ||
| const baseLayerNames = baseLayersWithNames?.map((bl) => bl.name) | ||
|
|
||
| const overlayTypes = overlays | ||
| ?.filter((overlay) => overlay?.type === 'otp2')?.[0] | ||
alec-georgoff marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ?.layers?.map((layer) => layer?.type) | ||
| const handleSetLocation = (location: MapLocationActionArg) => { | ||
|
||
| if (overlayTypes && overlayTypes.includes('rentalVehicles')) { | ||
| let selectedModeButtons = currentQuery.modeButtons ?? '' | ||
| // if selectedModeButtons is undefined, the mode buttons are in their default state, which includes transit | ||
| if (selectedModeButtons.length === 0) | ||
| selectedModeButtons = 'transit_bike_rent' | ||
| else if (!selectedModeButtons.includes('bike_rent')) | ||
| selectedModeButtons += '_bike_rent' | ||
| const evt: QueryParamChangeEvent = { modeButtons: selectedModeButtons } | ||
| onSettingsUpdate(setQueryParam)(evt) | ||
| } | ||
| setLocation(location) | ||
| } | ||
|
|
||
| const routeBasedTransitVehicleOverlayNameOverride = | ||
| overlays?.find((o) => o.type === 'vehicles-one-route') || undefined | ||
|
|
||
|
|
@@ -435,7 +458,7 @@ class DefaultMap extends Component { | |
| name: getLayerName(l, config, intl) || l.network || l.type | ||
| })), | ||
| vectorTilesEndpoint, | ||
| setLocation, | ||
| handleSetLocation, | ||
| setViewedStop, | ||
| viewedRouteStops, | ||
| config.companies, | ||
|
|
@@ -486,6 +509,7 @@ const mapStateToProps = (state) => { | |
| bikeRentalStations: state.otp.overlay.bikeRental.stations, | ||
| carRentalStations: state.otp.overlay.carRental.stations, | ||
| config: state.otp.config, | ||
| currentQuery: state.otp.currentQuery, | ||
|
||
| itinerary: getActiveItinerary(state), | ||
| mapConfig: state.otp.config.map, | ||
| nearbyViewActive: | ||
|
|
@@ -504,6 +528,7 @@ const mapDispatchToProps = { | |
| getCurrentPosition, | ||
| setLocation, | ||
| setMapPopupLocationAndGeocode, | ||
| setQueryParam, | ||
| setViewedStop, | ||
| updateOverlayVisibility, | ||
| vehicleRentalQuery | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.