feat: added invitaion pending pills (#606)

This commit is contained in:
Kunal Vishwakarma 2023-03-30 16:01:24 +05:30 committed by GitHub
parent f5f90dab69
commit c5ccc29418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -189,57 +189,64 @@ const MembersSettings: NextPage<UserAuth> = (props) => {
<p className="text-xs text-gray-500">{member.email}</p> <p className="text-xs text-gray-500">{member.email}</p>
</div> </div>
</div> </div>
<div className="flex items-center gap-2 text-xs"> <div className="flex items-center">
<CustomSelect {!member?.status && (
label={ROLE[member.role as keyof typeof ROLE]} <div className="flex mr-2 px-2 py-1 bg-yellow-200 text-center rounded-full text-xs items-center justify-center">
value={member.role} <p>Pending</p>
onChange={(value: any) => { </div>
workspaceService )}
.updateWorkspaceMember(activeWorkspace?.slug as string, member.id, { <div className="flex items-center gap-2 text-xs">
role: value, <CustomSelect
}) label={ROLE[member.role as keyof typeof ROLE]}
.then(() => { value={member.role}
mutateMembers( onChange={(value: any) => {
(prevData) => workspaceService
prevData?.map((m) => .updateWorkspaceMember(activeWorkspace?.slug as string, member.id, {
m.id === member.id ? { ...m, role: value } : m role: value,
), })
false .then(() => {
); mutateMembers(
setToastAlert({ (prevData) =>
title: "Success", prevData?.map((m) =>
type: "success", m.id === member.id ? { ...m, role: value } : m
message: "Member role updated successfully.", ),
false
);
setToastAlert({
title: "Success",
type: "success",
message: "Member role updated successfully.",
});
})
.catch(() => {
setToastAlert({
title: "Error",
type: "error",
message: "An error occurred while updating member role.",
});
}); });
})
.catch(() => {
setToastAlert({
title: "Error",
type: "error",
message: "An error occurred while updating member role.",
});
});
}}
>
{Object.keys(ROLE).map((key) => (
<CustomSelect.Option key={key} value={key}>
<>{ROLE[parseInt(key) as keyof typeof ROLE]}</>
</CustomSelect.Option>
))}
</CustomSelect>
<CustomMenu ellipsis>
<CustomMenu.MenuItem
onClick={() => {
if (member.member) {
setSelectedRemoveMember(member.id);
} else {
setSelectedInviteRemoveMember(member.id);
}
}} }}
> >
Remove member {Object.keys(ROLE).map((key) => (
</CustomMenu.MenuItem> <CustomSelect.Option key={key} value={key}>
</CustomMenu> <>{ROLE[parseInt(key) as keyof typeof ROLE]}</>
</CustomSelect.Option>
))}
</CustomSelect>
<CustomMenu ellipsis>
<CustomMenu.MenuItem
onClick={() => {
if (member.member) {
setSelectedRemoveMember(member.id);
} else {
setSelectedInviteRemoveMember(member.id);
}
}}
>
Remove member
</CustomMenu.MenuItem>
</CustomMenu>
</div>
</div> </div>
</div> </div>
)) ))