fix(chat) removed unread msgs counter on chat open

This commit is contained in:
Calin Chitu 2021-06-24 12:29:51 +03:00 committed by Дамян Минков
parent 35c7f156db
commit 7945f14cee
1 changed files with 15 additions and 3 deletions

View File

@ -13,7 +13,12 @@ type Props = {
/** /**
* The value of to display as a count. * The value of to display as a count.
*/ */
_count: number _count: number,
/**
* True if the chat window should be rendered.
*/
_isOpen: boolean
}; };
/** /**
@ -33,8 +38,12 @@ class ChatCounter extends Component<Props> {
render() { render() {
return ( return (
<span className = 'badge-round'> <span className = 'badge-round'>
<span> <span>
{ this.props._count || null } {
!this.props._isOpen
&& (this.props._count || null)
}
</span> </span>
</span> </span>
); );
@ -52,8 +61,11 @@ class ChatCounter extends Component<Props> {
* }} * }}
*/ */
function _mapStateToProps(state) { function _mapStateToProps(state) {
const { isOpen } = state['features/chat'];
return { return {
_count: getUnreadCount(state) _count: getUnreadCount(state),
_isOpen: isOpen
}; };
} }