Add unread notifications badge to the mobile navbar
This commit is contained in:
parent
2cdc00bc8b
commit
b28cbb8b25
|
@ -4,10 +4,32 @@ import { NavLink, withRouter } from 'react-router-dom';
|
|||
import { FormattedMessage, injectIntl } from 'react-intl';
|
||||
import { debounce } from 'lodash';
|
||||
import { isUserTouching } from 'flavours/glitch/util/is_mobile';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
unreadNotifications: state.getIn(['notifications', 'unread']),
|
||||
});
|
||||
|
||||
@connect(mapStateToProps)
|
||||
class NotificationsIcon extends React.PureComponent {
|
||||
static propTypes = {
|
||||
unreadNotifications: PropTypes.number,
|
||||
};
|
||||
|
||||
render() {
|
||||
const { unreadNotifications } = this.props;
|
||||
return (
|
||||
<span className='icon-badge-wrapper'>
|
||||
<i className='fa fa-fw fa-bell' />
|
||||
{ unreadNotifications > 0 && <div className='icon-badge' />}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export const links = [
|
||||
<NavLink className='tabs-bar__link primary' to='/timelines/home' data-preview-title-id='column.home' data-preview-icon='home' ><i className='fa fa-fw fa-home' /><FormattedMessage id='tabs_bar.home' defaultMessage='Home' /></NavLink>,
|
||||
<NavLink className='tabs-bar__link primary' to='/notifications' data-preview-title-id='column.notifications' data-preview-icon='bell' ><i className='fa fa-fw fa-bell' /><FormattedMessage id='tabs_bar.notifications' defaultMessage='Notifications' /></NavLink>,
|
||||
<NavLink className='tabs-bar__link primary' to='/notifications' data-preview-title-id='column.notifications' data-preview-icon='bell' ><NotificationsIcon /><FormattedMessage id='tabs_bar.notifications' defaultMessage='Notifications' /></NavLink>,
|
||||
|
||||
<NavLink className='tabs-bar__link secondary' to='/timelines/public/local' data-preview-title-id='column.community' data-preview-icon='users' ><i className='fa fa-fw fa-users' /><FormattedMessage id='tabs_bar.local_timeline' defaultMessage='Local' /></NavLink>,
|
||||
<NavLink className='tabs-bar__link secondary' exact to='/timelines/public' data-preview-title-id='column.public' data-preview-icon='globe' ><i className='fa fa-fw fa-globe' /><FormattedMessage id='tabs_bar.federated_timeline' defaultMessage='Federated' /></NavLink>,
|
||||
|
|
|
@ -571,7 +571,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
span {
|
||||
span:last-child {
|
||||
margin-left: 5px;
|
||||
display: none;
|
||||
}
|
||||
|
|
Reference in New Issue