From 737fea28c65ee1e7a9cdae1ad6ae85189cb4bd10 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com> Date: Fri, 3 Nov 2023 17:20:49 +0530 Subject: [PATCH] chore: refactor and improve project member settings (#2625) * fix: project member setting improvement and refactor * fix: typo fix in automations setting --- .../automation/auto-archive-automation.tsx | 2 +- .../automation/auto-close-automation.tsx | 2 +- web/components/project/member-list-item.tsx | 111 +++++++++--------- 3 files changed, 60 insertions(+), 55 deletions(-) diff --git a/web/components/automation/auto-archive-automation.tsx b/web/components/automation/auto-archive-automation.tsx index 30a7c6251..3e664bef4 100644 --- a/web/components/automation/auto-archive-automation.tsx +++ b/web/components/automation/auto-archive-automation.tsx @@ -38,7 +38,7 @@ export const AutoArchiveAutomation: React.FC = ({ projectDetails, handleC

Auto-archive closed issues

- Plane will auto archive issues that have been completed or canceled. + Plane will auto archive issues that have been completed or cancelled.

diff --git a/web/components/automation/auto-close-automation.tsx b/web/components/automation/auto-close-automation.tsx index f5e284ebf..7da250295 100644 --- a/web/components/automation/auto-close-automation.tsx +++ b/web/components/automation/auto-close-automation.tsx @@ -82,7 +82,7 @@ export const AutoCloseAutomation: React.FC = ({ projectDetails, handleCha

Auto-close issues

- Plane will automatically close issue that haven’t been completed or canceled. + Plane will automatically close issue that haven’t been completed or cancelled.

diff --git a/web/components/project/member-list-item.tsx b/web/components/project/member-list-item.tsx index 8ae783c03..f6b0e833b 100644 --- a/web/components/project/member-list-item.tsx +++ b/web/components/project/member-list-item.tsx @@ -11,9 +11,9 @@ import useToast from "hooks/use-toast"; // components import { ConfirmProjectMemberRemove } from "components/project"; // ui -import { CustomMenu, CustomSelect } from "@plane/ui"; +import { CustomSelect, Tooltip } from "@plane/ui"; // icons -import { ChevronDown, X } from "lucide-react"; +import { ChevronDown, XCircle } from "lucide-react"; // constants import { ROLE } from "constants/workspace"; import { TUserProjectRole } from "types"; @@ -46,9 +46,8 @@ export const ProjectMemberListItem: React.FC = observer((props) => { ); // derived values const user = userStore.currentUser; - const { currentProjectRole } = userStore; + const { currentProjectMemberInfo, currentProjectRole } = userStore; const isAdmin = currentProjectRole === 20; - const isOwner = currentProjectRole === 20; const projectMembers = projectStore.members?.[projectId?.toString()!]; const currentUser = projectMembers?.find((item) => item.member.id === user?.id); @@ -69,7 +68,7 @@ export const ProjectMemberListItem: React.FC = observer((props) => { await projectStore.removeMemberFromProject( workspaceSlug.toString(), projectId.toString(), - selectedRemoveMember + selectedRemoveMember.id ); } // if the user is an invite @@ -77,7 +76,7 @@ export const ProjectMemberListItem: React.FC = observer((props) => { await projectInvitationService.deleteProjectInvitation( workspaceSlug.toString(), projectId.toString(), - selectedInviteRemoveMember + selectedInviteRemoveMember.id ); mutate(`PROJECT_INVITATIONS_${projectId.toString()}`); } @@ -89,59 +88,62 @@ export const ProjectMemberListItem: React.FC = observer((props) => { }); }} /> - -
-
+
+
{member.avatar && member.avatar !== "" ? ( -
- {member.display_name} -
- ) : member.display_name || member.email ? ( -
- {(member.display_name || member.email)?.charAt(0)} -
+ + + {member.display_name + + ) : ( -
- ? -
+ + + {(member.display_name ?? member.email ?? "?")[0]} + + )} +
{member.member ? ( - - - {member.first_name} {member.last_name} - - ({member.display_name}) + + {member.first_name} {member.last_name} ) : ( -

{member.display_name || member.email}

+

{member.display_name || member.email}

)} - {isOwner &&

{member.email}

} +

{member.email ?? member.display_name}

-
- {!member.member && ( -
- Pending + +
+ {!member?.status && ( +
+

Pending

)} + +
{ROLE[member.role as keyof typeof ROLE]} - {member.memberId !== user?.id && } + {member.memberId !== currentProjectMemberInfo?.id && ( + + + + )}
} value={member.role} @@ -168,31 +170,34 @@ export const ProjectMemberListItem: React.FC = observer((props) => { !member.member || (currentUser && currentUser.role !== 20 && currentUser.role < member.role) } + placement="bottom-end" > {Object.keys(ROLE).map((key) => { - if (currentUser && currentUser.role !== 20 && currentUser.role < parseInt(key)) return null; + if (currentProjectRole && currentProjectRole !== 20 && currentProjectRole < parseInt(key)) return null; return ( - + <>{ROLE[parseInt(key) as keyof typeof ROLE]} ); })}
- - { - if (member.member) setSelectedRemoveMember(member.id); - else setSelectedInviteRemoveMember(member.id); - }} + {isAdmin && ( + - - - - {member.memberId !== user?.id ? "Remove member" : "Leave project"} - - - + + + )}