Add preferences for notification badges

This commit is contained in:
Thibaut Girka
2018-09-06 20:55:11 +02:00
committed by ThibG
parent ba4521b175
commit 324ce93368
6 changed files with 39 additions and 6 deletions

View File

@@ -8,20 +8,22 @@ import { connect } from 'react-redux';
const mapStateToProps = state => ({
unreadNotifications: state.getIn(['notifications', 'unread']),
showBadge: state.getIn(['local_settings', 'notifications', 'tab_badge']),
});
@connect(mapStateToProps)
class NotificationsIcon extends React.PureComponent {
static propTypes = {
unreadNotifications: PropTypes.number,
showBadge: PropTypes.bool,
};
render() {
const { unreadNotifications } = this.props;
const { unreadNotifications, showBadge } = this.props;
return (
<span className='icon-badge-wrapper'>
<i className='fa fa-fw fa-bell' />
{ unreadNotifications > 0 && <div className='icon-badge' />}
{ showBadge && unreadNotifications > 0 && <div className='icon-badge' />}
</span>
);
}