diff --git a/src/pages/Dashboard/SyncStatusCards/ConsensusClientCard.tsx b/src/pages/Dashboard/SyncStatusCards/ConsensusClientCard.tsx index 4fad44a9..857f571f 100644 --- a/src/pages/Dashboard/SyncStatusCards/ConsensusClientCard.tsx +++ b/src/pages/Dashboard/SyncStatusCards/ConsensusClientCard.tsx @@ -3,7 +3,7 @@ import { Shadow, Text } from '@status-im/components' import { SwapIcon } from '@status-im/icons' import { CSSProperties } from 'react' -import { formatNumberWithComa } from '../../../utilities' +import { formatNumbersWithComa } from '../../../utilities' import IconText from '../../../components/General/IconText' import Icon from '../../../components/General/Icon' import StandardGauge from '../../../components/Charts/StandardGauge' @@ -20,7 +20,7 @@ const ConsensusCard = ({ value, total, isTop }: ConsensusCardProps) => { { id: 'storage', label: 'Used', - value, + value:value, color: '#ff6161', }, { @@ -61,7 +61,7 @@ const ConsensusCard = ({ value, total, isTop }: ConsensusCardProps) => { }>Syncing - {formatNumberWithComa(value)} / {formatNumberWithComa(total)} + {formatNumbersWithComa(value)} / {formatNumbersWithComa(total)} diff --git a/src/pages/Dashboard/SyncStatusCards/ExecutionClientCard.tsx b/src/pages/Dashboard/SyncStatusCards/ExecutionClientCard.tsx index 0e0dd7ef..75dbbcb3 100644 --- a/src/pages/Dashboard/SyncStatusCards/ExecutionClientCard.tsx +++ b/src/pages/Dashboard/SyncStatusCards/ExecutionClientCard.tsx @@ -3,7 +3,7 @@ import { Shadow, Text } from '@status-im/components' import { SwapIcon } from '@status-im/icons' import { CSSProperties } from 'react' -import { formatNumberWithComa } from '../../../utilities' +import { formatNumbersWithComa } from '../../../utilities' import IconText from '../../../components/General/IconText' import StandardGauge from '../../../components/Charts/StandardGauge' @@ -62,7 +62,7 @@ const ExecutionClientCard = ({ value, total, isTop }: ExecutionClientCardProps) }>Syncing - {formatNumberWithComa(value)} / {formatNumberWithComa(total)} + {formatNumbersWithComa(value)} / {formatNumbersWithComa(total)} diff --git a/src/utilities.ts b/src/utilities.ts index d99c6768..786c99a5 100644 --- a/src/utilities.ts +++ b/src/utilities.ts @@ -25,9 +25,11 @@ export const convertSecondsToTimerFormat = (seconds: number) => { return `${String(minutes).padStart(2, '0')}:${String(remainingSeconds).padStart(2, '0')}` } -export const formatNumberWithComa = (n: number): string => { - return n.toFixed(3).replace(/\./g, ',') -} +export const formatNumbersWithComa = (n: number): string => { + const parts = n.toString().split('.'); + parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ','); + return parts.join('.'); +}; export const getMonthIndicesFromRange = (range: DateRange) => { if (!range.from || !range.to) return [0, 11]