diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-03-10 17:29:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-10 17:29:15 +0100 |
commit | 2c8bb1745359a3bf200d37383dc56d5951e2b6bc (patch) | |
tree | 6b22f1ab7e96c9223760de2a74dc1d4d985f7758 /app/javascript/flavours/glitch/components/admin/Counter.js | |
parent | 02133866e6915e37431298b396e1aded1e4c44c5 (diff) | |
parent | 43bce02a7ae78954be8857f547434c56ac59fa59 (diff) |
Merge pull request #1715 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/flavours/glitch/components/admin/Counter.js')
-rw-r--r-- | app/javascript/flavours/glitch/components/admin/Counter.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/javascript/flavours/glitch/components/admin/Counter.js b/app/javascript/flavours/glitch/components/admin/Counter.js index 2bc9ce482..ecb242950 100644 --- a/app/javascript/flavours/glitch/components/admin/Counter.js +++ b/app/javascript/flavours/glitch/components/admin/Counter.js @@ -68,12 +68,12 @@ export default class Counter extends React.PureComponent { ); } else { const measure = data[0]; - const percentChange = percIncrease(measure.previous_total * 1, measure.total * 1); + const percentChange = measure.previous_total && percIncrease(measure.previous_total * 1, measure.total * 1); content = ( <React.Fragment> - <span className='sparkline__value__total'><FormattedNumber value={measure.total} /></span> - <span className={classNames('sparkline__value__change', { positive: percentChange > 0, negative: percentChange < 0 })}>{percentChange > 0 && '+'}<FormattedNumber value={percentChange} style='percent' /></span> + <span className='sparkline__value__total'>{measure.human_value || <FormattedNumber value={measure.total} />}</span> + {measure.previous_total && (<span className={classNames('sparkline__value__change', { positive: percentChange > 0, negative: percentChange < 0 })}>{percentChange > 0 && '+'}<FormattedNumber value={percentChange} style='percent' /></span>)} </React.Fragment> ); } |