Merge branch '0-dashcounter' into 'develop'
Admin: fix display of 0% retention See merge request soapbox-pub/soapbox-fe!877
This commit is contained in:
commit
6d94d172fc
|
@ -12,6 +12,7 @@ import sourceCode from 'soapbox/utils/code';
|
||||||
import { getSubscribersCsv, getUnsubscribersCsv, getCombinedCsv } from 'soapbox/actions/email_list';
|
import { getSubscribersCsv, getUnsubscribersCsv, getCombinedCsv } from 'soapbox/actions/email_list';
|
||||||
import { getFeatures } from 'soapbox/utils/features';
|
import { getFeatures } from 'soapbox/utils/features';
|
||||||
import { isAdmin } from 'soapbox/utils/accounts';
|
import { isAdmin } from 'soapbox/utils/accounts';
|
||||||
|
import { isNumber } from 'soapbox/utils/numbers';
|
||||||
|
|
||||||
// https://stackoverflow.com/a/53230807
|
// https://stackoverflow.com/a/53230807
|
||||||
const download = (response, filename) => {
|
const download = (response, filename) => {
|
||||||
|
@ -102,16 +103,18 @@ class Dashboard extends ImmutablePureComponent {
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
{retention && <div className='dashcounter'>
|
{isNumber(retention) && (
|
||||||
<div>
|
<div className='dashcounter'>
|
||||||
<div className='dashcounter__num'>
|
<div>
|
||||||
{retention}%
|
<div className='dashcounter__num'>
|
||||||
</div>
|
{retention}%
|
||||||
<div className='dashcounter__label'>
|
</div>
|
||||||
<FormattedMessage id='admin.dashcounters.retention_label' defaultMessage='user retention' />
|
<div className='dashcounter__label'>
|
||||||
|
<FormattedMessage id='admin.dashcounters.retention_label' defaultMessage='user retention' />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>}
|
)}
|
||||||
<div className='dashcounter'>
|
<div className='dashcounter'>
|
||||||
<Link to='/timeline/local'>
|
<Link to='/timeline/local'>
|
||||||
<div className='dashcounter__num'>
|
<div className='dashcounter__num'>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FormattedNumber } from 'react-intl';
|
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 => {
|
export const shortNumberFormat = number => {
|
||||||
if (!isNumber(number)) return '•';
|
if (!isNumber(number)) return '•';
|
||||||
|
|
Loading…
Reference in New Issue