diff options
Diffstat (limited to 'app/javascript/flavours/glitch/features/drawer')
-rw-r--r-- | app/javascript/flavours/glitch/features/drawer/header/index.js | 11 | ||||
-rw-r--r-- | app/javascript/flavours/glitch/features/drawer/index.js | 8 |
2 files changed, 18 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/drawer/header/index.js b/app/javascript/flavours/glitch/features/drawer/header/index.js index deec42435..7fefd32c9 100644 --- a/app/javascript/flavours/glitch/features/drawer/header/index.js +++ b/app/javascript/flavours/glitch/features/drawer/header/index.js @@ -46,6 +46,8 @@ const messages = defineMessages({ // The component. export default function DrawerHeader ({ columns, + unreadNotifications, + showNotificationsBadge, intl, onSettingsClick, }) { @@ -77,7 +79,12 @@ export default function DrawerHeader ({ aria-label={intl.formatMessage(messages.notifications)} title={intl.formatMessage(messages.notifications)} to='/notifications' - ><Icon icon='bell' /></Link> + > + <span className='icon-badge-wrapper'> + <Icon icon='bell' /> + { showNotificationsBadge && unreadNotifications > 0 && <div className='icon-badge' />} + </span> + </Link> ))} {renderForColumn('COMMUNITY', ( <Link @@ -112,6 +119,8 @@ export default function DrawerHeader ({ // Props. DrawerHeader.propTypes = { columns: ImmutablePropTypes.list, + unreadNotifications: PropTypes.number, + showNotificationsBadge: PropTypes.bool, intl: PropTypes.object, onSettingsClick: PropTypes.func, }; diff --git a/app/javascript/flavours/glitch/features/drawer/index.js b/app/javascript/flavours/glitch/features/drawer/index.js index 497b7d0e4..038a2513e 100644 --- a/app/javascript/flavours/glitch/features/drawer/index.js +++ b/app/javascript/flavours/glitch/features/drawer/index.js @@ -40,6 +40,8 @@ const mapStateToProps = state => ({ searchHidden: state.getIn(['search', 'hidden']), searchValue: state.getIn(['search', 'value']), submitted: state.getIn(['search', 'submitted']), + unreadNotifications: state.getIn(['notifications', 'unread']), + showNotificationsBadge: state.getIn(['local_settings', 'notifications', 'tab_badge']), }); // Dispatch mapping. @@ -93,6 +95,8 @@ class Drawer extends React.Component { searchValue, submitted, isSearchPage, + unreadNotifications, + showNotificationsBadge, } = this.props; const computedClass = classNames('drawer', `mbstobon-${elefriend}`); @@ -102,6 +106,8 @@ class Drawer extends React.Component { {multiColumn ? ( <DrawerHeader columns={columns} + unreadNotifications={unreadNotifications} + showNotificationsBadge={showNotificationsBadge} intl={intl} onSettingsClick={onOpenSettings} /> @@ -145,6 +151,8 @@ Drawer.propTypes = { searchHidden: PropTypes.bool, searchValue: PropTypes.string, submitted: PropTypes.bool, + unreadNotifications: PropTypes.number, + showNotificationsBadge: PropTypes.bool, // Dispatch props. onChange: PropTypes.func, |