Skip to content

Mobile batch results #339

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

Merged
merged 51 commits into from
Apr 13, 2021
Merged

Mobile batch results #339

merged 51 commits into from
Apr 13, 2021

Conversation

binh-dam-ibigroup
Copy link
Collaborator

@binh-dam-ibigroup binh-dam-ibigroup commented Mar 5, 2021

This PR displays the list of itinerary options in mobile views when batch routing is enabled.

This PR builds upon #337. Behind the scenes, the code that renders headers and error screen is shared between the existing and new mobile result view and extracted into its their own components.

Also: A new ui_itineraryView URL parameter is added to reflect the itinerary expanded state, right now it is available only for mobile batch results.

EDIT: Also fix #348.

Screenshot:
image

@binh-dam-ibigroup binh-dam-ibigroup marked this pull request as ready for review March 5, 2021 19:50
@binh-dam-ibigroup binh-dam-ibigroup added the BLOCKED Blocked (waiting on another PR to be merged) label Mar 5, 2021
@binh-dam-ibigroup
Copy link
Collaborator Author

I marked this PR as blocked pending #337.

Base automatically changed from responsive-webapp-refactor to batch-routing-mobile-search March 10, 2021 21:10
Base automatically changed from batch-routing-mobile-search to dev March 10, 2021 21:12
@landonreed landonreed removed the BLOCKED Blocked (waiting on another PR to be merged) label Mar 10, 2021
@@ -71,6 +73,9 @@ const components = {
? BatchRoutingPanel
: DefaultMainPanel,
MapWindows: isCallTakerModuleEnabled ? CallTakerWindows : null,
MobileResultsScreen: isBatchRoutingEnabled
Copy link
Contributor

Choose a reason for hiding this comment

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

Add this component as a required component in the comment about the creation of the components variable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated in e802be6.

Copy link
Contributor

@evansiroky evansiroky left a comment

Choose a reason for hiding this comment

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

Approved pending resolution of 1 comment

@binh-dam-ibigroup binh-dam-ibigroup removed their assignment Mar 12, 2021
Copy link
Member

@landonreed landonreed 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 a few things might need some work, but this is headed in the right direction!

constructor () {
super()
this.state = {
itineraryExpanded: false,
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if it should be in this PR, but I'd like this itin expanded item to perhaps be moved to a UI query param. Might require some changes to the desktop view as well.

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 went ahead and added a URL parameter ui_itineraryView in 3edc3d4 to replace passing props around to track the map expanded state.

// Set up two separate renderings of the map according to mapExpanded,
// so that the map is properly sized and itineraries fit under either conditions.
// (Otherwise, if just the narrative is added/removed, the map doesn't resize properly.)
? this.renderMap()
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to have this transition be animated (transition animation to expand the map div and possibly remove the refresh on the map tiles and have a smoother zoom to itinerary)? I find the current approach kind of jarring.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we don't rerender the map and simply resize it (what we'd have to do to enable the animated transition), then the inner map canvas is not properly resized... any suggestions for triggering that?
image

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 think you would have to reload the tiles anyway after expanding/collapsing the map because the zoom and fit would be different in either case.

Copy link
Collaborator Author

@binh-dam-ibigroup binh-dam-ibigroup Mar 24, 2021

Choose a reason for hiding this comment

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

Okay, I found a way to do the transition without rerendering the map with 557bfc7 (after almost giving up... - see the transitive trick in 2e7757c)

Rob Gregg and others added 3 commits March 23, 2021 11:50
…eg as a prop to ItineraryBody c

Both files were not passing setActiveLeg as a prop so I imported where necessary and passed in the
prop.

fix #338
The previous commit had a line of unused code.

338
@codecov-io
Copy link

codecov-io commented Mar 23, 2021

Codecov Report

Merging #339 (7a8b67e) into dev (0457a25) will decrease coverage by 1.68%.
The diff coverage is 7.73%.

Impacted file tree graph

@@           Coverage Diff            @@
##             dev    #339      +/-   ##
========================================
- Coverage   9.78%   8.09%   -1.69%     
========================================
  Files        115     193      +78     
  Lines       4078    7201    +3123     
  Branches    1077    1807     +730     
========================================
+ Hits         399     583     +184     
- Misses      3191    5712    +2521     
- Partials     488     906     +418     
Impacted Files Coverage Δ
lib/actions/auth.js 0.00% <0.00%> (ø)
lib/actions/call-taker.js 0.00% <0.00%> (ø)
lib/actions/field-trip.js 0.00% <0.00%> (ø)
lib/actions/form.js 22.22% <0.00%> (-0.36%) ⬇️
lib/actions/user.js 0.00% <0.00%> (ø)
lib/components/admin/call-record.js 0.00% <0.00%> (ø)
lib/components/admin/call-taker-controls.js 0.00% <0.00%> (ø)
lib/components/admin/call-taker-windows.js 0.00% <0.00%> (ø)
lib/components/admin/call-time-counter.js 0.00% <0.00%> (ø)
lib/components/admin/draggable-window.js 0.00% <0.00%> (ø)
... and 293 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b0760d4...7a8b67e. Read the comment docs.

@landonreed
Copy link
Member

@binh-dam-ibigroup I'm not sure if this is from recent changes, but when viewing a leg on the map and then clicking "Expand map" it momentarily flashes the list of options:

Screen.Recording.2021-04-09.at.11.12.03.AM.mov

@binh-dam-ibigroup
Copy link
Collaborator Author

@binh-dam-ibigroup I'm not sure if this is from recent changes, but when viewing a leg on the map and then clicking "Expand map" it momentarily flashes the list of options:

Screen.Recording.2021-04-09.at.11.12.03.AM.mov

Ugh side effect. Fixed in af9f653.

activeStep: activeSearch && activeSearch.activeStep,
errors: getResponsesWithErrors(state.otp),
filter: state.otp.filter,
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if this is needed any longer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, updated in 3f138bb.

Copy link
Member

@landonreed landonreed left a comment

Choose a reason for hiding this comment

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

Looks pretty good! Just one comment on the filter prop. Let's wait for @evansiroky's review to merge on Monday.

@landonreed landonreed removed their assignment Apr 9, 2021
class BatchMobileResultsScreen extends Component {
state = {
// Holds the previous split view state
previousSplitView: null
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this state property is always used in conjunction with a prop from the overall store, it might be cleaner to move this into the overall application state and also make the toggleMapExpanded handler be an action. That way, this component can become a purely presentational component. This recommendation is non-blocking.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, this simplies the UI component a good bit (43fef77).

Comment on lines 20 to 28
_handleClick = () => {
const { clearActiveSearch, setItineraryView, setMobileScreen } = this.props

// Reset itinerary view state to show the list of results *before* clearing the search.
// (Otherwise, if the map is expanded, the search is not cleared.)
setItineraryView(uiActions.ItineraryView.LIST)
clearActiveSearch()
setMobileScreen(uiActions.MobileScreens.SEARCH_FORM)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It would simplify this component a fair amount if this method were converted into a connected action. This comment in non-blocking.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the suggestion, updated in 43fef77.

Copy link
Contributor

@evansiroky evansiroky left a comment

Choose a reason for hiding this comment

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

Just two non-blocking recommendations for improvement.

@binh-dam-ibigroup binh-dam-ibigroup merged commit c121587 into dev Apr 13, 2021
@binh-dam-ibigroup binh-dam-ibigroup deleted the mobile-batch-results branch April 13, 2021 17:44
@github-actions
Copy link
Contributor

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Hamburger menu not rendered on top (mobile view)
4 participants