Merge branch 'demetricator-fixes' into 'develop'
Demetricator fixes, closes #543 Closes #543 See merge request soapbox-pub/soapbox-fe!416
This commit is contained in:
commit
ca4c3a6fbd
|
@ -2,6 +2,7 @@ import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Helmet } from'react-helmet';
|
import { Helmet } from'react-helmet';
|
||||||
|
import { getSettings } from 'soapbox/actions/settings';
|
||||||
|
|
||||||
const getNotifTotals = state => {
|
const getNotifTotals = state => {
|
||||||
const notifications = state.getIn(['notifications', 'unread'], 0);
|
const notifications = state.getIn(['notifications', 'unread'], 0);
|
||||||
|
@ -11,10 +12,15 @@ const getNotifTotals = state => {
|
||||||
return notifications + chats + reports + approvals;
|
return notifications + chats + reports + approvals;
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => {
|
||||||
siteTitle: state.getIn(['instance', 'title']),
|
const settings = getSettings(state);
|
||||||
unreadCount: getNotifTotals(state),
|
|
||||||
});
|
return {
|
||||||
|
siteTitle: state.getIn(['instance', 'title']),
|
||||||
|
unreadCount: getNotifTotals(state),
|
||||||
|
demetricator: settings.get('demetricator'),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
class SoapboxHelmet extends React.Component {
|
class SoapboxHelmet extends React.Component {
|
||||||
|
|
||||||
|
@ -22,11 +28,12 @@ class SoapboxHelmet extends React.Component {
|
||||||
siteTitle: PropTypes.string,
|
siteTitle: PropTypes.string,
|
||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
unreadCount: PropTypes.number,
|
unreadCount: PropTypes.number,
|
||||||
|
demetricator: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
addCounter = title => {
|
addCounter = title => {
|
||||||
const { unreadCount } = this.props;
|
const { unreadCount, demetricator } = this.props;
|
||||||
if (unreadCount < 1) return title;
|
if (unreadCount < 1 || demetricator) return title;
|
||||||
return `(${unreadCount}) ${title}`;
|
return `(${unreadCount}) ${title}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ body.demetricator {
|
||||||
.account__header__extra__links a > span:first-of-type,
|
.account__header__extra__links a > span:first-of-type,
|
||||||
.detailed-status__link,
|
.detailed-status__link,
|
||||||
.icon-with-badge__badge,
|
.icon-with-badge__badge,
|
||||||
|
.icon-with-counter__counter,
|
||||||
.trends__item__count,
|
.trends__item__count,
|
||||||
.sidebar-menu-profile__stats {
|
.sidebar-menu-profile__stats {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
Loading…
Reference in New Issue