diff --git a/src/components/TVL.tsx b/src/components/TVL.tsx index 4318d67..09c5c7f 100755 --- a/src/components/TVL.tsx +++ b/src/components/TVL.tsx @@ -28,6 +28,15 @@ const TVL: React.FC = () => { const address = useAtomValue(addressAtom); const referralCode = useAtomValue(referralCodeAtom); + const formattedTvlData = (tvlData: number) => { + if (tvlData >= 1000000) { + return `${(tvlData / 1000000).toFixed(2)}m`; + } else if (tvlData >= 1000) { + return `${(tvlData / 1000).toFixed(2)}k`; + } + return `${tvlData.toString()}`; + }; + return ( { {isPending ? ( ) : ( - Number(data?.tvl.toFixed(2)).toLocaleString() + {data ? formattedTvlData(Number(data.tvl)) : '0'} )}