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

Add configuration types. #1017

Merged
merged 20 commits into from
Oct 5, 2023
Merged

Add configuration types. #1017

merged 20 commits into from
Oct 5, 2023

Conversation

binh-dam-ibigroup
Copy link
Collaborator

@binh-dam-ibigroup binh-dam-ibigroup commented Sep 28, 2023

Description

This PR introduces types used in the app configuration (config.yml), and a partial redux state type is added.
The new types are not necessarily exhaustive and may not include obsolete config properties still in example-config.yml.
A few component files have been changed just to give an idea of the direction taken.

Note that calltaker config types are still to be implemented.

PR Checklist

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

Copy link
Member

@AdrianaCeric AdrianaCeric left a comment

Choose a reason for hiding this comment

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

I think this looks good. Grouping the types in a consistent way and in one file is a good idea. I just had a few questions:

@@ -89,7 +90,7 @@ class AppMenu extends Component<

_triggerPopup = () => {
const { popupTarget, setPopupContent } = this.props
setPopupContent(popupTarget)
if (popupTarget) setPopupContent(popupTarget)
Copy link
Member

Choose a reason for hiding this comment

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

Why is this change added?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

popupTarget is optional, so TypeScript forces this truthy check before triggering the popup.

const modeColors: ModeColors = {}
transitModes.forEach((mode: ConfiguredTransitMode) => {
state.otp.config.modes.transitModes.forEach((mode) => {
Copy link
Member

Choose a reason for hiding this comment

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

Do you want to also add the
const { config: otpConfig } = state.otp here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not needed, in this file, it is used only on this line.

@@ -95,10 +95,3 @@ export type SetViewedRouteHandler = (route?: ViewedRouteState) => void
export type SetViewedStopHandler = (payload: { stopId: string } | null) => void

export type SetLocationHandler = (payload: MapLocationActionArg) => void

export interface ConfiguredTransitMode {
Copy link
Member

Choose a reason for hiding this comment

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

Why is this interface being removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I moved it to config-types.ts, and it is now called TransitModeConfig.

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.

This is some great cleanup, thanks for all your work!

Comment on lines -352 to -355
# Allows calorie counts to be hidden
displayCalories: true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was this behavior removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Displaying calories was completely removed from OTP-UI, so this doesn't apply anymore.

Comment on lines -23 to -24
displayCalories:
typeof itinerary?.displayCalories === 'boolean'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why was this removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Displaying calories was completely removed from OTP-UI, so this doesn't apply anymore.

@binh-dam-ibigroup binh-dam-ibigroup merged commit 0537e10 into dev Oct 5, 2023
7 checks passed
@binh-dam-ibigroup binh-dam-ibigroup deleted the config-typescript branch October 5, 2023 20:51
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