2020-05-27 17:16:42 -07:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2020-05-27 17:36:23 -07:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2020-05-27 17:16:42 -07:00
|
|
|
|
2020-05-27 17:36:23 -07:00
|
|
|
const messages = defineMessages({
|
2020-06-06 12:06:45 -07:00
|
|
|
following: {
|
|
|
|
id: 'morefollows.following_label',
|
|
|
|
defaultMessage: '…and {count} more {count, plural, one {follow} other {follows}} on remote sites.',
|
2020-05-27 17:36:23 -07:00
|
|
|
},
|
2020-06-06 12:06:45 -07:00
|
|
|
followers: {
|
|
|
|
id: 'morefollows.followers_label',
|
|
|
|
defaultMessage: '…and {count} more {count, plural, one {follower} other {followers}} on remote sites.',
|
2020-05-27 17:36:23 -07:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
export default @injectIntl
|
|
|
|
class MoreFollows extends React.PureComponent {
|
2020-05-27 17:16:42 -07:00
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
visible: PropTypes.bool,
|
2020-05-27 17:36:23 -07:00
|
|
|
count: PropTypes.number,
|
|
|
|
type: PropTypes.string,
|
|
|
|
intl: PropTypes.object.isRequired,
|
2020-05-27 17:16:42 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
visible: true,
|
|
|
|
}
|
|
|
|
|
2020-05-27 17:36:23 -07:00
|
|
|
getMessage = () => {
|
|
|
|
const { type, count, intl } = this.props;
|
2020-06-06 12:06:45 -07:00
|
|
|
return intl.formatMessage(messages[type], { count });
|
2020-05-27 17:36:23 -07:00
|
|
|
}
|
2020-05-27 17:16:42 -07:00
|
|
|
|
2020-05-27 17:36:23 -07:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div className='morefollows-indicator'>
|
|
|
|
<div>
|
|
|
|
<div className='morefollows-indicator__label' style={{ visibility: this.props.visible ? 'visible' : 'hidden' }}>
|
|
|
|
{this.getMessage()}
|
2020-05-27 17:16:42 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-05-27 17:36:23 -07:00
|
|
|
</div>
|
|
|
|
);
|
2020-05-27 17:16:42 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|