diff --git a/app/soapbox/components/icon_with_counter.js b/app/soapbox/components/icon_with_counter.js
new file mode 100644
index 000000000..0daf608da
--- /dev/null
+++ b/app/soapbox/components/icon_with_counter.js
@@ -0,0 +1,23 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import Icon from 'soapbox/components/icon';
+import { shortNumberFormat } from 'soapbox/utils/numbers';
+
+const IconWithCounter = ({ icon, count, fixedWidth }) => {
+ return (
+
+
+ {count > 0 &&
+ {shortNumberFormat(count)}
+ }
+
+ );
+};
+
+IconWithCounter.propTypes = {
+ icon: PropTypes.string.isRequired,
+ count: PropTypes.number.isRequired,
+ fixedWidth: PropTypes.bool,
+};
+
+export default IconWithCounter;
diff --git a/app/soapbox/features/admin/components/admin_nav.js b/app/soapbox/features/admin/components/admin_nav.js
index 12a53b3fd..47076abf8 100644
--- a/app/soapbox/features/admin/components/admin_nav.js
+++ b/app/soapbox/features/admin/components/admin_nav.js
@@ -1,12 +1,16 @@
import React from 'react';
import { connect } from 'react-redux';
+import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Icon from 'soapbox/components/icon';
+import IconWithCounter from 'soapbox/components/icon_with_counter';
import { NavLink } from 'react-router-dom';
import { FormattedMessage } from 'react-intl';
const mapStateToProps = (state, props) => ({
instance: state.get('instance'),
+ approvalCount: state.getIn(['admin', 'awaitingApproval']).count(),
+ reportsCount: state.getIn(['admin', 'open_report_count']),
});
export default @connect(mapStateToProps)
@@ -14,10 +18,12 @@ class AdminNav extends React.PureComponent {
static propTypes = {
instance: ImmutablePropTypes.map.isRequired,
+ approvalCount: PropTypes.number,
+ reportsCount: PropTypes.number,
};
render() {
- const { instance } = this.props;
+ const { instance, approvalCount, reportsCount } = this.props;
return (
<>
@@ -28,12 +34,12 @@ class AdminNav extends React.PureComponent {
-
+
{instance.get('approval_required') && (
-
+
)}
diff --git a/app/styles/components/promo-panel.scss b/app/styles/components/promo-panel.scss
index e2030cee6..78625e338 100644
--- a/app/styles/components/promo-panel.scss
+++ b/app/styles/components/promo-panel.scss
@@ -28,7 +28,8 @@
}
}
- &__icon {
+ &__icon,
+ .icon-with-counter {
margin-right: 12px;
}
}
diff --git a/app/styles/ui.scss b/app/styles/ui.scss
index a2ca21a06..0b4fa30d3 100644
--- a/app/styles/ui.scss
+++ b/app/styles/ui.scss
@@ -699,3 +699,29 @@
text-align: center;
}
}
+
+.icon-with-counter {
+ position: relative;
+ display: inline;
+
+ &__counter {
+ @include font-montserrat;
+ @include font-size(14);
+ @include line-height(14);
+ position: absolute;
+ box-sizing: border-box;
+ left: 8px;
+ top: -12px;
+ min-width: 16px;
+ height: 16px;
+ padding: 1px 3px 0;
+ border-radius: 8px;
+ text-align: center;
+ color: #fff;
+ background: var(--accent-color);
+
+ @media screen and (max-width: 895px) {
+ top: 0;
+ }
+ }
+}