From 2b7d2afe4fa407626efd9f03a78737aec8405a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20T=C3=B3rz?= Date: Fri, 18 Aug 2023 12:17:19 +0200 Subject: [PATCH] update statistics design --- .../pages/home/components/HomeStatistics.tsx | 54 +++++++++++-------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/packages/frontend/src/view/pages/home/components/HomeStatistics.tsx b/packages/frontend/src/view/pages/home/components/HomeStatistics.tsx index 54b15d863..3b1542cef 100644 --- a/packages/frontend/src/view/pages/home/components/HomeStatistics.tsx +++ b/packages/frontend/src/view/pages/home/components/HomeStatistics.tsx @@ -1,7 +1,6 @@ import classNames from 'classnames' import React from 'react' -import { formatInt } from '../../../../utils/formatting/formatAmount' import { Card } from '../../../components/Card' import { SectionHeading } from '../../../components/SectionHeading' @@ -28,37 +27,37 @@ export function HomeStatistics({ {showL2Transactions && ( - <> - - + )} - + {!showL2Transactions && ( + + )} ) @@ -76,12 +75,25 @@ function StatisticsItem({ return (
-
{title}
-
{formatInt(value)}
+ {title} + + {formatStatisticsCount(value)} + + + # of all current {title.toLowerCase()} +
) } + +function formatStatisticsCount(count: number) { + if (count < 1000000) { + return count.toString() + } + + return `${(count / 1000000).toFixed(2).replace('.', ',')}M` +}