移除 UserProfileDialog 并入 ChatInfoDialog
This commit is contained in:
@@ -3,7 +3,6 @@ import data from "../Data.ts"
|
||||
import ChatFragment from "./chat/ChatFragment.tsx"
|
||||
import useEventListener from './useEventListener.ts'
|
||||
import User from "../api/client_data/User.ts"
|
||||
import RecentChat from "../api/client_data/RecentChat.ts"
|
||||
import Avatar from "./Avatar.tsx"
|
||||
|
||||
import * as React from 'react'
|
||||
@@ -21,8 +20,6 @@ import ChatInfoDialog from "./dialog/ChatInfoDialog.tsx"
|
||||
import Chat from "../api/client_data/Chat.ts"
|
||||
import AddContactDialog from './dialog/AddContactDialog.tsx'
|
||||
import CreateGroupDialog from './dialog/CreateGroupDialog.tsx'
|
||||
import UserProfileDialog from "./dialog/UserProfileDialog.tsx"
|
||||
import DataCaches from "../api/DataCaches.ts"
|
||||
import getUrlForFileByHash from "../getUrlForFileByHash.ts"
|
||||
|
||||
declare global {
|
||||
@@ -65,9 +62,6 @@ export default function AppMobile() {
|
||||
const chatInfoDialogRef = React.useRef<Dialog>(null)
|
||||
const [chatInfo, setChatInfo] = React.useState(null as unknown as Chat)
|
||||
|
||||
const userProfileDialogRef = React.useRef<Dialog>(null)
|
||||
const [userInfo, setUserInfo] = React.useState(null as unknown as User)
|
||||
|
||||
const [myUserProfileCache, setMyUserProfileCache] = React.useState(null as unknown as User)
|
||||
|
||||
const [isShowChatFragment, setIsShowChatFragment] = React.useState(false)
|
||||
@@ -112,13 +106,23 @@ export default function AppMobile() {
|
||||
}
|
||||
|
||||
async function openUserInfoDialog(user: User | string) {
|
||||
if (typeof user == 'object') {
|
||||
const re = await Client.invoke("Chat.getIdForPrivate", {
|
||||
token: data.access_token,
|
||||
target: typeof user == 'object' ? user.id : user,
|
||||
})
|
||||
if (re.code != 200) {
|
||||
checkApiSuccessOrSncakbar(re, '获取对话失败')
|
||||
return
|
||||
}
|
||||
|
||||
openChatInfoDialog(re.data as Chat)
|
||||
/* if (typeof user == 'object') {
|
||||
setUserInfo(user)
|
||||
} else {
|
||||
setUserInfo(await DataCaches.getUserProfile(user))
|
||||
|
||||
}
|
||||
userProfileDialogRef.current!.open = true
|
||||
userProfileDialogRef.current!.open = true */
|
||||
}
|
||||
// deno-lint-ignore no-window
|
||||
window.openUserInfoDialog = openUserInfoDialog
|
||||
@@ -167,7 +171,6 @@ export default function AppMobile() {
|
||||
|
||||
<ChatInfoDialog
|
||||
chatInfoDialogRef={chatInfoDialogRef as any}
|
||||
openUserInfoDialog={openUserInfoDialog}
|
||||
sharedFavouriteChats={sharedFavouriteChats}
|
||||
openChatFragment={(id) => {
|
||||
setCurrentChatId(id)
|
||||
@@ -178,15 +181,10 @@ export default function AppMobile() {
|
||||
<MyProfileDialog
|
||||
myProfileDialogRef={myProfileDialogRef as any}
|
||||
user={myUserProfileCache} />
|
||||
<UserProfileDialog
|
||||
chatInfoDialogRef={chatInfoDialogRef as any}
|
||||
userProfileDialogRef={userProfileDialogRef as any}
|
||||
openChatFragment={openChatFragment}
|
||||
user={userInfo} />
|
||||
|
||||
<AddContactDialog
|
||||
addContactDialogRef={addContactDialogRef} />
|
||||
|
||||
|
||||
<CreateGroupDialog
|
||||
createGroupDialogRef={createGroupDialogRef} />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user