Demetricator fixes, closes #543

This commit is contained in:
Alex Gleason 2021-01-15 13:10:50 -06:00
parent 7f390ba24e
commit b7bc013acc
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 14 additions and 6 deletions

View file

@ -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}`;
}

View file

@ -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;