diff --git a/dashboard/src/pages/Users.tsx b/dashboard/src/pages/Users.tsx index 51bab1e..c45c9e0 100644 --- a/dashboard/src/pages/Users.tsx +++ b/dashboard/src/pages/Users.tsx @@ -29,6 +29,7 @@ import { MenuItem, useToast, Spinner, + TableContainer } from '@chakra-ui/react'; import { FaAngleLeft, @@ -262,9 +263,8 @@ export default function Users() { .toPromise(); if (res.data?._update_user?.id) { toast({ - title: `Multi factor authentication ${ - user.is_multi_factor_auth_enabled ? 'disabled' : 'enabled' - } for user`, + title: `Multi factor authentication ${user.is_multi_factor_auth_enabled ? 'disabled' : 'enabled' + } for user`, isClosable: true, status: 'success', position: 'bottom-right', @@ -293,260 +293,262 @@ export default function Users() { {!loading ? ( userList.length > 0 ? ( - - - - - - - - - - - - - - - {userList.map((user: userDataTypes) => { - const { email_verified, created_at, ...rest }: any = user; - return ( - - - - - - - - -
EmailCreated AtSignup MethodsRolesVerifiedAccess - - MFA - - Actions
{user.email} - {dayjs(user.created_at * 1000).format('MMM DD, YYYY')} - {user.signup_methods}{user.roles.join(', ')} - - {user.email_verified.toString()} - - - - {user.revoked_timestamp ? 'Revoked' : 'Enabled'} - - - - {user.is_multi_factor_auth_enabled - ? 'Enabled' - : 'Disabled'} - - - - - - - Menu - - - - - - {!user.email_verified && ( - userVerificationHandler(user)} + + + + + + + + + + + + + + + + {userList.map((user: userDataTypes) => { + const { email_verified, created_at, ...rest }: any = user; + return ( + + + + + + + + + - - ); - })} - - {(paginationProps.maxPages > 1 || paginationProps.total >= 5) && ( - - - - - + + Menu + + + + + + {!user.email_verified && ( + userVerificationHandler(user)} + > + Verify User + + )} + + + {user.revoked_timestamp ? ( + + updateAccessHandler( + user.id, + updateAccessActions.ENABLE + ) + } + > + Enable Access + + ) : ( + + updateAccessHandler( + user.id, + updateAccessActions.REVOKE + ) + } + > + Revoke Access + + )} + {user.is_multi_factor_auth_enabled ? ( + multiFactorAuthUpdateHandler(user)} + > + Disable MultiFactor Authentication + + ) : ( + multiFactorAuthUpdateHandler(user)} + > + Enable MultiFactor Authentication + + )} + + + + + ); + })} + + {(paginationProps.maxPages > 1 || paginationProps.total >= 5) && ( + + + + + + paginationHandler({ + page: 1, + }) + } + isDisabled={paginationProps.page <= 1} + mr={4} + icon={} + /> + + + + paginationHandler({ + page: paginationProps.page - 1, + }) + } + isDisabled={paginationProps.page <= 1} + icon={} + /> + + + + + Page{' '} + + {paginationProps.page} + {' '} + of{' '} + + {paginationProps.maxPages} + + + + Go to page:{' '} + + paginationHandler({ + page: parseInt(value), + }) + } + value={paginationProps.page} + > + + + + + + + + + + + + + paginationHandler({ + page: paginationProps.page + 1, + }) + } + isDisabled={ + paginationProps.page >= paginationProps.maxPages + } + icon={} + /> + + + + paginationHandler({ + page: paginationProps.maxPages, + }) + } + isDisabled={ + paginationProps.page >= paginationProps.maxPages + } + ml={4} + icon={} + /> + - - - - - paginationHandler({ - page: paginationProps.page + 1, - }) - } - isDisabled={ - paginationProps.page >= paginationProps.maxPages - } - icon={} - /> - - - - paginationHandler({ - page: paginationProps.maxPages, - }) - } - isDisabled={ - paginationProps.page >= paginationProps.maxPages - } - ml={4} - icon={} - /> - - - - - )} -
EmailCreated AtSignup MethodsRolesVerifiedAccess + + MFA + + Actions
{user.email} + {dayjs(user.created_at * 1000).format('MMM DD, YYYY')} + {user.signup_methods}{user.roles.join(', ')} + + {user.email_verified.toString()} + + + + {user.revoked_timestamp ? 'Revoked' : 'Enabled'} + + + + {user.is_multi_factor_auth_enabled + ? 'Enabled' + : 'Disabled'} + + + + + - Verify User - - )} - - - {user.revoked_timestamp ? ( - - updateAccessHandler( - user.id, - updateAccessActions.ENABLE - ) - } - > - Enable Access - - ) : ( - - updateAccessHandler( - user.id, - updateAccessActions.REVOKE - ) - } - > - Revoke Access - - )} - {user.is_multi_factor_auth_enabled ? ( - multiFactorAuthUpdateHandler(user)} - > - Disable MultiFactor Authentication - - ) : ( - multiFactorAuthUpdateHandler(user)} - > - Enable MultiFactor Authentication - - )} - - -
+ + )} +
+ ) : (