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

feat: New create user contextual bar #30582

Merged
merged 21 commits into from
Oct 23, 2023

Conversation

rique223
Copy link
Contributor

@rique223 rique223 commented Oct 5, 2023

Proposed changes (including videos or screenshots)

Jira task: WM-88

Implemented new functionalities for the user creation contextual bar of the /admin/users page, these functionalities include (There's a lot of changes in this, if there is any issues understanding it please look at the figma in the jira task above or contact me):

  1. Changing the title of the contextual bar from 'Add user' to 'New user';
  2. Creating a briefing message explainig where new users will appear in the new users table tab layout;
  3. Changing the label of the verified field from 'verified' to 'Mark email as verified', position this field right under the Email field and create a new hover tootlip for it with briefing message regarding the functionality of the field;
  4. Changing the setRandomPassword from a ToggleSwitch to two radio buttons;
  5. Creating a password confirmation field;
  6. Implementing the PasswordVerifier component for the password field;
  7. Changing the password field to hold the radio buttons instead of only its fields and to only show the password, passwordConfirmation, PasswordVerifier and requirePasswordChange when the 'Set Manually' is toggled on;
  8. Creating a 'Hide additional fields'/'Show additional fields' button that hides or shows the custom fields of the user form;
  9. Implementing a new user creation flow in which instead of being thrown directly into the new user info contextual bar the admin will be redirected to a contextual bar with two buttons, 'Add more users' and 'Done', and a text reading 'You've created {number} users'. If the admin clicks on Add more users they will be sent back to an empty user creation form otherwise if they click done they will be redirected to the most recently created user info page.
  10. Making sure the verified, password/setRandomPassword and sendWelcomeEmail are disabled if SMTP is not set;
  11. Changing the text and description of the 'Only allow verified users to login' setting to Require email verification to login and Ensure SMTP is configured to enable respectively;
  12. Making sure password/setRandomPassword and the Email are disabled or enabled based on both the 'Only allow verified users to login' setting and the SMTP setting;
  13. Refactoring and componentizing some code to reduce complexity;
  14. Creating the necessary translation strings for each new field/updated field;

Demo gif:
new_users_page_contextual_bar

Issue(s)

Steps to test or reproduce

Further comments

Created a new ui logic for the SetRandomPassword form with 2 radio buttons instead of a toggle and changed the email field to be the first one in the create user contextual bar.
@changeset-bot
Copy link

changeset-bot bot commented Oct 5, 2023

⚠️ No Changeset found

Latest commit: 2ceae99

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codecov
Copy link

codecov bot commented Oct 5, 2023

Codecov Report

Merging #30582 (2ceae99) into feat/user-panel (df6c31d) will decrease coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##           feat/user-panel   #30582      +/-   ##
===================================================
- Coverage            51.24%   51.20%   -0.05%     
===================================================
  Files                  808      809       +1     
  Lines                15122    15127       +5     
  Branches              2793     2794       +1     
===================================================
- Hits                  7750     7746       -4     
- Misses                6928     6940      +12     
+ Partials               444      441       -3     
Flag Coverage Δ
e2e 48.53% <ø> (-0.06%) ⬇️
unit 64.78% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Implemented the password verification and confirmation flows in the users page contextual bar, changed some types to follow the changes, removed the old Verified toggle and componentized the setRandomPassword radios.
Created a briefing text warning users of the new tab layout functionality in the new user contextual bar of the admin users page.
Created a button that will hide or show the custom fields of the new users form on click. Also added an icon to the user form title, changed the password field position in the form, removed the addon icons from some fields and created a new briefing message in the top of the form.
Created the logic that hides the custom fields of the new user form when the 'hide additional fields' button is clicked
Added a new screen to enhance the user creation experience. This screen appears immediately after you create a new user. On this page, you have two options: you can either complete the process and view the user you just created, or you can return to the form to create another user without exiting the contextual bar. Additionally, I've made some minor logic improvements and removed commented-out code.
Implemented logic to the user created contextual bar, now for each user created without exiting or refreshing the page the number of the message will be incremented by 1. Also stopped using the old Field.Component components in favor of their standalone versions and made the message of the Hide Additional Fields button change to Show additional fields when the fields are hidden.
Implemented a tooltip in the email verification field of the user creation contextual bar that explains what toggling on this field will do. Also implemented a way to use a single value in order to controll the setRandomPassword radios instead of two and added the necessary entries in the i18n to follow the aforementioned changes.
Changed the title of the "Only allow verified users to login" setting to "Require email verification to login" and its description from "Make sure you have correct SMTP settings to use this feature" to "Ensure SMTP is configured to enable this feature"
…ord is true

Created some logic to make sure the requirePasswordChange field will be true even if the user changed it to false and then changed setRandomPassword to true. Also changed some strings and sizes to follow figma specs.
Removed un-optimal usage of the useEffect hook together with RHF's reset function, implemented a function that changes the requirePasswordChange value based on which setRandomPassword radio is checked, switched resetField for setValue to make sure the value is always correct, changed some rendering logic to make sure the first state of some fields is correct and optimized some parts of the getInitialValues function return.
Changed the name of the AdminUserSetRandomPassword component to AdminUserSetRandomPasswordRadios and created a new component called AdminUserSetRandomPasswordContent to organize and clean the AdminUserForm component.
Implemented a refecthUserData function for the AdminuserInfoWithData component that will run when the handleUpdateUser mutation is succesful to refetch the user data of the edited user. This fixes a bug in which the user form would show the old data instead of the updated one.
@rique223 rique223 marked this pull request as ready for review October 23, 2023 03:40
@rique223 rique223 requested review from a team as code owners October 23, 2023 03:40
@rique223 rique223 requested a review from hugocostadev October 23, 2023 03:40
@hugocostadev hugocostadev merged commit 809ca6c into feat/user-panel Oct 23, 2023
41 checks passed
@hugocostadev hugocostadev deleted the feat/contextual-bar-new-user branch October 23, 2023 17:00
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.

2 participants