feat: 在对话中打开对话详情对话框
This commit is contained in:
@@ -19,6 +19,7 @@ import EventBus from "../../EventBus.ts";
|
|||||||
interface Args extends React.HTMLAttributes<HTMLElement> {
|
interface Args extends React.HTMLAttributes<HTMLElement> {
|
||||||
target: string
|
target: string
|
||||||
showReturnButton?: boolean
|
showReturnButton?: boolean
|
||||||
|
openChatInfoDialog: (chat: Chat) => void
|
||||||
onReturnButtonClicked?: () => void
|
onReturnButtonClicked?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ const markedInstance = new marked.Marked({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
export default function ChatFragment({ target, showReturnButton, onReturnButtonClicked, ...props }: Args) {
|
export default function ChatFragment({ target, showReturnButton, onReturnButtonClicked, openChatInfoDialog, ...props }: Args) {
|
||||||
const [messagesList, setMessagesList] = React.useState([] as Message[])
|
const [messagesList, setMessagesList] = React.useState([] as Message[])
|
||||||
const [chatInfo, setChatInfo] = React.useState({
|
const [chatInfo, setChatInfo] = React.useState({
|
||||||
title: '加載中...'
|
title: '加載中...'
|
||||||
@@ -108,7 +109,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
|||||||
}
|
}
|
||||||
function callback(data: unknown) {
|
function callback(data: unknown) {
|
||||||
EventBus.emit('RecentsList.updateRecents')
|
EventBus.emit('RecentsList.updateRecents')
|
||||||
|
|
||||||
const { chat, msg } = (data as OnMessageData)
|
const { chat, msg } = (data as OnMessageData)
|
||||||
if (target == chat) {
|
if (target == chat) {
|
||||||
setMessagesList(messagesList.concat([msg]))
|
setMessagesList(messagesList.concat([msg]))
|
||||||
@@ -226,6 +227,14 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
|||||||
}</mdui-tab>
|
}</mdui-tab>
|
||||||
<mdui-tab value="Settings">設定</mdui-tab>
|
<mdui-tab value="Settings">設定</mdui-tab>
|
||||||
<mdui-tab value="None" style={{ display: 'none' }}></mdui-tab>
|
<mdui-tab value="None" style={{ display: 'none' }}></mdui-tab>
|
||||||
|
<div style={{
|
||||||
|
flexGrow: '1',
|
||||||
|
}}></div>
|
||||||
|
<mdui-button-icon icon="info" onClick={() => openChatInfoDialog(chatInfo)} style={{
|
||||||
|
alignSelf: 'center',
|
||||||
|
marginLeft: '5px',
|
||||||
|
marginRight: '5px',
|
||||||
|
}}></mdui-button-icon>
|
||||||
|
|
||||||
<mdui-tab-panel slot="panel" value="Chat" ref={chatPanelRef} style={{
|
<mdui-tab-panel slot="panel" value="Chat" ref={chatPanelRef} style={{
|
||||||
display: tabItemSelected == "Chat" ? "flex" : "none",
|
display: tabItemSelected == "Chat" ? "flex" : "none",
|
||||||
|
|||||||
Reference in New Issue
Block a user