fix formatNumbersWithComa
This commit is contained in:
parent
fc65965e18
commit
55ac55b53b
|
@ -3,7 +3,7 @@ import { Shadow, Text } from '@status-im/components'
|
||||||
import { SwapIcon } from '@status-im/icons'
|
import { SwapIcon } from '@status-im/icons'
|
||||||
import { CSSProperties } from 'react'
|
import { CSSProperties } from 'react'
|
||||||
|
|
||||||
import { formatNumberWithComa } from '../../../utilities'
|
import { formatNumbersWithComa } from '../../../utilities'
|
||||||
import IconText from '../../../components/General/IconText'
|
import IconText from '../../../components/General/IconText'
|
||||||
import Icon from '../../../components/General/Icon'
|
import Icon from '../../../components/General/Icon'
|
||||||
import StandardGauge from '../../../components/Charts/StandardGauge'
|
import StandardGauge from '../../../components/Charts/StandardGauge'
|
||||||
|
@ -20,7 +20,7 @@ const ConsensusCard = ({ value, total, isTop }: ConsensusCardProps) => {
|
||||||
{
|
{
|
||||||
id: 'storage',
|
id: 'storage',
|
||||||
label: 'Used',
|
label: 'Used',
|
||||||
value,
|
value:value,
|
||||||
color: '#ff6161',
|
color: '#ff6161',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ const ConsensusCard = ({ value, total, isTop }: ConsensusCardProps) => {
|
||||||
<XStack space={'$3'} style={{ padding: '12px 16px' }}>
|
<XStack space={'$3'} style={{ padding: '12px 16px' }}>
|
||||||
<IconText icon={<SwapIcon size={16} />}>Syncing</IconText>
|
<IconText icon={<SwapIcon size={16} />}>Syncing</IconText>
|
||||||
<Text size={13} weight={'semibold'}>
|
<Text size={13} weight={'semibold'}>
|
||||||
{formatNumberWithComa(value)} / {formatNumberWithComa(total)}
|
{formatNumbersWithComa(value)} / {formatNumbersWithComa(total)}
|
||||||
</Text>
|
</Text>
|
||||||
</XStack>
|
</XStack>
|
||||||
</YStack>
|
</YStack>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { Shadow, Text } from '@status-im/components'
|
||||||
import { SwapIcon } from '@status-im/icons'
|
import { SwapIcon } from '@status-im/icons'
|
||||||
import { CSSProperties } from 'react'
|
import { CSSProperties } from 'react'
|
||||||
|
|
||||||
import { formatNumberWithComa } from '../../../utilities'
|
import { formatNumbersWithComa } from '../../../utilities'
|
||||||
import IconText from '../../../components/General/IconText'
|
import IconText from '../../../components/General/IconText'
|
||||||
|
|
||||||
import StandardGauge from '../../../components/Charts/StandardGauge'
|
import StandardGauge from '../../../components/Charts/StandardGauge'
|
||||||
|
@ -62,7 +62,7 @@ const ExecutionClientCard = ({ value, total, isTop }: ExecutionClientCardProps)
|
||||||
<XStack space={'$3'} style={{ padding: '12px 16px' }}>
|
<XStack space={'$3'} style={{ padding: '12px 16px' }}>
|
||||||
<IconText icon={<SwapIcon size={16} />}>Syncing</IconText>
|
<IconText icon={<SwapIcon size={16} />}>Syncing</IconText>
|
||||||
<Text size={13} weight={'semibold'}>
|
<Text size={13} weight={'semibold'}>
|
||||||
{formatNumberWithComa(value)} / {formatNumberWithComa(total)}
|
{formatNumbersWithComa(value)} / {formatNumbersWithComa(total)}
|
||||||
</Text>
|
</Text>
|
||||||
</XStack>
|
</XStack>
|
||||||
</YStack>
|
</YStack>
|
||||||
|
|
|
@ -25,9 +25,11 @@ export const convertSecondsToTimerFormat = (seconds: number) => {
|
||||||
return `${String(minutes).padStart(2, '0')}:${String(remainingSeconds).padStart(2, '0')}`
|
return `${String(minutes).padStart(2, '0')}:${String(remainingSeconds).padStart(2, '0')}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export const formatNumberWithComa = (n: number): string => {
|
export const formatNumbersWithComa = (n: number): string => {
|
||||||
return n.toFixed(3).replace(/\./g, ',')
|
const parts = n.toString().split('.');
|
||||||
}
|
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||||
|
return parts.join('.');
|
||||||
|
};
|
||||||
|
|
||||||
export const getMonthIndicesFromRange = (range: DateRange) => {
|
export const getMonthIndicesFromRange = (range: DateRange) => {
|
||||||
if (!range.from || !range.to) return [0, 11]
|
if (!range.from || !range.to) return [0, 11]
|
||||||
|
|
Loading…
Reference in New Issue