File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import { ImageIcon } from "../user-icon/ImageIcon";
1919import { SvgIcon } from "../user-icon/SvgIcon" ;
2020import EthAddress from "../eth-address" ;
2121import { UserName } from "../user-name" ;
22+ import { calculateBigIntPercentage } from "@/lib/calculateBigIntPercentage" ;
2223const MAX_FRACTIONS_DISPLAYED = 5 ;
2324
2425function Fraction ( {
@@ -38,6 +39,16 @@ function Fraction({
3839 address : address ,
3940 } ) ;
4041
42+ const calculatedPercentage = calculateBigIntPercentage (
43+ units as string ,
44+ totalUnits as string ,
45+ ) ;
46+
47+ const roundedPercentage =
48+ calculatedPercentage ! < 1
49+ ? "<1"
50+ : Math . round ( calculatedPercentage ! ) . toString ( ) ;
51+
4152 if ( isFetching ) {
4253 return (
4354 < div className = "flex flex-row gap-2 items-center" >
@@ -68,7 +79,10 @@ function Fraction({
6879 < EthAddress address = { address } showEnsName = { true } />
6980 </ div >
7081 ) }
71- — < FormattedUnits > { units as string } </ FormattedUnits >
82+ < div className = "flex flex-row items-center gap-2" >
83+ — < FormattedUnits > { units as string } </ FormattedUnits >
84+ < span > { `(${ roundedPercentage } %)` } </ span >
85+ </ div >
7286 </ >
7387 ) ;
7488}
You can’t perform that action at this time.
0 commit comments