diff --git a/web/src/ChatBox.js b/web/src/ChatBox.js index 6b631c68..cb0e0cc4 100644 --- a/web/src/ChatBox.js +++ b/web/src/ChatBox.js @@ -13,8 +13,9 @@ // limitations under the License. import React from "react"; -import {Avatar, Input, List} from "antd"; +import {Avatar, Input, List, Spin} from "antd"; import {CopyOutlined, DislikeOutlined, LikeOutlined, SendOutlined} from "@ant-design/icons"; +import i18next from "i18next"; const {TextArea} = Input; @@ -29,7 +30,7 @@ class ChatBox extends React.Component { } componentDidUpdate(prevProps) { - if (prevProps.messages !== this.props.messages) { + if (prevProps.messages !== this.props.messages && this.props.messages !== null) { this.scrollToListItem(this.props.messages.length); } } @@ -74,11 +75,19 @@ class ChatBox extends React.Component { }; renderList() { + if (this.props.messages === undefined || this.props.messages === null) { + return ( +
+ +
+ ); + } + return (
{ if (Object.keys(item).length === 0 && item.constructor === Object) { return { const chat = chats[i]; - this.getMessages(chat.name); this.setState({ chatName: chat.name, + messages: null, }); + this.getMessages(chat.name); }} />
-
-
+ { + this.state.messages === null ? null : ( +
+
+ ) + } {this.sendMessage(text);}} account={this.props.account} />