66} from "@namada/components" ;
77import { sortedTableData } from "App/AccountOverview/common" ;
88import { FiatCurrency } from "App/Common/FiatCurrency" ;
9+ import { IconTooltip } from "App/Common/IconTooltip" ;
910import { TableWithPaginator } from "App/Common/TableWithPaginator" ;
1011import { TokenCard } from "App/Common/TokenCard" ;
1112import { TokenCurrency } from "App/Common/TokenCurrency" ;
@@ -14,6 +15,7 @@ import { applicationFeaturesAtom } from "atoms/settings/atoms";
1415import BigNumber from "bignumber.js" ;
1516import { useAtomValue } from "jotai" ;
1617import { useEffect , useState } from "react" ;
18+ import { FaExclamation } from "react-icons/fa6" ;
1719import { IoSwapHorizontal } from "react-icons/io5" ;
1820import { Link , useNavigate } from "react-router-dom" ;
1921import { twMerge } from "tailwind-merge" ;
@@ -23,6 +25,26 @@ import { namadaAsset } from "utils";
2325const resultsPerPage = 100 ;
2426const initialPage = 0 ;
2527
28+ // Minimum thresholds to earn rewards for each asset
29+ const REWARD_THRESHOLDS : Record < string , BigNumber > = {
30+ statom : new BigNumber ( 10 ) ,
31+ stosmo : new BigNumber ( 100 ) ,
32+ sttia : new BigNumber ( 20 ) ,
33+ osmo : new BigNumber ( 100 ) ,
34+ atom : new BigNumber ( 10 ) ,
35+ tia : new BigNumber ( 20 ) ,
36+ usdc : new BigNumber ( 50 ) ,
37+ } ;
38+
39+ // Check if amount is below the minimum threshold to earn rewards
40+ const isBelowRewardThreshold = (
41+ assetSymbol : string ,
42+ amount : BigNumber
43+ ) : boolean => {
44+ const threshold = REWARD_THRESHOLDS [ assetSymbol . toLowerCase ( ) ] ;
45+ return threshold ? amount . lt ( threshold ) : false ;
46+ } ;
47+
2648export const ShieldedFungibleTable = ( {
2749 data,
2850 rewards,
@@ -49,7 +71,7 @@ export const ShieldedFungibleTable = ({
4971 dollar,
5072 } : TokenBalance ) : TableRow => {
5173 const reward = rewards ?. [ address ] ;
52-
74+ const belowThreshold = isBelowRewardThreshold ( asset . symbol , amount ) ;
5375 return {
5476 cells : [
5577 < TokenCard key = { `token-${ address } ` } address = { address } asset = { asset } /> ,
@@ -65,15 +87,30 @@ export const ShieldedFungibleTable = ({
6587 />
6688 ) }
6789 </ div > ,
68- < div key = { `ssr-rate-${ address } ` } className = "text-right leading-tight " >
90+ < div
91+ key = { `ssr-rate-${ address } ` }
92+ className = "text-right leading-tight relative"
93+ >
6994 { shieldingRewardsEnabled &&
95+ REWARD_THRESHOLDS [ asset . symbol . toLowerCase ( ) ] &&
7096 ( reward ?
71- < TokenCurrency
72- symbol = { namadaAsset ( ) . symbol }
73- amount = { reward }
74- className = "text-yellow"
75- decimalPlaces = { reward . isZero ( ) ? 0 : 3 }
76- />
97+ < div className = "flex items-center justify-end gap-2" >
98+ < TokenCurrency
99+ symbol = { namadaAsset ( ) . symbol }
100+ amount = { reward }
101+ className = "text-yellow"
102+ decimalPlaces = { reward . isZero ( ) ? 0 : 3 }
103+ />
104+ { belowThreshold && (
105+ < IconTooltip
106+ className = "bg-yellow text-black"
107+ icon = { < FaExclamation /> }
108+ text = { `${ REWARD_THRESHOLDS [ asset . symbol . toLowerCase ( ) ] } ${ asset . symbol } required to earn rewards` }
109+ tooltipClassName = "w-fit px-2 py-1 -mr-2"
110+ tooltipPosition = "right"
111+ />
112+ ) }
113+ </ div >
77114 : < SkeletonLoading
78115 width = "120px"
79116 height = "20px"
0 commit comments