diff --git a/client/ui/dialog/ChatInfoDialog.tsx b/client/ui/dialog/ChatInfoDialog.tsx index 1ab4046..8f682dc 100644 --- a/client/ui/dialog/ChatInfoDialog.tsx +++ b/client/ui/dialog/ChatInfoDialog.tsx @@ -25,7 +25,7 @@ export default function ChatInfoDialog({ chat, chatInfoDialogRef, openChatFragme setIsFavourited(sharedFavouriteChats.map((v) => v.id).indexOf(chat?.id || '') != -1) }) - let userId: string | null = null + const [userId, setUserId] = React.useState(null) useAsyncEffect(async () => { if (chat?.type == 'private') { const re = await Client.invoke("Chat.getAnotherUserIdFromPrivate", { @@ -34,7 +34,7 @@ export default function ChatInfoDialog({ chat, chatInfoDialogRef, openChatFragme }) if (re.code != 200) return checkApiSuccessOrSncakbar(re, '获取用户失败') - userId = re.data!.user_id as string + setUserId(re.data!.user_id as string) } }, [chat, sharedFavouriteChats]) @@ -50,10 +50,22 @@ export default function ChatInfoDialog({ chat, chatInfoDialogRef, openChatFragme width: '50px', height: '50px', }} onClick={() => avatarUrl && openImageViewer(avatarUrl)} /> - {chat?.title} + flexDirection: 'column', + }}> + {chat?.title} + ID: {chat?.type == 'private' ? userId : chat?.id} + {favourited ? '取消收藏' : '收藏对话'} { chatInfoDialogRef.current!.open = false - openChatFragment(chat.id) + openChatFragment(chat!.id) }}>打开对话