Merge branch 'hovercard-chat' into 'develop'
Hovercard chat See merge request soapbox-pub/soapbox-fe!229
This commit is contained in:
commit
aabb1abf97
3 changed files with 25 additions and 12 deletions
|
@ -3,6 +3,7 @@ import { connect } from 'react-redux';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import { injectIntl } from 'react-intl';
|
import { injectIntl } from 'react-intl';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import Avatar from 'soapbox/components/avatar';
|
import Avatar from 'soapbox/components/avatar';
|
||||||
import { acctFull } from 'soapbox/utils/accounts';
|
import { acctFull } from 'soapbox/utils/accounts';
|
||||||
|
@ -75,12 +76,12 @@ class ChatRoom extends ImmutablePureComponent {
|
||||||
<Column>
|
<Column>
|
||||||
<div className='chatroom__back'>
|
<div className='chatroom__back'>
|
||||||
<ColumnBackButton />
|
<ColumnBackButton />
|
||||||
<div className='chatroom__header'>
|
<Link to={`/@${account.get('acct')}`} className='chatroom__header'>
|
||||||
<Avatar account={account} size={18} />
|
<Avatar account={account} size={18} />
|
||||||
<div className='chatroom__title'>
|
<div className='chatroom__title'>
|
||||||
@{acctFull(account)}
|
@{acctFull(account)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<ChatBox
|
<ChatBox
|
||||||
chatId={chat.get('id')}
|
chatId={chat.get('id')}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import {
|
||||||
} from 'soapbox/actions/chats';
|
} from 'soapbox/actions/chats';
|
||||||
import ChatBox from './chat_box';
|
import ChatBox from './chat_box';
|
||||||
import { shortNumberFormat } from 'soapbox/utils/numbers';
|
import { shortNumberFormat } from 'soapbox/utils/numbers';
|
||||||
|
import HoverRefWrapper from 'soapbox/components/hover_ref_wrapper';
|
||||||
|
|
||||||
const mapStateToProps = (state, { pane }) => ({
|
const mapStateToProps = (state, { pane }) => ({
|
||||||
me: state.get('me'),
|
me: state.get('me'),
|
||||||
|
@ -79,13 +80,24 @@ class ChatWindow extends ImmutablePureComponent {
|
||||||
const right = (285 * (idx + 1)) + 20;
|
const right = (285 * (idx + 1)) + 20;
|
||||||
const unreadCount = chat.get('unread');
|
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 (
|
return (
|
||||||
<div className={`pane pane--${pane.get('state')}`} style={{ right: `${right}px` }}>
|
<div className={`pane pane--${pane.get('state')}`} style={{ right: `${right}px` }}>
|
||||||
<div className='pane__header'>
|
<div className='pane__header'>
|
||||||
{unreadCount > 0
|
{unreadCount > 0 ? unreadIcon : avatar }
|
||||||
? <i className='icon-with-badge__badge'>{shortNumberFormat(unreadCount)}</i>
|
|
||||||
: <Link to={`/@${account.get('acct')}`}><Avatar account={account} size={18} /></Link>
|
|
||||||
}
|
|
||||||
<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>
|
||||||
|
|
|
@ -56,26 +56,26 @@ class UserPanel extends ImmutablePureComponent {
|
||||||
|
|
||||||
<div className='user-panel__stats-block'>
|
<div className='user-panel__stats-block'>
|
||||||
|
|
||||||
<div className='user-panel-stats-item'>
|
{account.get('statuses_count') && <div className='user-panel-stats-item'>
|
||||||
<Link to={`/@${account.get('acct')}`} title={intl.formatNumber(account.get('statuses_count'))}>
|
<Link to={`/@${account.get('acct')}`} title={intl.formatNumber(account.get('statuses_count'))}>
|
||||||
<strong className='user-panel-stats-item__value'>{shortNumberFormat(account.get('statuses_count'))}</strong>
|
<strong className='user-panel-stats-item__value'>{shortNumberFormat(account.get('statuses_count'))}</strong>
|
||||||
<span className='user-panel-stats-item__label'><FormattedMessage className='user-panel-stats-item__label' id='account.posts' defaultMessage='Posts' /></span>
|
<span className='user-panel-stats-item__label'><FormattedMessage className='user-panel-stats-item__label' id='account.posts' defaultMessage='Posts' /></span>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>}
|
||||||
|
|
||||||
<div className='user-panel-stats-item'>
|
{account.get('followers_count') && <div className='user-panel-stats-item'>
|
||||||
<Link to={`/@${account.get('acct')}/followers`} title={intl.formatNumber(account.get('followers_count'))}>
|
<Link to={`/@${account.get('acct')}/followers`} title={intl.formatNumber(account.get('followers_count'))}>
|
||||||
<strong className='user-panel-stats-item__value'>{shortNumberFormat(account.get('followers_count'))}</strong>
|
<strong className='user-panel-stats-item__value'>{shortNumberFormat(account.get('followers_count'))}</strong>
|
||||||
<span className='user-panel-stats-item__label'><FormattedMessage id='account.followers' defaultMessage='Followers' /></span>
|
<span className='user-panel-stats-item__label'><FormattedMessage id='account.followers' defaultMessage='Followers' /></span>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>}
|
||||||
|
|
||||||
<div className='user-panel-stats-item'>
|
{account.get('following_count') && <div className='user-panel-stats-item'>
|
||||||
<Link to={`/@${account.get('acct')}/following`} title={intl.formatNumber(account.get('following_count'))}>
|
<Link to={`/@${account.get('acct')}/following`} title={intl.formatNumber(account.get('following_count'))}>
|
||||||
<strong className='user-panel-stats-item__value'>{shortNumberFormat(account.get('following_count'))}</strong>
|
<strong className='user-panel-stats-item__value'>{shortNumberFormat(account.get('following_count'))}</strong>
|
||||||
<span className='user-panel-stats-item__label'><FormattedMessage className='user-panel-stats-item__label' id='account.follows' defaultMessage='Follows' /></span>
|
<span className='user-panel-stats-item__label'><FormattedMessage className='user-panel-stats-item__label' id='account.follows' defaultMessage='Follows' /></span>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue