File tree 1 file changed +15
-1
lines changed
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";
19
19
import { SvgIcon } from "../user-icon/SvgIcon" ;
20
20
import EthAddress from "../eth-address" ;
21
21
import { UserName } from "../user-name" ;
22
+ import { calculateBigIntPercentage } from "@/lib/calculateBigIntPercentage" ;
22
23
const MAX_FRACTIONS_DISPLAYED = 5 ;
23
24
24
25
function Fraction ( {
@@ -38,6 +39,16 @@ function Fraction({
38
39
address : address ,
39
40
} ) ;
40
41
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
+
41
52
if ( isFetching ) {
42
53
return (
43
54
< div className = "flex flex-row gap-2 items-center" >
@@ -68,7 +79,10 @@ function Fraction({
68
79
< EthAddress address = { address } showEnsName = { true } />
69
80
</ div >
70
81
) }
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 >
72
86
</ >
73
87
) ;
74
88
}
You can’t perform that action at this time.
0 commit comments