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

pull out modifications to the itinerary's data structure from React components #4772

Open
derhuerst opened this issue Mar 8, 2023 · 0 comments

Comments

@derhuerst
Copy link
Member

Currently, the components responsible for rendering itineraries (e.g. ItineraryLegs, WalkLeg, WaitLeg) contain complex logic that transforms each itinerary. For example, they

IMO a good example of how to move out such complex logic is the compressLegs(), which is being used by ItineraryLegs. There are probably other good examples!

This is a broader topic to discuss, but it seems like digitransit-ui de-facto has a slightly different semantic model of an itinerary than OTP. It might be worth it making this semantic model more explicit, e.g. by documenting it, adding mapping functions like digitransitItineraryFromOtpItinerary(); This potentially reduces the legibility of the code, though.

The following resources explain the problem and possible solutions in a general manner:

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

No branches or pull requests

2 participants