diff options
author | pluralcafe-docker <git@plural.cafe> | 2018-10-01 05:42:11 +0000 |
---|---|---|
committer | pluralcafe-docker <git@plural.cafe> | 2018-10-01 05:42:11 +0000 |
commit | f9275cb762a311cbf298b3929552a153703c0726 (patch) | |
tree | 35797a6c1ae1c51d5e42ffe8b63eecbfb4336f56 /app/javascript/flavours/glitch/features/drawer | |
parent | 2aedb7e83cf7a2c1a7de69d2bc20808f20c10f8f (diff) | |
parent | 4e60a0d5433f5dfa4f71a452cc5c6ceb0f21ceab (diff) |
Merge branch 'glitch'
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 | 16 |
2 files changed, 25 insertions, 2 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 4649e404f..038a2513e 100644 --- a/app/javascript/flavours/glitch/features/drawer/index.js +++ b/app/javascript/flavours/glitch/features/drawer/index.js @@ -2,6 +2,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import { defineMessages } from 'react-intl'; import classNames from 'classnames'; // Actions. @@ -25,6 +26,11 @@ import DrawerSearch from './search'; import { me } from 'flavours/glitch/util/initial_state'; import { wrap } from 'flavours/glitch/util/redux_helpers'; +// Messages. +const messages = defineMessages({ + compose: { id: 'navigation_bar.compose', defaultMessage: 'Compose new toot' }, +}); + // State mapping. const mapStateToProps = state => ({ account: state.getIn(['accounts', me]), @@ -34,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. @@ -87,15 +95,19 @@ class Drawer extends React.Component { searchValue, submitted, isSearchPage, + unreadNotifications, + showNotificationsBadge, } = this.props; const computedClass = classNames('drawer', `mbstobon-${elefriend}`); // The result. return ( - <div className={computedClass}> + <div className={computedClass} role='region' aria-label={intl.formatMessage(messages.compose)}> {multiColumn ? ( <DrawerHeader columns={columns} + unreadNotifications={unreadNotifications} + showNotificationsBadge={showNotificationsBadge} intl={intl} onSettingsClick={onOpenSettings} /> @@ -139,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, |