Fix unread messages
This commit is contained in:
parent
6d3201d1fe
commit
47ed465252
@ -20,6 +20,9 @@ export default class Toolbar extends React.PureComponent {
|
|||||||
constructor (props) {
|
constructor (props) {
|
||||||
super(props)
|
super(props)
|
||||||
this.file = React.createRef()
|
this.file = React.createRef()
|
||||||
|
this.state = {
|
||||||
|
readMessages: props.messages.length
|
||||||
|
}
|
||||||
}
|
}
|
||||||
handleMicClick = () => {
|
handleMicClick = () => {
|
||||||
const { stream } = this.props
|
const { stream } = this.props
|
||||||
@ -52,16 +55,23 @@ export default class Toolbar extends React.PureComponent {
|
|||||||
.from(event.target.files)
|
.from(event.target.files)
|
||||||
.forEach(file => this.props.onSendFile(file))
|
.forEach(file => this.props.onSendFile(file))
|
||||||
}
|
}
|
||||||
|
handleToggleChat = () => {
|
||||||
|
this.setState({
|
||||||
|
readMessages: this.props.messages.length
|
||||||
|
})
|
||||||
|
this.props.onToggleChat()
|
||||||
|
}
|
||||||
render () {
|
render () {
|
||||||
const { messages, stream } = this.props
|
const { messages, stream } = this.props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="toolbar active">
|
<div className="toolbar active">
|
||||||
<div onClick={this.props.onToggleChat}
|
<div onClick={this.handleToggleChat}
|
||||||
className={classnames('button chat', {
|
className={classnames('button chat', {
|
||||||
on: this.props.chatVisible
|
on: this.props.chatVisible
|
||||||
})}
|
})}
|
||||||
data-blink={this.props.chatVisible && messages.length}
|
data-blink={!this.props.chatVisible &&
|
||||||
|
messages.length > this.state.readMessages}
|
||||||
title="Chat"
|
title="Chat"
|
||||||
>
|
>
|
||||||
<span className="icon icon-question_answer" />
|
<span className="icon icon-question_answer" />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user