Skip to content
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

allow multiple transport modes to be specified in a single transportmode #1282

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

daniel-heppner-ibigroup
Copy link
Contributor

Description:
We need to allow several modes to be grouped together under a single icon. This will allow combining rail modes (like TRAM, RAIL, SUBWAY) together or bus modes (BUS, TROLLEYBUS) together under a single checkbox.
Support for this already existed in OTP UI so we are just enabling support for it in OTP RR with this change.

@daniel-heppner-ibigroup daniel-heppner-ibigroup force-pushed the allow-multiple-transport-modes branch from cd81a2f to 6c100ce Compare October 8, 2024 21:13
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.

Works great!

- mode: ["TROLLEYBUS", "BUS"]
# When mode is an array an overrideMode must be provided.
# This specifies the displayed mode used for icon and URL param.
overrideMode: BUS
Copy link
Collaborator

Choose a reason for hiding this comment

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

This key title is confusing. But I can't think of a better one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was trying not to make it a breaking change.

Copy link
Collaborator

Choose a reason for hiding this comment

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

we could've done a thing where we just use the first item in the array as the override but this is fine too!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's not a bad idea! we'll see what second reviewer thinks

Copy link
Collaborator

Choose a reason for hiding this comment

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

The name can be confusing at first. Maybe change overrideMode to summaryMode or displayedMode but I don't feel strongly about it. It looks like branded names are already supported, so that should be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to keep it so we didn't change the config at all. I agree that the name choice wasn't great but I don't think it's worth updating now.

@@ -135,10 +135,18 @@ export function getInitialState(userDefinedConfig) {

const transitModeSettings = config?.modes?.transitModes.map((transitMode) => {
const { mode, overrideMode } = transitMode
if (Array.isArray(mode) && !overrideMode) {
console.warn(
Copy link
Collaborator

Choose a reason for hiding this comment

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

When this warning fires the entire app does still crash but I guess the warning is there so that's good enough

- mode: ["TROLLEYBUS", "BUS"]
# When mode is an array an overrideMode must be provided.
# This specifies the displayed mode used for icon and URL param.
overrideMode: BUS
Copy link
Collaborator

Choose a reason for hiding this comment

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

The name can be confusing at first. Maybe change overrideMode to summaryMode or displayedMode but I don't feel strongly about it. It looks like branded names are already supported, so that should be fine.

@daniel-heppner-ibigroup daniel-heppner-ibigroup merged commit 44d69dc into dev Oct 21, 2024
9 checks passed
@daniel-heppner-ibigroup daniel-heppner-ibigroup deleted the allow-multiple-transport-modes branch October 21, 2024 15:54
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.

3 participants