chore: updates

This commit is contained in:
Tristan Yang
2024-09-14 07:25:48 +08:00
parent df993cbfee
commit be4ef8585d
3 changed files with 15 additions and 7 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "vocechat-web",
"version": "0.7.35",
"version": "0.7.36",
"homepage": "https://voce.chat",
"dependencies": {
"@metamask/onboarding": "^1.0.1",
+13 -6
View File
@@ -28,7 +28,10 @@ const MemberList: FC<Props> = ({ cid }) => {
const userMap = useAppSelector((store) => store.users.byId, shallowEqual);
const channels = useAppSelector((store) => store.channels, shallowEqual);
const { uids, input, updateInput } = useFilteredUsers();
const { copyEmail, removeFromChannel, removeUser } = useUserOperation({ cid });
const { copyEmail, canCopyEmail, removeFromChannel, removeUser, showEmailInChannel } =
useUserOperation({
cid
});
const [updateUser, { isSuccess: updateSuccess }] = useUpdateUserMutation();
useEffect(() => {
@@ -67,10 +70,12 @@ const MemberList: FC<Props> = ({ cid }) => {
const { name, email, is_admin } = currUser;
const owner = channel && channel.owner == uid;
const switchRoleVisible = loginUser?.is_admin && loginUser.uid !== uid && uid !== 1;
const dotsVisible = email || loginUser?.is_admin;
let dotsVisible = loginUser?.is_admin;
const canRemove = loginUser?.is_admin && loginUser?.uid != uid && uid !== 1;
const canRemoveFromChannel =
channel && channel.owner == loginUser?.uid && loginUser?.uid != uid;
dotsVisible = [canCopyEmail, canRemove, canRemoveFromChannel].some((i) => i);
return (
<li
key={uid}
@@ -82,9 +87,11 @@ const MemberList: FC<Props> = ({ cid }) => {
<span className="font-bold text-sm text-gray-600 dark:text-white flex items-center gap-1">
{name} {owner && <IconOwner />}
</span>
<span className="hidden md:block text-xs text-gray-500 dark:text-slate-50">
{email}
</span>
{showEmailInChannel && (
<span className="hidden md:block text-xs text-gray-500 dark:text-slate-50">
{email}
</span>
)}
</div>
</div>
<div className="flex items-center gap-7">
@@ -138,7 +145,7 @@ const MemberList: FC<Props> = ({ cid }) => {
trigger="click"
content={
<ul className="min-w-30 context-menu">
{email && (
{canCopyEmail && (
<li className="item" onClick={copyEmail.bind(null, email)}>
{ct("action.copy_email")}
</li>
+1
View File
@@ -144,6 +144,7 @@ const useUserOperation = ({ uid, cid }: IProps) => {
const canRemoveFromContact: boolean = loginUid != uid;
const canInviteChannel = !!cid && (loginUser?.is_admin || channel?.owner == loginUser?.uid);
return {
showEmailInChannel: show_email,
isChannelOwner: loginUser?.uid == channel?.owner || (channel?.is_public && loginUserIsAdmin),
isAdmin: !!user?.is_admin,
updateRole,