2019-08-07 06:02:36 +01:00
|
|
|
import { shortNumberFormat } from '../../utils/numbers';
|
|
|
|
|
|
|
|
const mapStateToProps = state => ({
|
|
|
|
count: state.getIn(['notifications', 'unread']),
|
|
|
|
});
|
|
|
|
|
2020-02-25 16:04:44 +00:00
|
|
|
export default
|
|
|
|
@connect(mapStateToProps)
|
2019-08-07 06:02:36 +01:00
|
|
|
class NotificationCounter extends PureComponent {
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
count: PropTypes.number.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { count } = this.props;
|
|
|
|
|
|
|
|
if (count < 1) return null;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<span className='notification-counter'>{shortNumberFormat(count)}</span>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|