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

Refactor ItineraryBody so it can be formatted like the original ItineraryBody in otp-react-redux #97

Merged
merged 10 commits into from
Mar 26, 2020

Conversation

evansiroky
Copy link
Contributor

This PR adds and refactors a bunch of stuff so that the ItineraryBody component can be styled and rendered as close as possible to the original ItineraryBody component in otp-react-redux. This also introduces some breaking changes to improve code maintenance and avoid loading unnecessary components.

  • Creates stories for each of the mock itineraries with otp-rr styling
  • Extracts some individual components into single files to better organize things
  • Adds new props to the root component:
    • LineColumnContent
    • showLegIcon
    • showMapButtonColumn
    • TransitLegSubheader
  • Places all default components for slots into the defaults folder
  • BREAKING: does not automatically use the default components for each slot. It is now expected for the developer to include these on their own. Doing this allows the application to not have to load potentially unnecessary components and code.
  • Adds meaningful arguments when calling the frameLeg function (fixes Pass the leg index into frameLeg callback #94).

Copy link
Member

@fpurcell fpurcell left a comment

Choose a reason for hiding this comment

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

Hey Evan...the last leg of the itinerary has some null frameLeg info. Otherwise, this is great.

Screen Shot 2020-03-25 at 1 46 58 AM

Copy link
Member

@fpurcell fpurcell left a comment

Choose a reason for hiding this comment

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

BTW, seems pretty consistent across itins that that last leg has nulls...
Screen Shot 2020-03-25 at 1 51 27 AM

Copy link
Member

@fpurcell fpurcell left a comment

Choose a reason for hiding this comment

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

Could you add / adjust Storys to demonstrate 3 things:
a) rewrite 'Ride 3 min / 2 stops ▼ | Trip Viewer' as '3-minute ride (2 stops) ▼'
(or 'Ride 3 min (2 stops) ▼' ... btw, bold used here to differentiate desired to be state)
b) remove the MA from the bubble
c) align the time near the leg circle

Screen Shot 2020-03-25 at 2 00 47 AM

Copy link
Member

@fpurcell fpurcell left a comment

Choose a reason for hiding this comment

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

BTW, of the 3 asks above, item 'a' would be the priority. This is what is being asked for the trimet.org redesign:
Screen Shot 2020-03-25 at 2 14 15 AM

https://xd.adobe.com/view/cef25753-fbd1-4e9d-7bf1-c5bc3bff8219-b8c3/screen/867915f3-2160-4c66-8f92-01fde40bdbeb/Planner-Itinerary

So for item a, there is a trip viewer with time and number of stops, but just no '| trip viewer' wording to the right of that. Also, the number of stops are in parens. My $0.02 is that parens are an improvement over the 'Ride 15 min / 13 stops' format in terms of readability. So desired Story would have '15-minute ride (13 stops) ▼' to match the mockup above (btw, 'Ride 15 min (13 stops)' would also be okay). Please feel free to use all wording / formatting from the design mockup, if you like .. or make changes based on potential translation / localization issues.

@evansiroky
Copy link
Contributor Author

@fpurcell, the null values occurring while clicking on the destination happen because there isn't another leg that continues after the destination. Maybe I'll include another parameter that indicates that the item clicked is the destination.

@binh-dam-ibigroup
Copy link
Collaborator

binh-dam-ibigroup commented Mar 25, 2020

Would it be possible to remove the custom font from the unstyled steps?

image

@fpurcell
Copy link
Member

fpurcell commented Mar 25, 2020

@fpurcell, the null values occurring while clicking on the destination happen because there isn't another leg that continues after the destination. Maybe I'll include another parameter that indicates that the item clicked is the destination.

Yeah something. The clicking on that map icon in the itinerary is going to then be used to move the map to that location. So having a record with coords (or the leg index into the itinerary at least) available in the frameLeg() callback would be helpful, me thinks....

}

LineColumnContent.propTypes = {
/** whether this leg is an interlined-transit leg */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Capital W

@randolphjones
Copy link

@fpurcell Thanks for pointing that out. Yes, we are trying to frame the selected leg on the map.
Two ways we can implement this: We can get the entire leg object as an argument and frame the view based on that or we can get the index and use that to select the leg from the user's active itinerary. Either way, we use the existing bound utilities with a leg object and frame up the view that way. Whether we get the entire leg from the get-go or the index of the leg... we can be flexible on that.

Taking a glance at the code in Evan's earlier commits, looks like we get both? I think we can definitely work w that 👍

@binh-dam-ibigroup
Copy link
Collaborator

What is theotp-react-redux subfolder for? Is it a mock folder?

- refactor props and various downstream components to use isDestination
- include isDestination and place in frameLeg callback
- remove routingType prop
- remove duplicate documentation of props in place-row
- add prop showViewTripButton
- move components devoted to story to demos story
- improve stories to show items requested in opentripplanner#97 (review)
Copy link
Collaborator

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Choose a reason for hiding this comment

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

For now, there is one comment on the rental vehicle description that should be moved. Other comments are more formatting/style related.

@evansiroky
Copy link
Contributor Author

Would it be possible to remove the custom font from the unstyled steps?

image

@binh-dam-ibigroup, there is no custom font present. The differences in font are due to default browser styling rules. It is generally expected that implementers will define fonts at a higher level than just this component.

@evansiroky
Copy link
Contributor Author

I believe I've addressed most of the comments here. @fpurcell, regarding your requests, here is what I have done:

a) rewrite 'Ride 3 min / 2 stops ▼ | Trip Viewer' as '3-minute ride (2 stops) ▼'
(or 'Ride 3 min (2 stops) ▼' ... btw, bold used here to differentiate desired to be state)

See story titled ItineraryBody with walk-transit-walk itinerary with custom view trip button activated and custom route abbreviation and corresponding code.

b) remove the MA from the bubble

See story titled ItineraryBody with walk-transit-walk itinerary with custom view trip button activated and custom route abbreviation and corresponding code.

c) align the time near the leg circle

See story titled Styled ItineraryBody with walk-transit-walk itinerary and corresponding code.

frameLeg() callback

The frameLeg callback now also sends the isDestination and place values in callbacks.

Copy link
Member

@fpurcell fpurcell left a comment

Choose a reason for hiding this comment

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

Fabulous work, Evan. Thanks for all the work, and demo'ing different style options in the Stories.

@binh-dam-ibigroup
Copy link
Collaborator

This case producing a validation error. Is that intended?
image

Copy link
Collaborator

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Choose a reason for hiding this comment

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

Just one last validation error then I think it should be good to go.

@evansiroky
Copy link
Contributor Author

@binh-dam-ibigroup, see latest commit.

@fpurcell fpurcell merged commit 941d534 into opentripplanner:master Mar 26, 2020
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.

Pass the leg index into frameLeg callback
5 participants