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

Remove save button in user settings #1030

Merged
merged 25 commits into from
Oct 26, 2023
Merged

Conversation

binh-dam-ibigroup
Copy link
Collaborator

@binh-dam-ibigroup binh-dam-ibigroup commented Oct 12, 2023

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:

  • Does the code follow accessibility standards (WCAG 2.1 AA Compliant)?
  • Are all languages supported (Internationalization/Localization)?
  • Are appropriate Typescript types implemented?

@binh-dam-ibigroup
Copy link
Collaborator Author

Taking this back to do some other improvements.

@binh-dam-ibigroup binh-dam-ibigroup removed the request for review from AdrianaCeric October 16, 2023 14:50
Copy link
Member

@AdrianaCeric AdrianaCeric left a 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

@@ -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
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @param {string} url path to route to
* @param {string} url path to route to

)
}

const { hasConsentedToTerms, notificationChannel = 'email' } = userData
const { hasConsentedToTerms, notificationChannel = ['email'] } = userData
Copy link
Member

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'

Copy link
Collaborator Author

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.

/**
* Helper for displaying formatted toasts.
*/
export function toastSuccess(title: string, description: string): void {
Copy link
Member

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?

Copy link
Collaborator Author

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!

Copy link
Member

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

Copy link
Collaborator

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

Copy link
Member

Choose a reason for hiding this comment

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

Why

Copy link
Collaborator

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

Copy link
Collaborator Author

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.

@binh-dam-ibigroup binh-dam-ibigroup removed their assignment Oct 19, 2023
Copy link
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a 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
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

@binh-dam-ibigroup
Copy link
Collaborator Author

I think the other alternative would be to transform the checkbox into a spinner or something (this could be done with pure css)

How about putting a cursor: wait style, with an aria-status "updating" while a single update is occurring?

@binh-dam-ibigroup
Copy link
Collaborator Author

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

I agree that toast styling could generally be improved, but I won't add a TODO for this PR.

@miles-grant-ibigroup
Copy link
Collaborator

I think the other alternative would be to transform the checkbox into a spinner or something (this could be done with pure css)

How about putting a cursor: wait style, with an aria-status "updating" while a single update is occurring?

Let's give it a shot!

@binh-dam-ibigroup
Copy link
Collaborator Author

I think the other alternative would be to transform the checkbox into a spinner or something (this could be done with pure css)

How about putting a cursor: wait style, with an aria-status "updating" while a single update is occurring?

Let's give it a shot!

See latest commits.

Copy link
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a 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?

@binh-dam-ibigroup
Copy link
Collaborator Author

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.

Copy link
Collaborator

@miles-grant-ibigroup miles-grant-ibigroup left a 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

@binh-dam-ibigroup binh-dam-ibigroup merged commit b9976a9 into dev Oct 26, 2023
9 checks passed
@binh-dam-ibigroup binh-dam-ibigroup deleted the remove-user-setting-save-btn branch October 26, 2023 16:51
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.

3 participants