diff --git a/client/ui/chat-fragment/ChatFragment.tsx b/client/ui/chat-fragment/ChatFragment.tsx index 7ad16b3..c29ac05 100644 --- a/client/ui/chat-fragment/ChatFragment.tsx +++ b/client/ui/chat-fragment/ChatFragment.tsx @@ -12,6 +12,7 @@ import PreferenceUpdater from "../preference/PreferenceUpdater" import SwitchPreference from "../preference/SwitchPreference" import TextFieldPreference from "../preference/TextFieldPreference" import * as React from 'react' +import ChatMessageContainer from "./ChatMessageContainer" interface MduiTabFitSizeArgs extends React.HTMLAttributes { value: string @@ -34,7 +35,7 @@ export default function ChatFragment({ }) { const nav = useNavigate() - const [tabItemSelected, setTabItemSelected] = React.useState('None') + const [tabItemSelected, setTabItemSelected] = React.useState('Chat') const tabRef = React.useRef() useEventListener(tabRef, 'change', () => { tabRef.current != null && setTabItemSelected(tabRef.current!.value as string) @@ -43,8 +44,6 @@ export default function ChatFragment({ const chatPanelRef = React.useRef() const inputRef = React.useRef() - - return
{ - chatInfo.isMember() ? <> - {chatInfo.getTitle()} - {chatInfo.getType() == 'group' && chatInfo.isAdmin() && 加入请求} - {chatInfo.getType() == 'group' && 群组成员} - - : {chatInfo.getTitle()} - } - {chatInfo.getType() == 'group' && 设置} - -
- { - window.open('/chat?id=' + chatInfo.getId(), '_blank') + }}> + { + chatInfo.isMember() ? <> + {chatInfo.getTitle()} + {chatInfo.getType() == 'group' && chatInfo.isAdmin() && 加入请求} + {chatInfo.getType() == 'group' && 群组成员} + + : {chatInfo.getTitle()} + } + {chatInfo.getType() == 'group' && 设置} +
+ { + window.open('/chat?id=' + chatInfo.getId(), '_blank') - }} style={{ - alignSelf: 'center', - marginLeft: '5px', - marginRight: '5px', - }}> - { + }} style={{ + alignSelf: 'center', + marginLeft: '5px', + marginRight: '5px', + }}> + { - }} style={{ - alignSelf: 'center', - marginLeft: '5px', - marginRight: '5px', - }}> - gotoChatInfo(nav, chatInfo.getId())} style={{ - alignSelf: 'center', - marginLeft: '5px', - marginRight: '5px', - }}> + }} style={{ + alignSelf: 'center', + marginLeft: '5px', + marginRight: '5px', + }}>
+ gotoChatInfo(nav, chatInfo.getId())} style={{ + alignSelf: 'center', + marginLeft: '5px', + marginRight: '5px', + }}> + {/* 这里显示一些提示 */}
-
- {/* 消息放在这里 */} -
+ { // 输入框 } @@ -301,20 +292,5 @@ export default function ChatFragment({ ) } - -
- -
-
} diff --git a/client/ui/chat-fragment/ChatMessageContainer.tsx b/client/ui/chat-fragment/ChatMessageContainer.tsx new file mode 100644 index 0000000..54acbdb --- /dev/null +++ b/client/ui/chat-fragment/ChatMessageContainer.tsx @@ -0,0 +1,24 @@ +import { Chat, Message } from 'lingchair-client-protocol' +import * as React from 'react' + +export default function ChatMessageContainer({ + chatInfo, +}: { + chatInfo: Chat +}) { + const [messages, setMessages] = React.useState() + + return ( +
+ {messages?.map((v) => v.getText())} +
+ ) +} diff --git a/client/ui/chat-fragment/LazyChatFragment.tsx b/client/ui/chat-fragment/LazyChatFragment.tsx index 3d9ef74..6c2d021 100644 --- a/client/ui/chat-fragment/LazyChatFragment.tsx +++ b/client/ui/chat-fragment/LazyChatFragment.tsx @@ -9,7 +9,8 @@ import EffectOnly from "../EffectOnly" export default function LazyChatFragment({ chatId, openedWithRouter }: { chatId: string, openedWithRouter: boolean }) { return { const s = showSnackbar({ - message: '请稍后', + message: '请稍后...', + autoCloseDelay: 0, }) return () => { s.open = false