Hovercard: put hovercard on chat window

better-thread-display
Alex Gleason 2020-09-11 13:04:31 -05:00
rodzic ed6b876e07
commit d6a39b3e09
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 16 dodań i 4 usunięć

Wyświetl plik

@ -14,6 +14,7 @@ import {
} from 'soapbox/actions/chats';
import ChatBox from './chat_box';
import { shortNumberFormat } from 'soapbox/utils/numbers';
import HoverRefWrapper from 'soapbox/components/hover_ref_wrapper';
const mapStateToProps = (state, { pane }) => ({
me: state.get('me'),
@ -79,13 +80,24 @@ class ChatWindow extends ImmutablePureComponent {
const right = (285 * (idx + 1)) + 20;
const unreadCount = chat.get('unread');
const unreadIcon = (
<i className='icon-with-badge__badge'>
{shortNumberFormat(unreadCount)}
</i>
);
const avatar = (
<HoverRefWrapper accountId={account.get('id')}>
<Link to={`/@${account.get('acct')}`}>
<Avatar account={account} size={18} />
</Link>
</HoverRefWrapper>
);
return (
<div className={`pane pane--${pane.get('state')}`} style={{ right: `${right}px` }}>
<div className='pane__header'>
{unreadCount > 0
? <i className='icon-with-badge__badge'>{shortNumberFormat(unreadCount)}</i>
: <Link to={`/@${account.get('acct')}`}><Avatar account={account} size={18} /></Link>
}
{unreadCount > 0 ? unreadIcon : avatar }
<button className='pane__title' onClick={this.handleChatToggle(chat.get('id'))}>
@{acctFull(account)}
</button>