From a4a5a08c31d9c09cba9c61688094fa6feff56f6f Mon Sep 17 00:00:00 2001 From: Alexandre Bourdin Date: Tue, 22 Aug 2023 15:30:34 +0200 Subject: [PATCH] Merge pull request #14256 from overleaf/ab-unmanaged-remove-from-group-dropdown-action [web] Add Remove from group action in dropdown for unmanaged/pending users GitOrigin-RevId: daa66598e42befa2f8430bdf118e907a8758d60e --- .../components/group-members-list.tsx | 13 +- .../components/group-members.tsx | 138 ++----------- .../managed-user-dropdown-button.tsx | 23 ++- .../managed-users/managed-user-row.tsx | 10 +- .../managed-users/managed-users-list.tsx | 13 +- .../context/group-members-context.tsx | 194 ++++++++++++++++++ .../hooks/use-user-selection.ts | 1 - .../components/dropdown/menu-item-button.tsx | 8 +- .../web/frontend/js/infrastructure/promise.js | 19 +- .../group-management/group-members.js | 10 +- .../stylesheets/modules/managed-users.less | 4 + .../components/group-members.spec.tsx | 9 +- .../managed-group-members.spec.tsx | 20 +- .../managed-user-dropdown-button.spec.tsx | 86 ++++++-- .../managed-users/managed-user-row.spec.tsx | 191 +++++------------ .../managed-users/managed-users-list.spec.tsx | 50 +++-- services/web/types/group-management/user.ts | 4 +- 17 files changed, 445 insertions(+), 348 deletions(-) create mode 100644 services/web/frontend/js/features/group-management/context/group-members-context.tsx diff --git a/services/web/frontend/js/features/group-management/components/group-members-list.tsx b/services/web/frontend/js/features/group-management/components/group-members-list.tsx index 55cf6b2e1a..8da85c3822 100644 --- a/services/web/frontend/js/features/group-management/components/group-members-list.tsx +++ b/services/web/frontend/js/features/group-management/components/group-members-list.tsx @@ -1,25 +1,20 @@ import { Col, Row } from 'react-bootstrap' import { useTranslation } from 'react-i18next' -import { User } from '../../../../../types/group-management/user' import Tooltip from '../../../shared/components/tooltip' +import { useGroupMembersContext } from '../context/group-members-context' import GroupMemberRow from './group-member-row' type GroupMembersListProps = { handleSelectAllClick: (e: any) => void - selectedUsers: User[] - users: User[] - selectUser: (user: User) => void - unselectUser: (user: User) => void } export default function GroupMembersList({ handleSelectAllClick, - selectedUsers, - users, - selectUser, - unselectUser, }: GroupMembersListProps) { const { t } = useTranslation() + const { selectedUsers, users, selectUser, unselectUser } = + useGroupMembersContext() + return (