2023-05-28 07:18:23 -05:00
|
|
|
import { PureComponent } from 'react';
|
2023-05-28 09:38:10 -05:00
|
|
|
|
2023-05-07 14:43:25 -05:00
|
|
|
import { FormattedMessage, FormattedNumber } from 'react-intl';
|
2023-05-28 09:38:10 -05:00
|
|
|
|
|
|
|
import { NavLink } from 'react-router-dom';
|
|
|
|
|
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
|
2024-01-12 04:31:24 -06:00
|
|
|
import InfoIcon from '@material-symbols/svg-600/outlined/info.svg?react';
|
2023-10-24 12:45:08 -05:00
|
|
|
|
2023-05-08 20:11:56 -05:00
|
|
|
import { Icon } from 'flavours/glitch/components/icon';
|
2016-11-18 08:36:16 -06:00
|
|
|
|
2023-05-28 07:18:23 -05:00
|
|
|
class ActionBar extends PureComponent {
|
2016-09-23 13:23:26 -05:00
|
|
|
|
2017-05-12 07:44:10 -05:00
|
|
|
static propTypes = {
|
|
|
|
account: ImmutablePropTypes.map.isRequired,
|
|
|
|
};
|
|
|
|
|
2018-09-21 00:17:44 -05:00
|
|
|
isStatusesPageActive = (match, location) => {
|
|
|
|
if (!match) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return !location.pathname.match(/\/(followers|following)\/?$/);
|
2023-02-03 13:52:07 -06:00
|
|
|
};
|
2018-09-21 00:17:44 -05:00
|
|
|
|
2016-09-23 13:23:26 -05:00
|
|
|
render () {
|
2023-05-07 14:43:25 -05:00
|
|
|
const { account } = this.props;
|
2016-10-02 08:14:26 -05:00
|
|
|
|
2020-09-28 11:00:49 -05:00
|
|
|
if (account.get('suspended')) {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div className='account__disclaimer'>
|
2023-10-24 12:45:08 -05:00
|
|
|
<Icon id='info-circle' icon={InfoIcon} /> <FormattedMessage
|
2020-09-28 11:00:49 -05:00
|
|
|
id='account.suspended_disclaimer_full'
|
2023-02-03 13:52:07 -06:00
|
|
|
defaultMessage='This user has been suspended by a moderator.'
|
2020-09-28 11:00:49 -05:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-02-28 18:18:34 -06:00
|
|
|
let extraInfo = '';
|
2016-09-23 13:23:26 -05:00
|
|
|
|
2017-02-28 19:00:21 -06:00
|
|
|
if (account.get('acct') !== account.get('username')) {
|
2017-07-24 13:05:29 -05:00
|
|
|
extraInfo = (
|
|
|
|
<div className='account__disclaimer'>
|
2023-10-24 12:45:08 -05:00
|
|
|
<Icon id='info-circle' icon={InfoIcon} /> <FormattedMessage
|
2017-07-24 13:05:29 -05:00
|
|
|
id='account.disclaimer_full'
|
|
|
|
defaultMessage="Information below may reflect the user's profile incompletely."
|
|
|
|
/>
|
|
|
|
{' '}
|
|
|
|
<a target='_blank' rel='noopener' href={account.get('url')}>
|
|
|
|
<FormattedMessage id='account.view_full_profile' defaultMessage='View full profile' />
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
);
|
2018-08-31 05:33:32 -05:00
|
|
|
}
|
|
|
|
|
2016-09-23 13:23:26 -05:00
|
|
|
return (
|
2017-07-24 13:05:29 -05:00
|
|
|
<div>
|
|
|
|
{extraInfo}
|
|
|
|
|
|
|
|
<div className='account__action-bar'>
|
|
|
|
<div className='account__action-bar-links'>
|
2021-09-25 22:46:13 -05:00
|
|
|
<NavLink isActive={this.isStatusesPageActive} activeClassName='active' className='account__action-bar__tab' to={`/@${account.get('acct')}`}>
|
2018-07-30 06:21:48 -05:00
|
|
|
<FormattedMessage id='account.posts' defaultMessage='Posts' />
|
2017-07-24 13:05:29 -05:00
|
|
|
<strong><FormattedNumber value={account.get('statuses_count')} /></strong>
|
2018-09-13 04:20:21 -05:00
|
|
|
</NavLink>
|
2017-07-24 13:05:29 -05:00
|
|
|
|
2021-09-25 22:46:13 -05:00
|
|
|
<NavLink exact activeClassName='active' className='account__action-bar__tab' to={`/@${account.get('acct')}/following`}>
|
2018-07-30 06:21:48 -05:00
|
|
|
<FormattedMessage id='account.follows' defaultMessage='Follows' />
|
2017-07-24 13:05:29 -05:00
|
|
|
<strong><FormattedNumber value={account.get('following_count')} /></strong>
|
2018-09-13 04:20:21 -05:00
|
|
|
</NavLink>
|
2017-07-24 13:05:29 -05:00
|
|
|
|
2021-09-25 22:46:13 -05:00
|
|
|
<NavLink exact activeClassName='active' className='account__action-bar__tab' to={`/@${account.get('acct')}/followers`}>
|
2018-07-30 06:21:48 -05:00
|
|
|
<FormattedMessage id='account.followers' defaultMessage='Followers' />
|
2018-12-17 14:23:44 -06:00
|
|
|
<strong>{ account.get('followers_count') < 0 ? '-' : <FormattedNumber value={account.get('followers_count')} /> }</strong>
|
2018-09-13 04:20:21 -05:00
|
|
|
</NavLink>
|
2017-07-24 13:05:29 -05:00
|
|
|
</div>
|
2016-10-09 15:19:15 -05:00
|
|
|
</div>
|
2016-09-23 13:23:26 -05:00
|
|
|
</div>
|
|
|
|
);
|
2016-11-16 10:20:52 -06:00
|
|
|
}
|
2016-09-23 13:23:26 -05:00
|
|
|
|
2017-04-21 13:05:35 -05:00
|
|
|
}
|
2023-03-24 17:15:25 -05:00
|
|
|
|
2023-05-07 14:43:25 -05:00
|
|
|
export default ActionBar;
|