From 164a150fbb38ea9eb49f209f443bf645ffc883f7 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 16 Nov 2021 07:12:55 -0600 Subject: [PATCH] Admin: fix display of 0% retention --- app/soapbox/features/admin/index.js | 19 +++++++++++-------- app/soapbox/utils/numbers.js | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/soapbox/features/admin/index.js b/app/soapbox/features/admin/index.js index b09affd66..e80ae1231 100644 --- a/app/soapbox/features/admin/index.js +++ b/app/soapbox/features/admin/index.js @@ -12,6 +12,7 @@ import sourceCode from 'soapbox/utils/code'; import { getSubscribersCsv, getUnsubscribersCsv, getCombinedCsv } from 'soapbox/actions/email_list'; import { getFeatures } from 'soapbox/utils/features'; import { isAdmin } from 'soapbox/utils/accounts'; +import { isNumber } from 'soapbox/utils/numbers'; // https://stackoverflow.com/a/53230807 const download = (response, filename) => { @@ -102,16 +103,18 @@ class Dashboard extends ImmutablePureComponent { - {retention &&
-
-
- {retention}% -
-
- + {isNumber(retention) && ( +
+
+
+ {retention}% +
+
+ +
-
} + )}
diff --git a/app/soapbox/utils/numbers.js b/app/soapbox/utils/numbers.js index 434473b40..8191692b3 100644 --- a/app/soapbox/utils/numbers.js +++ b/app/soapbox/utils/numbers.js @@ -1,7 +1,7 @@ import React from 'react'; import { FormattedNumber } from 'react-intl'; -const isNumber = number => typeof number === 'number' && !isNaN(number); +export const isNumber = number => typeof number === 'number' && !isNaN(number); export const shortNumberFormat = number => { if (!isNumber(number)) return '•';