-
Notifications
You must be signed in to change notification settings - Fork 58
Improve trip settings #323
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
Conversation
| onChange={this._handleIsActiveChange} | ||
| value | ||
| <h4>Notify me via {notificationChannelLabels[notificationChannel]} when:</h4> | ||
| <SettingsListWithAlign> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After seeing this in action, let's make all these settings flush with the left edge (i.e., no indentation). Same goes for the below item in Advanced Settings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 4801a00.
| } | ||
| } | ||
| this._updateNewTripItineraryExistence(prevProps) | ||
| this._scrollToTripDataIfInvalid() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I somewhat expected formik to have something to handle this. Perhaps this approach could be leveraged (it uses hooks, so maybe not)? jaredpalmer/formik#146 (comment). This is not blocking by any means. What you have already makes sense... just exploring.
Also, similar to how we highlight the stop viewer row on scroll, it might be good to highlight/fade the invalid items too (probably in the alert-danger bg color).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scrolling is not built-in, so there are code snippets and even a library. Library is cleaner. 4801a00
Errors were already highlighted in standard Bootstrap red.
| <FormGroup validationState={tripNameValidationState}> | ||
| <ControlLabel>Please provide a name for this trip:</ControlLabel> | ||
| <ControlLabel> | ||
| {/* Put a ref in a native DOM element for access to scroll function. */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment feels a little awkward. Maybe:
Put a ref in this native DOM element to scroll to if trip name is invalid.
| {title && <PageHeading>{title}</PageHeading>} | ||
| {title && ( | ||
| <PageHeading> | ||
| <Button bsStyle='primary' className='pull-right' type='submit'>Save</Button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a huge fan of the Save button up here (at least for now). I think we want the user to take the action of scrolling through the form to view/confirm the settings before saving.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was an experiment... It's reverted by 8dc5971.
| name='leadTimeInMinutes' | ||
| > | ||
| <option value={15}>15 min</option> | ||
| <option value={30}>30 min (default)</option> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's not the first option, 30 minutes is not selected by default. For this select and the others, we may want to add a selected prop? I'm not too familiar with how Formik handles <select/> inputs though, so I'm open to alternative suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot about that, glad you pointed it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was trickier. The default value was already populated correctly in the trip object, but the I passed the wrong component for styling, so it's fixed now in 4801a00.
landonreed
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just a couple of styling tweaks and an issue with the dropdown selects (selected prop might be needed).
| <li> | ||
| <Select | ||
| label='There are delays or disruptions of more than' | ||
| name='departureVarianceMinutesThreshold' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just noticing there is no field for arrivalVarianceMinutesThreshold. Should there be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@evansiroky In b30a2ef I split the target threshold field depending on whether the trip is arriveBy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... I'm somewhat of the mind that we should just set both thresholds to the same value (chosen by the single select component here) regardless of whether the trip is arriveBy/departAt. If I had a trip that was set to arrive by 9am. I would still really like to know if the first leg is running early by 15 minutes (an extreme case, but still feasible). Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am in favor of using a single selector, so @landonreed's idea may be better overall?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per team discussion, I implemented single UI field that sets the value for both the departure and arrival delay thresholds in 2dd1821.
|
Assigning back to Binh to fix merge conflicts and also update per our weekly technical meeting. |
landonreed
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of minor comments.
lib/components/user/account-page.js
Outdated
| import { Col, Row } from 'react-bootstrap' | ||
| import { connect } from 'react-redux' | ||
|
|
||
| import * as uiActions from '../../actions/ui' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are trips needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's leftover orphan code, removed in 814d9df.
| <option value={60}>1 hour</option> | ||
| </Select> | ||
| before it begins until it ends. | ||
| before it begins, until it ends. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the inclusion of this comma. I would say we should probably remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in 814d9df.
| clonedMonitoredTrip.delayThreshold = Math.min( | ||
| monitoredTrip.arrivalVarianceMinutesThreshold, | ||
| monitoredTrip.departureVarianceMinutesThreshold | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe all of this logic (cloning and setting delay field) should happen in a method prepareTripForEditing? Alternatively, if there's a way to just set both of these values using Formik (rather than manipulating the object), that might be preferable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 814d9df.
|
🎉 This PR is included in version 3.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR makes the following changes to the trip settings:
departureVarianceMinutesThresholdandarrivalVarianceMinutesThreshold.