From c9fffbeb122a71e1dbf6d05a6c7a56880aaeb6d5 Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Sat, 22 Nov 2025 23:51:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=B1=E4=BA=8E=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=AF=AD=E6=B3=95=E6=A3=80=E6=9F=A5=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E4=B8=80=E7=B3=BB=E5=88=97=E7=AC=A6=E5=8F=B7=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1=E9=97=AE=E9=A2=98,=20=E6=94=AF=E6=8C=81=E6=89=93?= =?UTF-8?q?=E5=BC=80=E7=BE=A4=E6=88=90=E5=91=98=E7=9A=84=E8=B5=84=E6=96=99?= =?UTF-8?q?=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ui/chat/GroupMembersList.tsx | 1 + client/ui/chat/GroupMembersListItem.tsx | 102 +++++++++++++----------- client/ui/chat/JoinRequestsList.tsx | 6 +- client/ui/chat/JoinRequestsListItem.tsx | 1 - 4 files changed, 59 insertions(+), 51 deletions(-) diff --git a/client/ui/chat/GroupMembersList.tsx b/client/ui/chat/GroupMembersList.tsx index 5284ba5..fbdb853 100644 --- a/client/ui/chat/GroupMembersList.tsx +++ b/client/ui/chat/GroupMembersList.tsx @@ -73,6 +73,7 @@ export default function GroupMembersList({ ).map((v) => ) } diff --git a/client/ui/chat/GroupMembersListItem.tsx b/client/ui/chat/GroupMembersListItem.tsx index b19da42..3b51a53 100644 --- a/client/ui/chat/GroupMembersListItem.tsx +++ b/client/ui/chat/GroupMembersListItem.tsx @@ -3,12 +3,18 @@ import Avatar from "../Avatar.tsx" import React from 'react' import User from "../../api/client_data/User.ts" import getUrlForFileByHash from "../../getUrlForFileByHash.ts" +import Client from "../../api/Client.ts" +import data from "../../Data.ts" +import Chat from "../../api/client_data/Chat.ts" +import { checkApiSuccessOrSncakbar, snackbar } from "../snackbar.ts" +import EventBus from "../../EventBus.ts" interface Args extends React.HTMLAttributes { user: User + chat: Chat } -export default function GroupMembersListItem({ user }: Args) { +export default function GroupMembersListItem({ user, chat }: Args) { const { id, nickname, avatar_file_hash } = user const itemRef = React.useRef(null) @@ -16,54 +22,60 @@ export default function GroupMembersListItem({ user }: Args) { + }} ref={itemRef} onClick={() => { + // deno-lint-ignore no-window + window.openUserInfoDialog(user) + }}> {nickname}
- dialog({ - headline: "移除群组成员", - description: `确定要移除 ${nickname} 吗?`, - actions: [ - { - text: "取消", - onClick: () => { - return true + { + e.stopPropagation() + dialog({ + headline: "移除群组成员", + description: `确定要移除 ${nickname} 吗?`, + actions: [ + { + text: "取消", + onClick: () => { + return true + }, }, - }, - { - text: "确定", - onClick: () => { - ;(async () => { - const re = await Client.invoke("Chat.removeMembers", { - token: data.access_token, - chat_id: target, - user_ids: [ - id - ], - }) - if (re.code != 200) - checkApiSuccessOrSncakbar(re, "移除群组成员失败") - EventBus.emit('GroupMembersList.updateMembers') - snackbar({ - message: `已移除 ${nickname}`, - placement: "top", - action: "撤销操作", - onActionClick: async () => { - const re = await Client.invoke("User.addContacts", { - token: data.access_token, - targets: ls, - }) - if (re.code != 200) - checkApiSuccessOrSncakbar(re, "恢复所选收藏失败") - EventBus.emit('ContactsList.updateContacts') - } - }) - })() - return true - }, - } - ], - })}> + { + text: "确定", + onClick: () => { + ; (async () => { + const re = await Client.invoke("Chat.removeMembers", { + token: data.access_token, + chat_id: chat.id, + user_ids: [ + id + ], + }) + if (re.code != 200) + checkApiSuccessOrSncakbar(re, "移除群组成员失败") + EventBus.emit('GroupMembersList.updateMembers') + snackbar({ + message: `已移除 ${nickname}`, + placement: "top", + /* action: "撤销操作", + onActionClick: async () => { + const re = await Client.invoke("User.addContacts", { + token: data.access_token, + targets: ls, + }) + if (re.code != 200) + checkApiSuccessOrSncakbar(re, "恢复所选收藏失败") + EventBus.emit('ContactsList.updateContacts') + } */ + }) + })() + return true + }, + } + ], + }) + }}>
) diff --git a/client/ui/chat/JoinRequestsList.tsx b/client/ui/chat/JoinRequestsList.tsx index 8ed022a..a08bd84 100644 --- a/client/ui/chat/JoinRequestsList.tsx +++ b/client/ui/chat/JoinRequestsList.tsx @@ -1,16 +1,12 @@ import { TextField } from "mdui" -import RecentChat from "../../api/client_data/RecentChat.ts" import useEventListener from "../useEventListener.ts" -import RecentsListItem from "./JoinRequestsListItem.tsx" import React from "react" -import useAsyncEffect from "../useAsyncEffect.ts" import Client from "../../api/Client.ts" import { checkApiSuccessOrSncakbar } from "../snackbar.ts" import data from "../../Data.ts" import EventBus from "../../EventBus.ts" -import isMobileUI from "../isMobileUI.ts" import JoinRequest from "../../api/client_data/JoinRequest.ts" -import JoinRequestsListItem from "./JoinRequestsListItem.tsx"; +import JoinRequestsListItem from "./JoinRequestsListItem.tsx" import Chat from "../../api/client_data/Chat.ts" interface Args extends React.HTMLAttributes { diff --git a/client/ui/chat/JoinRequestsListItem.tsx b/client/ui/chat/JoinRequestsListItem.tsx index e1e0bdd..c7c8f59 100644 --- a/client/ui/chat/JoinRequestsListItem.tsx +++ b/client/ui/chat/JoinRequestsListItem.tsx @@ -1,5 +1,4 @@ import { $ } from "mdui/jq" -import RecentChat from "../../api/client_data/RecentChat.ts" import Avatar from "../Avatar.tsx" import React from 'react' import JoinRequest from "../../api/client_data/JoinRequest.ts"