|
|
|
@ -144,18 +144,6 @@ export default class Chat extends Component {
@@ -144,18 +144,6 @@ export default class Chat extends Component {
|
|
|
|
|
this.websocket.send(message); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
disableChat() { |
|
|
|
|
this.setState({ |
|
|
|
|
inputEnabled: false, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
enableChat() { |
|
|
|
|
this.setState({ |
|
|
|
|
inputEnabled: true, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
updateAuthorList(message) { |
|
|
|
|
const { type } = message; |
|
|
|
|
const nameList = this.state.chatUserNames; |
|
|
|
@ -175,7 +163,7 @@ export default class Chat extends Component {
@@ -175,7 +163,7 @@ export default class Chat extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render(props, state) { |
|
|
|
|
const { username, messagesOnly, chatEnabled } = props; |
|
|
|
|
const { username, messagesOnly, chatInputEnabled } = props; |
|
|
|
|
const { messages, inputEnabled, chatUserNames } = state; |
|
|
|
|
|
|
|
|
|
const messageList = messages.map((message) => (html`<${Message} message=${message} username=${username} key=${message.id} />`)); |
|
|
|
@ -193,10 +181,12 @@ export default class Chat extends Component {
@@ -193,10 +181,12 @@ export default class Chat extends Component {
|
|
|
|
|
`);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
html` |
|
|
|
|
return html` |
|
|
|
|
<section id="chat-container-wrap" class="flex flex-col"> |
|
|
|
|
<div id="chat-container" class="bg-gray-800 flex flex-col justify-end overflow-auto"> |
|
|
|
|
<div |
|
|
|
|
id="chat-container" |
|
|
|
|
class="bg-gray-800 flex flex-col justify-end overflow-auto" |
|
|
|
|
> |
|
|
|
|
<div |
|
|
|
|
id="messages-container" |
|
|
|
|
ref=${this.scrollableMessagesContainer} |
|
|
|
@ -206,12 +196,12 @@ export default class Chat extends Component {
@@ -206,12 +196,12 @@ export default class Chat extends Component {
|
|
|
|
|
</div> |
|
|
|
|
<${ChatInput} |
|
|
|
|
chatUserNames=${chatUserNames} |
|
|
|
|
inputEnabled=${chatEnabled && inputEnabled} |
|
|
|
|
inputEnabled=${chatInputEnabled} |
|
|
|
|
handleSendMessage=${this.submitChat} |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
</section> |
|
|
|
|
`);
|
|
|
|
|
`;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|