From 7166559d196bd5f0c986a608f5118291f962deb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Fri, 29 Jan 2021 13:16:21 +0000 Subject: [PATCH] fix: review requests --- .../src/pages/Authentication/LoginCard.js | 18 ++- .../src/pages/Authentication/Setup2FAState.js | 136 +++++++++--------- .../UserManagement/UserManagement.styles.js | 2 +- .../UserManagement/modals/ChangeRoleModal.js | 72 +++++----- .../UserManagement/modals/CreateUserModal.js | 19 ++- .../UserManagement/modals/DeleteUserModal.js | 78 +++++----- .../UserManagement/modals/EnableUserModal.js | 114 ++++++++------- .../UserManagement/modals/Input2FAModal.js | 80 +++++------ .../UserManagement/modals/Reset2FAModal.js | 58 ++++---- .../modals/ResetPasswordModal.js | 56 ++++---- new-lamassu-admin/src/routing/routes.js | 1 - 11 files changed, 310 insertions(+), 324 deletions(-) diff --git a/new-lamassu-admin/src/pages/Authentication/LoginCard.js b/new-lamassu-admin/src/pages/Authentication/LoginCard.js index a44ac3f4..42d47ebe 100644 --- a/new-lamassu-admin/src/pages/Authentication/LoginCard.js +++ b/new-lamassu-admin/src/pages/Authentication/LoginCard.js @@ -84,17 +84,15 @@ const LoginCard = () => { } return ( -
- -
-
- -

Lamassu Admin

-
- {renderState()} + +
+
+ +

Lamassu Admin

- -
+ {renderState()} +
+
) } diff --git a/new-lamassu-admin/src/pages/Authentication/Setup2FAState.js b/new-lamassu-admin/src/pages/Authentication/Setup2FAState.js index f82fe690..ae379529 100644 --- a/new-lamassu-admin/src/pages/Authentication/Setup2FAState.js +++ b/new-lamassu-admin/src/pages/Authentication/Setup2FAState.js @@ -81,77 +81,73 @@ const Setup2FAState = ({ } return ( - <> - {secret && otpauth ? ( - <> -
- - We detected that this account does not have its two-factor - authentication enabled. In order to protect the resources in the - system, a two-factor authentication is enforced. - - - To finish this process, please scan the following QR code or - insert the secret further below on an authentication app of your - choice, such as Google Authenticator or Authy. - -
-
- -
-
- Your secret: - - {secret} - - { - setShowing(!isShowing) - }}> - {isShowing ? 'Hide' : 'Show'} - -
-
- -
-
- {getErrorMsg() && ( -

{getErrorMsg()}

- )} - -
- - ) : ( -
- )} - + }) + }} + buttonClassName={classes.loginButton}> + Done + +
+ + ) ) } diff --git a/new-lamassu-admin/src/pages/UserManagement/UserManagement.styles.js b/new-lamassu-admin/src/pages/UserManagement/UserManagement.styles.js index 42608030..5ac645c7 100644 --- a/new-lamassu-admin/src/pages/UserManagement/UserManagement.styles.js +++ b/new-lamassu-admin/src/pages/UserManagement/UserManagement.styles.js @@ -100,7 +100,7 @@ const styles = { overflowX: 'auto', width: '92.5%' }, - test1: { + linkWrapper: { width: '100%', height: '100%', overflow: 'hidden', diff --git a/new-lamassu-admin/src/pages/UserManagement/modals/ChangeRoleModal.js b/new-lamassu-admin/src/pages/UserManagement/modals/ChangeRoleModal.js index 917b97d6..329a02c0 100644 --- a/new-lamassu-admin/src/pages/UserManagement/modals/ChangeRoleModal.js +++ b/new-lamassu-admin/src/pages/UserManagement/modals/ChangeRoleModal.js @@ -24,43 +24,41 @@ const ChangeRoleModal = ({ } return ( - <> - {showModal && ( - - - Change {user.username}'s role? - -

- You are about to alter {user.username}'s role. This will change this - user's permission to access certain resources. -

-

Do you wish to proceed?

-
- -
-
- )} - + showModal && ( + + + Change {user.username}'s role? + +

+ You are about to alter {user.username}'s role. This will change this + user's permission to access certain resources. +

+

Do you wish to proceed?

+
+ +
+
+ ) ) } diff --git a/new-lamassu-admin/src/pages/UserManagement/modals/CreateUserModal.js b/new-lamassu-admin/src/pages/UserManagement/modals/CreateUserModal.js index bc97fbf5..748a0ae8 100644 --- a/new-lamassu-admin/src/pages/UserManagement/modals/CreateUserModal.js +++ b/new-lamassu-admin/src/pages/UserManagement/modals/CreateUserModal.js @@ -10,7 +10,7 @@ import ErrorMessage from 'src/components/ErrorMessage' import Modal from 'src/components/Modal' import { Button } from 'src/components/buttons' import { TextInput, RadioGroup } from 'src/components/inputs/formik' -import { H1, H2, H3, Info3, Mono } from 'src/components/typography' +import { H1, H3, Info2, P, Mono } from 'src/components/typography' import CopyToClipboard from 'src/pages/Transactions/CopyToClipboard' import styles from '../UserManagement.styles' @@ -139,19 +139,24 @@ const CreateUserModal = ({ showModal, toggleModal }) => { {showModal && createUserURL && ( -

Creating {usernameField}...

- + + Creating {usernameField}... + +

Safely share this link with {usernameField} to finish the registration process. - +

- + {createUserURL} diff --git a/new-lamassu-admin/src/pages/UserManagement/modals/DeleteUserModal.js b/new-lamassu-admin/src/pages/UserManagement/modals/DeleteUserModal.js index ff1113bd..b9b5cf70 100644 --- a/new-lamassu-admin/src/pages/UserManagement/modals/DeleteUserModal.js +++ b/new-lamassu-admin/src/pages/UserManagement/modals/DeleteUserModal.js @@ -24,50 +24,48 @@ const DeleteUserModal = ({ } return ( - <> - {showModal && ( - - Delete {user.username}? -

- You are about to delete {user.username}. This will remove existent - sessions and revoke this user's permissions to access the system. -

-

- This is a PERMANENT operation. Do you wish to proceed? -

-
- -
-
- )} - + ) + inputConfirmToggle() + } else { + confirm({ + variables: { + id: user.id + } + }) + } + handleClose() + }}> + Confirm + +
+
+ ) ) } diff --git a/new-lamassu-admin/src/pages/UserManagement/modals/EnableUserModal.js b/new-lamassu-admin/src/pages/UserManagement/modals/EnableUserModal.js index bb63b2c7..1d9a3aa7 100644 --- a/new-lamassu-admin/src/pages/UserManagement/modals/EnableUserModal.js +++ b/new-lamassu-admin/src/pages/UserManagement/modals/EnableUserModal.js @@ -24,68 +24,66 @@ const EnableUserModal = ({ } return ( - <> - {showModal && ( - - {!user.enabled && ( - <> - - Enable {user.username}? - -

- You are about to enable {user.username} into the system, - activating previous eligible sessions and grant permissions to - access the system. -

-

Do you wish to proceed?

- - )} - {user.enabled && ( - <> - - Disable {user.username}? - -

- You are about to disable {user.username} from the system, - deactivating previous eligible sessions and removing permissions - to access the system. -

-

Do you wish to proceed?

- - )} -
- -
-
- )} - + ) + inputConfirmToggle() + } else { + confirm({ + variables: { + id: user.id + } + }) + } + handleClose() + }}> + Confirm + + + + ) ) } diff --git a/new-lamassu-admin/src/pages/UserManagement/modals/Input2FAModal.js b/new-lamassu-admin/src/pages/UserManagement/modals/Input2FAModal.js index 2e96b335..017721a6 100644 --- a/new-lamassu-admin/src/pages/UserManagement/modals/Input2FAModal.js +++ b/new-lamassu-admin/src/pages/UserManagement/modals/Input2FAModal.js @@ -55,47 +55,45 @@ const Input2FAModal = ({ showModal, toggleModal, action, vars }) => { } return ( - <> - {showModal && ( - - Confirm action -

- To make changes on this user, please confirm this action by entering - your two-factor authentication code below. -

- - {getErrorMsg() && ( -

{getErrorMsg()}

- )} -
- -
-
- )} - + showModal && ( + + Confirm action +

+ To make changes on this user, please confirm this action by entering + your two-factor authentication code below. +

+ + {getErrorMsg() && ( +

{getErrorMsg()}

+ )} +
+ +
+
+ ) ) } diff --git a/new-lamassu-admin/src/pages/UserManagement/modals/Reset2FAModal.js b/new-lamassu-admin/src/pages/UserManagement/modals/Reset2FAModal.js index 34ced07c..45f37f8c 100644 --- a/new-lamassu-admin/src/pages/UserManagement/modals/Reset2FAModal.js +++ b/new-lamassu-admin/src/pages/UserManagement/modals/Reset2FAModal.js @@ -17,36 +17,34 @@ const Reset2FAModal = ({ showModal, toggleModal, reset2FAURL, user }) => { } return ( - <> - {showModal && ( - - - Reset 2FA for {user.username} - -

- Safely share this link with {user.username} for a two-factor - authentication reset. -

-
- - - - {reset2FAURL} - - - -
-
- )} - + showModal && ( + + + Reset 2FA for {user.username} + +

+ Safely share this link with {user.username} for a two-factor + authentication reset. +

+
+ + + + {reset2FAURL} + + + +
+
+ ) ) } diff --git a/new-lamassu-admin/src/pages/UserManagement/modals/ResetPasswordModal.js b/new-lamassu-admin/src/pages/UserManagement/modals/ResetPasswordModal.js index 818d7eaf..19462e48 100644 --- a/new-lamassu-admin/src/pages/UserManagement/modals/ResetPasswordModal.js +++ b/new-lamassu-admin/src/pages/UserManagement/modals/ResetPasswordModal.js @@ -22,35 +22,33 @@ const ResetPasswordModal = ({ } return ( - <> - {showModal && ( - - - Reset password for {user.username} - -

- Safely share this link with {user.username} for a password reset. -

-
- - - - {resetPasswordURL} - - - -
-
- )} - + showModal && ( + + + Reset password for {user.username} + +

+ Safely share this link with {user.username} for a password reset. +

+
+ + + + {resetPasswordURL} + + + +
+
+ ) ) } diff --git a/new-lamassu-admin/src/routing/routes.js b/new-lamassu-admin/src/routing/routes.js index c754fb6c..c1800aa0 100644 --- a/new-lamassu-admin/src/routing/routes.js +++ b/new-lamassu-admin/src/routing/routes.js @@ -21,7 +21,6 @@ import ResetPassword from 'src/pages/Authentication/ResetPassword' import Blacklist from 'src/pages/Blacklist' import Cashout from 'src/pages/Cashout' import Commissions from 'src/pages/Commissions' -// import ConfigMigration from 'src/pages/ConfigMigration' import { Customers, CustomerProfile } from 'src/pages/Customers' import Dashboard from 'src/pages/Dashboard' import Funding from 'src/pages/Funding'