Demetricator fixes, closes #543
This commit is contained in:
parent
7f390ba24e
commit
b7bc013acc
2 changed files with 14 additions and 6 deletions
|
@ -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}`;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue