From b7bc013acc9620a60486e3670680f10ae5c262d5 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 15 Jan 2021 13:10:50 -0600 Subject: [PATCH] Demetricator fixes, closes #543 --- app/soapbox/components/helmet.js | 19 +++++++++++++------ app/styles/demetricator.scss | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/soapbox/components/helmet.js b/app/soapbox/components/helmet.js index d89b36aae..e6da9b15e 100644 --- a/app/soapbox/components/helmet.js +++ b/app/soapbox/components/helmet.js @@ -2,6 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { Helmet } from'react-helmet'; +import { getSettings } from 'soapbox/actions/settings'; const getNotifTotals = state => { const notifications = state.getIn(['notifications', 'unread'], 0); @@ -11,10 +12,15 @@ const getNotifTotals = state => { return notifications + chats + reports + approvals; }; -const mapStateToProps = state => ({ - siteTitle: state.getIn(['instance', 'title']), - unreadCount: getNotifTotals(state), -}); +const mapStateToProps = state => { + const settings = getSettings(state); + + return { + siteTitle: state.getIn(['instance', 'title']), + unreadCount: getNotifTotals(state), + demetricator: settings.get('demetricator'), + }; +}; class SoapboxHelmet extends React.Component { @@ -22,11 +28,12 @@ class SoapboxHelmet extends React.Component { siteTitle: PropTypes.string, children: PropTypes.node, unreadCount: PropTypes.number, + demetricator: PropTypes.bool, }; addCounter = title => { - const { unreadCount } = this.props; - if (unreadCount < 1) return title; + const { unreadCount, demetricator } = this.props; + if (unreadCount < 1 || demetricator) return title; return `(${unreadCount}) ${title}`; } diff --git a/app/styles/demetricator.scss b/app/styles/demetricator.scss index c57d1287b..fc2c4bafb 100644 --- a/app/styles/demetricator.scss +++ b/app/styles/demetricator.scss @@ -3,6 +3,7 @@ body.demetricator { .account__header__extra__links a > span:first-of-type, .detailed-status__link, .icon-with-badge__badge, + .icon-with-counter__counter, .trends__item__count, .sidebar-menu-profile__stats { display: none;