fixes #278, large awaiting approval button

timeline-tab-hover-styles
Mary Kate 2020-08-10 12:23:59 -05:00
rodzic 5998f52e9f
commit 6ac0c615fe
2 zmienionych plików z 9 dodań i 3 usunięć

Wyświetl plik

@ -63,7 +63,7 @@ class ProfileHoverCardContainer extends ImmutablePureComponent {
<span className='relationship-tag'> <span className='relationship-tag'>
<FormattedMessage id='account.follows_you' defaultMessage='Follows you' /> <FormattedMessage id='account.follows_you' defaultMessage='Follows you' />
</span>} </span>}
<div className='profile-hover-card__action-button'><ActionButton account={account} /></div> <div className='profile-hover-card__action-button'><ActionButton account={account} small /></div>
<UserPanel className='profile-hover-card__user' accountId={accountId} /> <UserPanel className='profile-hover-card__user' accountId={accountId} />
{badges.length > 0 && {badges.length > 0 &&
<div className='profile-hover-card__badges'> <div className='profile-hover-card__badges'>

Wyświetl plik

@ -17,6 +17,7 @@ const messages = defineMessages({
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' }, unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
follow: { id: 'account.follow', defaultMessage: 'Follow' }, follow: { id: 'account.follow', defaultMessage: 'Follow' },
requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' }, requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' },
requested_small: { id: 'account.requested_small', defaultMessage: 'Awaiting approval' },
unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' }, unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' }, edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' },
}); });
@ -55,8 +56,13 @@ class ActionButton extends ImmutablePureComponent {
onFollow: PropTypes.func.isRequired, onFollow: PropTypes.func.isRequired,
onBlock: PropTypes.func.isRequired, onBlock: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
small: PropTypes.bool,
}; };
static defaultProps = {
small: false,
}
componentDidMount() { componentDidMount() {
window.addEventListener('resize', this.handleResize, { passive: true }); window.addEventListener('resize', this.handleResize, { passive: true });
} }
@ -74,7 +80,7 @@ class ActionButton extends ImmutablePureComponent {
} }
render() { render() {
const { account, intl, me } = this.props; const { account, intl, me, small } = this.props;
let actionBtn = null; let actionBtn = null;
if (!account || !me) return actionBtn; if (!account || !me) return actionBtn;
@ -83,7 +89,7 @@ class ActionButton extends ImmutablePureComponent {
if (!account.get('relationship')) { // Wait until the relationship is loaded if (!account.get('relationship')) { // Wait until the relationship is loaded
// //
} else if (account.getIn(['relationship', 'requested'])) { } else if (account.getIn(['relationship', 'requested'])) {
actionBtn = <Button className='logo-button' text={intl.formatMessage(messages.requested)} onClick={this.handleFollow} />; actionBtn = <Button className='logo-button' text={small ? intl.formatMessage(messages.requested_small) : intl.formatMessage(messages.requested)} onClick={this.handleFollow} />;
} else if (!account.getIn(['relationship', 'blocking'])) { } else if (!account.getIn(['relationship', 'blocking'])) {
actionBtn = <Button disabled={account.getIn(['relationship', 'blocked_by'])} className={classNames('logo-button', { 'button--destructive': account.getIn(['relationship', 'following']) })} text={intl.formatMessage(account.getIn(['relationship', 'following']) ? messages.unfollow : messages.follow)} onClick={this.handleFollow} />; actionBtn = <Button disabled={account.getIn(['relationship', 'blocked_by'])} className={classNames('logo-button', { 'button--destructive': account.getIn(['relationship', 'following']) })} text={intl.formatMessage(account.getIn(['relationship', 'following']) ? messages.unfollow : messages.follow)} onClick={this.handleFollow} />;
} else if (account.getIn(['relationship', 'blocking'])) { } else if (account.getIn(['relationship', 'blocking'])) {