-
Notifications
You must be signed in to change notification settings - Fork 53
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
Remove save button in user settings #1030
Conversation
…a update submission.
Taking this back to do some other improvements. |
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 like the implementation! It's a lot more smooth without the save button. One comment and a question
lib/actions/ui.js
Outdated
@@ -51,7 +51,7 @@ export const resetSessionTimeout = createAction('RESET_SESSION_TIMEOUT') | |||
* that preserves the current search or, if | |||
* replaceSearch is provided (including an empty string), replaces the search | |||
* when routing to a new URL path. | |||
* @param {[type]} url path to route to | |||
* @param {string} url path to route to |
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.
* @param {string} url path to route to | |
* @param {string} url path to route to |
) | ||
} | ||
|
||
const { hasConsentedToTerms, notificationChannel = 'email' } = userData | ||
const { hasConsentedToTerms, notificationChannel = ['email'] } = userData |
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 was this changed to a single value array? Is this to allow for more notification channels like 'sms'
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.
Correct. I also changed the type of the user data to EditedUser
, for which enabled notifications channels are stored in an array.
lib/components/util/toasts.tsx
Outdated
/** | ||
* Helper for displaying formatted toasts. | ||
*/ | ||
export function toastSuccess(title: string, description: string): void { |
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.
Could this toast helper function also release a toast.error
if the form fails to save?
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.
Actually, an alert is shown if an error occurred!
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 was thinking that having the same styling for an error and a success would ensure visual consistency
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.
Wait no I'm not a huge fan of this that might be confusing
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
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 toasts don't steal your attention enough
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's why in #992 I only applied toasts to confirmation messages and not alerts.
…able input if error Also apply PR feedback.
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 is clearly well thought out, tested, and planned. However, there is one behavior that feels weird: can we disable the entire form during save? Otherwise it's confusing as to why the one item gets disabled. I think the other alternative would be to transform the checkbox into a spinner or something (this could be done with pure css) but as is I think it's a bit confusing.
Also, could we add a TODO to style the toasts a bit? They're a bit out of place with the rest of the UI
@@ -78,4 +65,4 @@ const StackedPaneDisplay = ({ | |||
</> | |||
) | |||
} | |||
export default StackedPaneDisplay | |||
export default StackedPanesWithSave |
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 do we do this instead of adding a prop? Is it formik nonsense?
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's to separate the code noise brought by handling the navigation button states.
How about putting a |
I agree that toast styling could generally be improved, but I won't add a TODO for this PR. |
Let's give it a shot! |
…ate request is pending.
See latest commits. |
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.
New effect looks cool! is there any way we can get the loading cursor to appear on the entire label instead of just the checkbox?
Yes, see b188043. |
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 would've done this with classes but this seems good enough for now! Excited for these changes to move forward it's much cleaner
Description
This PR removes the save button form user settings, so that all settings behave consistently.
Upon changes of notification settings, accessibility, and trip history, settings are saved immediately and a toast notification is shown as confirmation.
PR Checklist: