feat: set role shortcut in context menu

This commit is contained in:
Tristan Yang
2023-06-09 16:38:26 +08:00
parent a81c087163
commit ffe4d83c6c
5 changed files with 48 additions and 10 deletions
+9 -1
View File
@@ -29,7 +29,10 @@ const Profile: FC<Props> = ({ uid, type = "embed", cid }) => {
removeFromChannel,
canRemoveFromChannel,
canRemove,
removeUser
removeUser,
isAdmin,
canUpdateRole,
updateRole
} = useUserOperation({ uid, cid });
const { data } = useAppSelector((store) => {
@@ -99,6 +102,11 @@ const Profile: FC<Props> = ({ uid, type = "embed", cid }) => {
{t("copy_email")}
</li>
)}
{canUpdateRole && (
<li className="item" onClick={updateRole}>
{isAdmin ? t("set_normal") : t("set_admin")}
</li>
)}
{canRemoveFromChannel && (
<li className="item danger" onClick={removeFromChannel.bind(null, uid)}>
{t("remove_from_channel")}