chore: updates
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vocechat-web",
|
"name": "vocechat-web",
|
||||||
"version": "0.7.35",
|
"version": "0.7.36",
|
||||||
"homepage": "https://voce.chat",
|
"homepage": "https://voce.chat",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@metamask/onboarding": "^1.0.1",
|
"@metamask/onboarding": "^1.0.1",
|
||||||
|
|||||||
@@ -28,7 +28,10 @@ const MemberList: FC<Props> = ({ cid }) => {
|
|||||||
const userMap = useAppSelector((store) => store.users.byId, shallowEqual);
|
const userMap = useAppSelector((store) => store.users.byId, shallowEqual);
|
||||||
const channels = useAppSelector((store) => store.channels, shallowEqual);
|
const channels = useAppSelector((store) => store.channels, shallowEqual);
|
||||||
const { uids, input, updateInput } = useFilteredUsers();
|
const { uids, input, updateInput } = useFilteredUsers();
|
||||||
const { copyEmail, removeFromChannel, removeUser } = useUserOperation({ cid });
|
const { copyEmail, canCopyEmail, removeFromChannel, removeUser, showEmailInChannel } =
|
||||||
|
useUserOperation({
|
||||||
|
cid
|
||||||
|
});
|
||||||
const [updateUser, { isSuccess: updateSuccess }] = useUpdateUserMutation();
|
const [updateUser, { isSuccess: updateSuccess }] = useUpdateUserMutation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -67,10 +70,12 @@ const MemberList: FC<Props> = ({ cid }) => {
|
|||||||
const { name, email, is_admin } = currUser;
|
const { name, email, is_admin } = currUser;
|
||||||
const owner = channel && channel.owner == uid;
|
const owner = channel && channel.owner == uid;
|
||||||
const switchRoleVisible = loginUser?.is_admin && loginUser.uid !== uid && uid !== 1;
|
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 canRemove = loginUser?.is_admin && loginUser?.uid != uid && uid !== 1;
|
||||||
const canRemoveFromChannel =
|
const canRemoveFromChannel =
|
||||||
channel && channel.owner == loginUser?.uid && loginUser?.uid != uid;
|
channel && channel.owner == loginUser?.uid && loginUser?.uid != uid;
|
||||||
|
|
||||||
|
dotsVisible = [canCopyEmail, canRemove, canRemoveFromChannel].some((i) => i);
|
||||||
return (
|
return (
|
||||||
<li
|
<li
|
||||||
key={uid}
|
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">
|
<span className="font-bold text-sm text-gray-600 dark:text-white flex items-center gap-1">
|
||||||
{name} {owner && <IconOwner />}
|
{name} {owner && <IconOwner />}
|
||||||
</span>
|
</span>
|
||||||
<span className="hidden md:block text-xs text-gray-500 dark:text-slate-50">
|
{showEmailInChannel && (
|
||||||
{email}
|
<span className="hidden md:block text-xs text-gray-500 dark:text-slate-50">
|
||||||
</span>
|
{email}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-7">
|
<div className="flex items-center gap-7">
|
||||||
@@ -138,7 +145,7 @@ const MemberList: FC<Props> = ({ cid }) => {
|
|||||||
trigger="click"
|
trigger="click"
|
||||||
content={
|
content={
|
||||||
<ul className="min-w-30 context-menu">
|
<ul className="min-w-30 context-menu">
|
||||||
{email && (
|
{canCopyEmail && (
|
||||||
<li className="item" onClick={copyEmail.bind(null, email)}>
|
<li className="item" onClick={copyEmail.bind(null, email)}>
|
||||||
{ct("action.copy_email")}
|
{ct("action.copy_email")}
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ const useUserOperation = ({ uid, cid }: IProps) => {
|
|||||||
const canRemoveFromContact: boolean = loginUid != uid;
|
const canRemoveFromContact: boolean = loginUid != uid;
|
||||||
const canInviteChannel = !!cid && (loginUser?.is_admin || channel?.owner == loginUser?.uid);
|
const canInviteChannel = !!cid && (loginUser?.is_admin || channel?.owner == loginUser?.uid);
|
||||||
return {
|
return {
|
||||||
|
showEmailInChannel: show_email,
|
||||||
isChannelOwner: loginUser?.uid == channel?.owner || (channel?.is_public && loginUserIsAdmin),
|
isChannelOwner: loginUser?.uid == channel?.owner || (channel?.is_public && loginUserIsAdmin),
|
||||||
isAdmin: !!user?.is_admin,
|
isAdmin: !!user?.is_admin,
|
||||||
updateRole,
|
updateRole,
|
||||||
|
|||||||
Reference in New Issue
Block a user