From 45754503ca11082950d398624d3a583a3b629d15 Mon Sep 17 00:00:00 2001
From: mgabdev <>
Date: Tue, 16 Jul 2019 14:50:37 -0400
Subject: [PATCH] Updated notification badge number formatter
fixes: #44
---
.../gabsocial/components/icon_with_badge.js | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/app/javascript/gabsocial/components/icon_with_badge.js b/app/javascript/gabsocial/components/icon_with_badge.js
index aa87f425..c42b9337 100644
--- a/app/javascript/gabsocial/components/icon_with_badge.js
+++ b/app/javascript/gabsocial/components/icon_with_badge.js
@@ -1,14 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';
import Icon from 'gabsocial/components/icon';
+import { shortNumberFormat } from 'gabsocial/utils/numbers';
-const formatNumber = num => num > 40 ? '40+' : num;
+const IconWithBadge = ({ id, count, className }) => {
+ if (count < 1) return null;
-const IconWithBadge = ({ id, count, className }) => (
-
- {count > 0 && {formatNumber(count)}}
-
-);
+ return (
+
+ {count > 0 && {shortNumberFormat(count)}}
+
+ )
+};
IconWithBadge.propTypes = {
id: PropTypes.string.isRequired,
@@ -16,4 +19,4 @@ IconWithBadge.propTypes = {
className: PropTypes.string,
};
-export default IconWithBadge;
\ No newline at end of file
+export default IconWithBadge;