From 0d3d58c6787e5ac52bf0f749d98f0155bc9e2284 Mon Sep 17 00:00:00 2001 From: sanskar Date: Fri, 20 Dec 2024 12:36:00 -0800 Subject: [PATCH 1/3] chore: rebase --- apps/gitness/src/App.tsx | 5 + .../user-management-container.tsx | 106 ++++++++++ packages/ui/src/views/index.ts | 3 + .../user-management/components/users-list.tsx | 182 ++++++++++++++++++ .../ui/src/views/user-management/index.ts | 1 + .../ui/src/views/user-management/types.ts | 10 + .../user-management/user-management-page.tsx | 117 +++++++++++ 7 files changed, 424 insertions(+) create mode 100644 apps/gitness/src/pages-v2/user-management/user-management-container.tsx create mode 100644 packages/ui/src/views/user-management/components/users-list.tsx create mode 100644 packages/ui/src/views/user-management/index.ts create mode 100644 packages/ui/src/views/user-management/types.ts create mode 100644 packages/ui/src/views/user-management/user-management-page.tsx diff --git a/apps/gitness/src/App.tsx b/apps/gitness/src/App.tsx index 748c63374..78c59eb7e 100644 --- a/apps/gitness/src/App.tsx +++ b/apps/gitness/src/App.tsx @@ -54,6 +54,7 @@ import { RepoSidebar } from './pages-v2/repo/repo-sidebar' import RepoSummaryPage from './pages-v2/repo/repo-summary' import { SignIn as SignInV2 } from './pages-v2/signin' import { SignUp as SignUpV2 } from './pages-v2/signup' +import { UserManagementPageContainer } from './pages-v2/user-management/user-management-container' import { CreateWebhookContainer } from './pages-v2/webhooks/create-webhook-container' import WebhookListPage from './pages-v2/webhooks/webhook-list' @@ -328,6 +329,10 @@ export default function App() { } ] }, + { + path: 'admin/default-settings', + element: + }, { path: 'theme', element: diff --git a/apps/gitness/src/pages-v2/user-management/user-management-container.tsx b/apps/gitness/src/pages-v2/user-management/user-management-container.tsx new file mode 100644 index 000000000..bd50db1e9 --- /dev/null +++ b/apps/gitness/src/pages-v2/user-management/user-management-container.tsx @@ -0,0 +1,106 @@ +import { useQueryClient } from '@tanstack/react-query' +import { parseAsInteger, useQueryState } from 'nuqs' + +import { + AdminListUsersQueryQueryParams, + useAdminDeleteUserMutation, + useAdminListUsersQuery, + useAdminUpdateUserMutation, + useUpdateUserAdminMutation +} from '@harnessio/code-service-client' +import { UserManagementPage } from '@harnessio/ui/views' +import { useCommonFilter } from '@harnessio/views' + +import { PageResponseHeader } from '../../types' + +export const UserManagementPageContainer = () => { + const { sort } = useCommonFilter() + const [page, setPage] = useQueryState('page', parseAsInteger.withDefault(1)) + const changePage = (pageNum: number) => setPage(pageNum) + const queryClient = useQueryClient() + const { data: { body: userData, headers } = {} } = useAdminListUsersQuery({ + queryParams: { + page, + sort + } + }) + + const totalPages = parseInt(headers?.get(PageResponseHeader.xTotalPages) || '') + + const { mutateAsync: updateUser } = useAdminUpdateUserMutation( + {}, + { + onError: error => { + console.error(error) + } + } + ) + + const { mutateAsync: deleteUser } = useAdminDeleteUserMutation( + {}, + { + onError: error => { + console.error(error) + } + } + ) + + const { mutateAsync: updateUserAdmin } = useUpdateUserAdminMutation( + {}, + { + onError: error => { + console.error(error) + } + } + ) + + const handleUpdateUser = async (data: { email: string; displayName: string; userID: string }) => { + await updateUser({ + user_uid: data.userID, + body: { + email: data.email, + display_name: data.displayName + } + }) + queryClient.invalidateQueries({ queryKey: ['adminListUsers'] }) + } + + const handleDeleteUser = async (userUid: string) => { + await deleteUser({ + user_uid: userUid + }) + queryClient.invalidateQueries({ queryKey: ['adminListUsers'] }) + } + + const handleUpdateUserAdmin = async (userUid: string, isAdmin: boolean) => { + await updateUserAdmin({ + user_uid: userUid, + body: { + admin: isAdmin + } + }) + queryClient.invalidateQueries({ queryKey: ['adminListUsers'] }) + } + + const handleUpdatePassword = async (userId: string, password: string) => { + await updateUser({ + user_uid: userId, + body: { + password: password + } + }) + queryClient.invalidateQueries({ queryKey: ['adminListUsers'] }) + } + return ( + + ) +} diff --git a/packages/ui/src/views/index.ts b/packages/ui/src/views/index.ts index 7e0d52be7..0c4207689 100644 --- a/packages/ui/src/views/index.ts +++ b/packages/ui/src/views/index.ts @@ -38,3 +38,6 @@ export * from './profile-settings' // pipelines export * from './pipelines' + +// user-management +export * from './user-management' diff --git a/packages/ui/src/views/user-management/components/users-list.tsx b/packages/ui/src/views/user-management/components/users-list.tsx new file mode 100644 index 000000000..3c2d02752 --- /dev/null +++ b/packages/ui/src/views/user-management/components/users-list.tsx @@ -0,0 +1,182 @@ +import { + Avatar, + AvatarFallback, + AvatarImage, + Badge, + Button, + DropdownMenu, + DropdownMenuContent, + DropdownMenuGroup, + DropdownMenuItem, + DropdownMenuSeparator, + DropdownMenuShortcut, + DropdownMenuTrigger, + Icon, + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, + Text +} from '@/components' +import { getInitials, timeAgo } from '@/utils/utils' + +import { UsersProps } from '../types' + +interface PageProps { + users: UsersProps[] + // onDelete: (user: UsersProps) => void + // onEdit: (user: UsersProps) => void + // onRemoveAdmin: (user: UsersProps) => void + // onResetPassword: (user: UsersProps) => void + // onSetAdmin: (user: UsersProps) => void +} + +// fix the edit form dialog and mock data and coressponding props +export const UsersList = ({ users }: PageProps) => { + const moreActionsTooltip = ({ user }: { user: UsersProps }) => { + return ( + + + + + event.preventDefault()} + > + + { + // return user.admin ? onRemoveAdmin(user) : onSetAdmin(user) + // }} + > + + + + {user.admin ? 'Remove Admin' : 'Set as Admin'} + + { + // onResetPassword(user) + // }} + > + + + + Reset Password + + { + // onEdit(user) + // }} + > + + + + Edit User + + + { + // onDelete(user) + // }} + > + + + + Delete User + + + + + ) + } + + return ( + + + + User + Email + Role Binding + {/* Date added */} + + <> + + + + + {users && + users.map(user => { + return ( + + {/* NAME */} + +
+ + {user.avatarUrl && } + {getInitials(user.uid!, 2)} + + + {user.display_name} + {user.admin && ( + + Admin + + )} + +
+
+ {/* EMAIL */} + +
+ + {user.email} + +
+
+ + {/* displayName */} + {/* +
+ + {user.display_name} + +
+
*/} + {/* @TODO: add roll binding data when available */} + + + {/* TimeStamp */} + {/* +
+ + {timeAgo(user.created)} + +
+
*/} + + +
+ {/* */} + {moreActionsTooltip({ user })} +
+
+
+ ) + })} +
+
+ ) +} diff --git a/packages/ui/src/views/user-management/index.ts b/packages/ui/src/views/user-management/index.ts new file mode 100644 index 000000000..03621eaf8 --- /dev/null +++ b/packages/ui/src/views/user-management/index.ts @@ -0,0 +1 @@ +export * from './user-management-page' diff --git a/packages/ui/src/views/user-management/types.ts b/packages/ui/src/views/user-management/types.ts new file mode 100644 index 000000000..3ad15bc2c --- /dev/null +++ b/packages/ui/src/views/user-management/types.ts @@ -0,0 +1,10 @@ +export interface UsersProps { + admin?: boolean + uid?: string + display_name?: string | undefined + email?: string + created?: number + updated?: number + avatarUrl?: string + blocked?: boolean +} diff --git a/packages/ui/src/views/user-management/user-management-page.tsx b/packages/ui/src/views/user-management/user-management-page.tsx new file mode 100644 index 000000000..16a833021 --- /dev/null +++ b/packages/ui/src/views/user-management/user-management-page.tsx @@ -0,0 +1,117 @@ +import { useNavigate } from 'react-router-dom' + +import { Button, PaginationComponent, Spacer, Text } from '@/components' +import { SandboxLayout } from '@/views' + +import { UsersList } from './components/users-list' +import { UsersProps } from './types' + +export function UserManagementPage({ + userData + // handleUpdateUser, + // handleDeleteUser, + // handleUpdatePassword, + // updateUserAdmin, + // currentPage, + // totalPages, + // setPage +}: { + userData: UsersProps[] | null + // handleUpdateUser: (data: { email: string; displayName: string; userID: string }) => void + // handleDeleteUser: (userUid: string) => void + // handleUpdatePassword: (userId: string, password: string) => void + // updateUserAdmin: (userUid: string, isAdmin: boolean) => void + // currentPage: number + // totalPages: number + // setPage: (pageNum: number) => void +}) { + const navigate = useNavigate() + // const [dialogState, dispatch] = useReducer(dialogStateReducer, initialDialogState) + + // const openDialog = (dialogType: DialogType, user: UsersProps) => { + // dispatch({ type: DialogActionType.OPEN_DIALOG, dialogType, user }) + // } + + // const closeDialog = (dialogType: DialogType) => { + // dispatch({ type: DialogActionType.CLOSE_DIALOG, dialogType }) + // } + + // // Handler for user deletion + // const handleDelete = () => { + // dispatch({ type: DialogActionType.START_DELETING }) + // closeDialog(DialogType.DELETE) + // dispatch({ type: DialogActionType.DELETE_SUCCESS }) + // dispatch({ type: DialogActionType.RESET_DELETE }) + // } + + // // Handler for form submission + // const handleFormSave = () => { + // dispatch({ type: DialogActionType.START_SUBMITTING }) + // closeDialog(DialogType.EDIT) + // dispatch({ type: DialogActionType.SUBMIT_SUCCESS }) + // dispatch({ type: DialogActionType.RESET_SUBMIT }) + // } + + // // Handler for admin removal + // const handleRemove = () => { + // dispatch({ type: DialogActionType.START_REMOVING }) + // closeDialog(DialogType.REMOVE_ADMIN) + // dispatch({ type: DialogActionType.REMOVE_SUCCESS }) + // dispatch({ type: DialogActionType.RESET_REMOVE }) + // } + + // const handleAdd = () => { + // dispatch({ type: DialogActionType.START_REMOVING }) + // closeDialog(DialogType.SET_ADMIN) + // dispatch({ type: DialogActionType.REMOVE_SUCCESS }) + // dispatch({ type: DialogActionType.RESET_REMOVE }) + // } + + const renderUserListContent = () => { + return ( + <> + openDialog(DialogType.EDIT, user)} + // onDelete={user => openDialog(DialogType.DELETE, user)} + // onRemoveAdmin={user => openDialog(DialogType.REMOVE_ADMIN, user)} + // onResetPassword={user => openDialog(DialogType.RESET_PASSWORD, user)} + // onSetAdmin={user => openDialog(DialogType.SET_ADMIN, user)} + users={userData as UsersProps[]} + /> + + ) + } + + const handleInviteClick = () => { + navigate('../users/create') + } + + return ( + + + + + Users + + + {/*
+
+ +
+ +
*/} + + + {renderUserListContent()} + + {/* setPage(pageNum)} + /> */} +
+
+ ) +} From 663ac72c9876c2ec6b5732afa38a6dc0a4de65b8 Mon Sep 17 00:00:00 2001 From: sanskar Date: Sat, 21 Dec 2024 17:16:48 +0300 Subject: [PATCH 2/3] feat: add user list page --- .../stores/admin-list-store.tsx | 27 +++ .../user-management-container.tsx | 164 ++++++++++-------- .../user-management/components/users-list.tsx | 69 ++------ .../ui/src/views/user-management/index.ts | 1 + .../ui/src/views/user-management/types.ts | 15 ++ .../user-management/user-management-page.tsx | 105 +++-------- 6 files changed, 163 insertions(+), 218 deletions(-) create mode 100644 apps/gitness/src/pages-v2/user-management/stores/admin-list-store.tsx diff --git a/apps/gitness/src/pages-v2/user-management/stores/admin-list-store.tsx b/apps/gitness/src/pages-v2/user-management/stores/admin-list-store.tsx new file mode 100644 index 000000000..22409a0c8 --- /dev/null +++ b/apps/gitness/src/pages-v2/user-management/stores/admin-list-store.tsx @@ -0,0 +1,27 @@ +import { create } from 'zustand' + +import { IAdminListUsersStore, UsersProps } from '@harnessio/ui/views' + +import { PageResponseHeader } from '../../../types' + +export const useAdminListUsersStore = create(set => ({ + users: [], + totalPages: 1, + page: 1, + setPage: page => + set({ + page + }), + setUsers: (data: UsersProps[]) => { + set({ + users: data + }) + }, + setTotalPages: (headers: Headers) => { + const totalPages = parseInt(headers?.get(PageResponseHeader.xTotalPages) || '0') + + set({ + totalPages + }) + } +})) diff --git a/apps/gitness/src/pages-v2/user-management/user-management-container.tsx b/apps/gitness/src/pages-v2/user-management/user-management-container.tsx index bd50db1e9..9b9370f2a 100644 --- a/apps/gitness/src/pages-v2/user-management/user-management-container.tsx +++ b/apps/gitness/src/pages-v2/user-management/user-management-container.tsx @@ -1,106 +1,116 @@ -import { useQueryClient } from '@tanstack/react-query' +import { useEffect } from 'react' + +// import { useQueryClient } from '@tanstack/react-query' import { parseAsInteger, useQueryState } from 'nuqs' import { - AdminListUsersQueryQueryParams, - useAdminDeleteUserMutation, - useAdminListUsersQuery, - useAdminUpdateUserMutation, - useUpdateUserAdminMutation + // useAdminDeleteUserMutation, + useAdminListUsersQuery + // useAdminUpdateUserMutation, + // useUpdateUserAdminMutation } from '@harnessio/code-service-client' import { UserManagementPage } from '@harnessio/ui/views' -import { useCommonFilter } from '@harnessio/views' -import { PageResponseHeader } from '../../types' +import { useTranslationStore } from '../../i18n/stores/i18n-store' +import { useAdminListUsersStore } from './stores/admin-list-store' export const UserManagementPageContainer = () => { - const { sort } = useCommonFilter() - const [page, setPage] = useQueryState('page', parseAsInteger.withDefault(1)) - const changePage = (pageNum: number) => setPage(pageNum) - const queryClient = useQueryClient() + const [queryPage, setQueryPage] = useQueryState('page', parseAsInteger.withDefault(1)) + const { setUsers, setTotalPages, setPage, page } = useAdminListUsersStore() + // const queryClient = useQueryClient() const { data: { body: userData, headers } = {} } = useAdminListUsersQuery({ queryParams: { - page, - sort + page: queryPage } }) - const totalPages = parseInt(headers?.get(PageResponseHeader.xTotalPages) || '') - - const { mutateAsync: updateUser } = useAdminUpdateUserMutation( - {}, - { - onError: error => { - console.error(error) - } + useEffect(() => { + if (userData) { + setUsers(userData) } - ) - - const { mutateAsync: deleteUser } = useAdminDeleteUserMutation( - {}, - { - onError: error => { - console.error(error) - } + if (headers) { + setTotalPages(headers) } - ) + }, [userData, setUsers, setTotalPages, headers]) - const { mutateAsync: updateUserAdmin } = useUpdateUserAdminMutation( - {}, - { - onError: error => { - console.error(error) - } - } - ) + useEffect(() => { + setQueryPage(page) + }, [queryPage, page, setPage]) + + // @TODO: add following mutations and callbacks back once functionality is added in the views page + + // const { mutateAsync: updateUser } = useAdminUpdateUserMutation( + // {}, + // { + // onError: error => { + // console.error(error) + // } + // } + // ) + + // const { mutateAsync: deleteUser } = useAdminDeleteUserMutation( + // {}, + // { + // onError: error => { + // console.error(error) + // } + // } + // ) + + // const { mutateAsync: updateUserAdmin } = useUpdateUserAdminMutation( + // {}, + // { + // onError: error => { + // console.error(error) + // } + // } + // ) - const handleUpdateUser = async (data: { email: string; displayName: string; userID: string }) => { - await updateUser({ - user_uid: data.userID, - body: { - email: data.email, - display_name: data.displayName - } - }) - queryClient.invalidateQueries({ queryKey: ['adminListUsers'] }) - } + // const handleUpdateUser = async (data: { email: string; displayName: string; userID: string }) => { + // await updateUser({ + // user_uid: data.userID, + // body: { + // email: data.email, + // display_name: data.displayName + // } + // }) + // queryClient.invalidateQueries({ queryKey: ['adminListUsers'] }) + // } - const handleDeleteUser = async (userUid: string) => { - await deleteUser({ - user_uid: userUid - }) - queryClient.invalidateQueries({ queryKey: ['adminListUsers'] }) - } + // const handleDeleteUser = async (userUid: string) => { + // await deleteUser({ + // user_uid: userUid + // }) + // queryClient.invalidateQueries({ queryKey: ['adminListUsers'] }) + // } - const handleUpdateUserAdmin = async (userUid: string, isAdmin: boolean) => { - await updateUserAdmin({ - user_uid: userUid, - body: { - admin: isAdmin - } - }) - queryClient.invalidateQueries({ queryKey: ['adminListUsers'] }) - } + // const handleUpdateUserAdmin = async (userUid: string, isAdmin: boolean) => { + // await updateUserAdmin({ + // user_uid: userUid, + // body: { + // admin: isAdmin + // } + // }) + // queryClient.invalidateQueries({ queryKey: ['adminListUsers'] }) + // } - const handleUpdatePassword = async (userId: string, password: string) => { - await updateUser({ - user_uid: userId, - body: { - password: password - } - }) - queryClient.invalidateQueries({ queryKey: ['adminListUsers'] }) - } + // const handleUpdatePassword = async (userId: string, password: string) => { + // await updateUser({ + // user_uid: userId, + // body: { + // password: password + // } + // }) + // queryClient.invalidateQueries({ queryKey: ['adminListUsers'] }) + // } return ( ) } diff --git a/packages/ui/src/views/user-management/components/users-list.tsx b/packages/ui/src/views/user-management/components/users-list.tsx index 3c2d02752..764cc5617 100644 --- a/packages/ui/src/views/user-management/components/users-list.tsx +++ b/packages/ui/src/views/user-management/components/users-list.tsx @@ -20,17 +20,12 @@ import { TableRow, Text } from '@/components' -import { getInitials, timeAgo } from '@/utils/utils' +import { getInitials } from '@/utils/utils' import { UsersProps } from '../types' interface PageProps { users: UsersProps[] - // onDelete: (user: UsersProps) => void - // onEdit: (user: UsersProps) => void - // onRemoveAdmin: (user: UsersProps) => void - // onResetPassword: (user: UsersProps) => void - // onSetAdmin: (user: UsersProps) => void } // fix the edit form dialog and mock data and coressponding props @@ -48,46 +43,26 @@ export const UsersList = ({ users }: PageProps) => { onCloseAutoFocus={event => event.preventDefault()} > - { - // return user.admin ? onRemoveAdmin(user) : onSetAdmin(user) - // }} - > + {user.admin ? 'Remove Admin' : 'Set as Admin'} - { - // onResetPassword(user) - // }} - > + Reset Password - { - // onEdit(user) - // }} - > + Edit User - { - // onDelete(user) - // }} - > + @@ -103,9 +78,9 @@ export const UsersList = ({ users }: PageProps) => { - User - Email - Role Binding + User + Email + Role Binding {/* Date added */} <> @@ -118,8 +93,8 @@ export const UsersList = ({ users }: PageProps) => { return ( {/* NAME */} - -
+ +
{user.avatarUrl && } {getInitials(user.uid!, 2)} @@ -147,31 +122,11 @@ export const UsersList = ({ users }: PageProps) => {
- {/* displayName */} - {/* -
- - {user.display_name} - -
-
*/} {/* @TODO: add roll binding data when available */} - - - {/* TimeStamp */} - {/* -
- - {timeAgo(user.created)} - -
-
*/} + -
- {/* */} - {moreActionsTooltip({ user })} -
+
{moreActionsTooltip({ user })}
) diff --git a/packages/ui/src/views/user-management/index.ts b/packages/ui/src/views/user-management/index.ts index 03621eaf8..a8dec6499 100644 --- a/packages/ui/src/views/user-management/index.ts +++ b/packages/ui/src/views/user-management/index.ts @@ -1 +1,2 @@ export * from './user-management-page' +export * from './types' diff --git a/packages/ui/src/views/user-management/types.ts b/packages/ui/src/views/user-management/types.ts index 3ad15bc2c..c835f3e88 100644 --- a/packages/ui/src/views/user-management/types.ts +++ b/packages/ui/src/views/user-management/types.ts @@ -1,3 +1,5 @@ +import { TranslationStore } from '@/views' + export interface UsersProps { admin?: boolean uid?: string @@ -8,3 +10,16 @@ export interface UsersProps { avatarUrl?: string blocked?: boolean } + +export interface IUserManagementPageProps { + useAdminListUsersStore: () => IAdminListUsersStore + useTranslationStore: () => TranslationStore +} +export interface IAdminListUsersStore { + users: UsersProps[] + totalPages: number + page: number + setPage: (data: number) => void + setUsers: (data: UsersProps[]) => void + setTotalPages: (data: Headers) => void +} diff --git a/packages/ui/src/views/user-management/user-management-page.tsx b/packages/ui/src/views/user-management/user-management-page.tsx index 16a833021..d4ad993d9 100644 --- a/packages/ui/src/views/user-management/user-management-page.tsx +++ b/packages/ui/src/views/user-management/user-management-page.tsx @@ -1,91 +1,27 @@ import { useNavigate } from 'react-router-dom' -import { Button, PaginationComponent, Spacer, Text } from '@/components' +import { Button, ListActions, PaginationComponent, SearchBox, Spacer, Text } from '@/components' import { SandboxLayout } from '@/views' import { UsersList } from './components/users-list' -import { UsersProps } from './types' +import { IUserManagementPageProps, UsersProps } from './types' -export function UserManagementPage({ - userData - // handleUpdateUser, - // handleDeleteUser, - // handleUpdatePassword, - // updateUserAdmin, - // currentPage, - // totalPages, - // setPage -}: { - userData: UsersProps[] | null - // handleUpdateUser: (data: { email: string; displayName: string; userID: string }) => void - // handleDeleteUser: (userUid: string) => void - // handleUpdatePassword: (userId: string, password: string) => void - // updateUserAdmin: (userUid: string, isAdmin: boolean) => void - // currentPage: number - // totalPages: number - // setPage: (pageNum: number) => void -}) { +export const UserManagementPage: React.FC = ({ + useAdminListUsersStore, + useTranslationStore +}) => { const navigate = useNavigate() - // const [dialogState, dispatch] = useReducer(dialogStateReducer, initialDialogState) - - // const openDialog = (dialogType: DialogType, user: UsersProps) => { - // dispatch({ type: DialogActionType.OPEN_DIALOG, dialogType, user }) - // } - - // const closeDialog = (dialogType: DialogType) => { - // dispatch({ type: DialogActionType.CLOSE_DIALOG, dialogType }) - // } - - // // Handler for user deletion - // const handleDelete = () => { - // dispatch({ type: DialogActionType.START_DELETING }) - // closeDialog(DialogType.DELETE) - // dispatch({ type: DialogActionType.DELETE_SUCCESS }) - // dispatch({ type: DialogActionType.RESET_DELETE }) - // } - - // // Handler for form submission - // const handleFormSave = () => { - // dispatch({ type: DialogActionType.START_SUBMITTING }) - // closeDialog(DialogType.EDIT) - // dispatch({ type: DialogActionType.SUBMIT_SUCCESS }) - // dispatch({ type: DialogActionType.RESET_SUBMIT }) - // } - - // // Handler for admin removal - // const handleRemove = () => { - // dispatch({ type: DialogActionType.START_REMOVING }) - // closeDialog(DialogType.REMOVE_ADMIN) - // dispatch({ type: DialogActionType.REMOVE_SUCCESS }) - // dispatch({ type: DialogActionType.RESET_REMOVE }) - // } - - // const handleAdd = () => { - // dispatch({ type: DialogActionType.START_REMOVING }) - // closeDialog(DialogType.SET_ADMIN) - // dispatch({ type: DialogActionType.REMOVE_SUCCESS }) - // dispatch({ type: DialogActionType.RESET_REMOVE }) - // } + const { users: userData, totalPages, page: currentPage, setPage } = useAdminListUsersStore() + const { t } = useTranslationStore() const renderUserListContent = () => { return ( <> - openDialog(DialogType.EDIT, user)} - // onDelete={user => openDialog(DialogType.DELETE, user)} - // onRemoveAdmin={user => openDialog(DialogType.REMOVE_ADMIN, user)} - // onResetPassword={user => openDialog(DialogType.RESET_PASSWORD, user)} - // onSetAdmin={user => openDialog(DialogType.SET_ADMIN, user)} - users={userData as UsersProps[]} - /> + ) } - const handleInviteClick = () => { - navigate('../users/create') - } - return ( @@ -94,23 +30,24 @@ export function UserManagementPage({ Users - {/*
-
- -
- -
*/} - + + + + + + + + + {renderUserListContent()} - {/* setPage(pageNum)} - /> */} + t={t} + />
) From ade6c8d26d138f7b5390ff55203cdaf040ee890a Mon Sep 17 00:00:00 2001 From: sanskar Date: Sat, 21 Dec 2024 17:22:24 +0300 Subject: [PATCH 3/3] fix: lint --- packages/ui/src/views/user-management/user-management-page.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/ui/src/views/user-management/user-management-page.tsx b/packages/ui/src/views/user-management/user-management-page.tsx index d4ad993d9..0e0778d85 100644 --- a/packages/ui/src/views/user-management/user-management-page.tsx +++ b/packages/ui/src/views/user-management/user-management-page.tsx @@ -1,5 +1,3 @@ -import { useNavigate } from 'react-router-dom' - import { Button, ListActions, PaginationComponent, SearchBox, Spacer, Text } from '@/components' import { SandboxLayout } from '@/views' @@ -10,7 +8,6 @@ export const UserManagementPage: React.FC = ({ useAdminListUsersStore, useTranslationStore }) => { - const navigate = useNavigate() const { users: userData, totalPages, page: currentPage, setPage } = useAdminListUsersStore() const { t } = useTranslationStore()