Skip to content

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

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

alec-georgoff
Copy link
Collaborator

Description:

This PR adds functionality to automatically select the rental vehicle mode in the trip planner when starting a trip from a selected rental vehicle in Nearby View. The logic respects the existing trip modes that are selected.

PR Checklist:

  • Does the code follow accessibility standards (WCAG 2.1 AA Compliant)?
  • Are all languages supported (Internationalization/Localization)?
  • Are appropriate Typescript types implemented?

@@ -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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One weird quirk...I realized after writing this that we don't actually specify that this logic should only fire when the from is clicked on a rental vehicle popup. And yet, when I click the from on other popups (like a stop), it doesn't enable the rental vehicle mode. I'm not really sure why...

@alec-georgoff alec-georgoff marked this pull request as ready for review August 6, 2025 22:05
Copy link
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few architectural questions

@@ -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]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we not use find instead?

const overlayTypes = overlays
?.filter((overlay) => overlay?.type === 'otp2')?.[0]
?.layers?.map((layer) => layer?.type)
const handleSetLocation = (location: MapLocationActionArg) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one approach, but could we not fix this by adjusting query params? What if we check for map state in the places where query params are set? Might that be a better separation of concerns than setting modes within the map component?

@@ -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,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a huge fan of importing query info into the map component...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants