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