Chats: replace avatar with unread counter

This commit is contained in:
Alex Gleason 2020-08-27 16:41:24 -05:00
parent a3585305f7
commit 22063ae3c8
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
3 changed files with 11 additions and 3 deletions

View file

@ -59,10 +59,10 @@ class ChatPanes extends ImmutablePureComponent {
const mainWindowPane = ( const mainWindowPane = (
<div className={`pane pane--main pane--${mainWindow}`}> <div className={`pane pane--main pane--${mainWindow}`}>
<div className='pane__header'> <div className='pane__header'>
{unreadCount > 0 && <i className='icon-with-badge__badge'>{shortNumberFormat(unreadCount)}</i>}
<button className='pane__title' onClick={this.handleMainWindowToggle}> <button className='pane__title' onClick={this.handleMainWindowToggle}>
<FormattedMessage id='chat_panels.main_window.title' defaultMessage='Chats' /> <FormattedMessage id='chat_panels.main_window.title' defaultMessage='Chats' />
</button> </button>
{unreadCount > 0 && <i className='icon-with-badge__badge'>{shortNumberFormat(unreadCount)}</i>}
</div> </div>
<div className='pane__content'> <div className='pane__content'>
<ChatList <ChatList

View file

@ -112,11 +112,13 @@ class ChatWindow extends ImmutablePureComponent {
return ( return (
<div className={`pane pane--${pane.get('state')}`} style={{ right: `${right}px` }} onMouseOver={this.handleReadChat}> <div className={`pane pane--${pane.get('state')}`} style={{ right: `${right}px` }} onMouseOver={this.handleReadChat}>
<div className='pane__header'> <div className='pane__header'>
<Avatar account={account} size={18} /> {unreadCount > 0
? <i className='icon-with-badge__badge'>{shortNumberFormat(unreadCount)}</i>
: <Avatar account={account} size={18} />
}
<button className='pane__title' onClick={this.handleChatToggle(chat.get('id'))}> <button className='pane__title' onClick={this.handleChatToggle(chat.get('id'))}>
@{acctFull(account)} @{acctFull(account)}
</button> </button>
{unreadCount > 0 && <i className='icon-with-badge__badge'>{shortNumberFormat(unreadCount)}</i>}
<div className='pane__close'> <div className='pane__close'>
<IconButton icon='close' title='Close chat' onClick={this.handleChatClose(chat.get('id'))} /> <IconButton icon='close' title='Close chat' onClick={this.handleChatClose(chat.get('id'))} />
</div> </div>

View file

@ -71,6 +71,12 @@
.icon-with-badge__badge { .icon-with-badge__badge {
position: static; position: static;
pointer-events: none; pointer-events: none;
width: 18px;
height: 18px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 7px;
} }
} }