diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-05-26 02:55:37 +0200 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2020-02-22 01:23:32 -0600 |
commit | b569e552d97606a1aa0043d3a4076952311c25fa (patch) | |
tree | 53611501ee35f41788e1fce73f9b1d797a827718 /app/javascript/flavours/glitch/features/ui/components/notifications_counter_icon.js | |
parent | 1e191c0f651ffcb43c2a3f59f341285258ef5132 (diff) |
[Glitch] Improvements to the single column layout
Port 0e445ebb1392c8dbce320509d219f16c7c221406 to glitch-soc Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/ui/components/notifications_counter_icon.js')
-rw-r--r-- | app/javascript/flavours/glitch/features/ui/components/notifications_counter_icon.js | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/app/javascript/flavours/glitch/features/ui/components/notifications_counter_icon.js b/app/javascript/flavours/glitch/features/ui/components/notifications_counter_icon.js index 25df35264..679c02dce 100644 --- a/app/javascript/flavours/glitch/features/ui/components/notifications_counter_icon.js +++ b/app/javascript/flavours/glitch/features/ui/components/notifications_counter_icon.js @@ -1,26 +1,9 @@ -import React from 'react'; -import PropTypes from 'prop-types'; import { connect } from 'react-redux'; -import Icon from 'flavours/glitch/components/icon'; +import IconWithBadge from 'flavours/glitch/components/icon'; const mapStateToProps = state => ({ - count: state.getIn(['notifications', 'unread']), - showBadge: state.getIn(['local_settings', 'notifications', 'tab_badge']), + count: state.getIn(['local_settings', 'notifications', 'tab_badge']) ? state.getIn(['notifications', 'unread']) : 0, + icon: 'bell', }); -const formatNumber = num => num > 99 ? '99+' : num; - -const NotificationsCounterIcon = ({ count, className, showBadge }) => ( - <i className='icon-with-badge'> - <Icon icon='bell' fixedWidth className={className} /> - {showBadge && count > 0 && <i className='icon-with-badge__badge'>{formatNumber(count)}</i>} - </i> -); - -NotificationsCounterIcon.propTypes = { - count: PropTypes.number.isRequired, - showBadge: PropTypes.bool, - className: PropTypes.string, -}; - -export default connect(mapStateToProps)(NotificationsCounterIcon); +export default connect(mapStateToProps)(IconWithBadge); |