11import React , { FC , useMemo } from 'react' ;
22
3- import { t } from 'i18next ' ;
3+ import classNames from 'classnames ' ;
44
5- import { ContextLink } from '@sovryn/ui' ;
6-
7- import { translations } from '../../../../../../../locales/i18n' ;
85import { useGetReturnRate } from '../../../../hooks/useGetReturnRate' ;
96import { AmmLiquidityPool } from '../../../../utils/AmmLiquidityPool' ;
107import styles from './PoolsTableReturns.module.css' ;
@@ -20,52 +17,13 @@ export const PoolsTableReturns: FC<PoolsTableReturnsProps> = ({
2017} ) => {
2118 const { returnRates } = useGetReturnRate ( pool ) ;
2219
23- const hasRewards = useMemo (
24- ( ) => Number ( returnRates . afterRewards ) > 0 ,
25- [ returnRates ] ,
26- ) ;
27-
28- const renderTooltipChildren = useMemo (
29- ( ) => (
30- < div className = "flex flex-col" >
31- < div >
32- { t ( translations . marketMakingPage . poolsTableReturns . before , {
33- percent : returnRates . beforeRewards ,
34- } ) }
35- </ div >
36- < div >
37- { t ( translations . marketMakingPage . poolsTableReturns . after , {
38- percent : returnRates . afterRewards ,
39- } ) }
40- </ div >
41- </ div >
42- ) ,
43- [ returnRates ] ,
44- ) ;
45-
46- const renderChildren = useMemo (
20+ const returnRate = useMemo (
4721 ( ) =>
48- hasRewards
49- ? t ( translations . marketMakingPage . poolsTableReturns . title , {
50- percent : returnRates . afterRewards ,
51- } )
52- : '0%' ,
53- [ returnRates , hasRewards ] ,
22+ returnRates . beforeRewards === '0.00' ? '0' : returnRates . beforeRewards ,
23+ [ returnRates ] ,
5424 ) ;
5525
56- const renderComponent = useMemo (
57- ( ) =>
58- hasRewards ? (
59- < ContextLink
60- className = { className }
61- children = { renderChildren }
62- tooltipContent = { renderTooltipChildren }
63- />
64- ) : (
65- < div className = { styles . rewards } > { renderChildren } </ div >
66- ) ,
67- [ className , hasRewards , renderChildren , renderTooltipChildren ] ,
26+ return (
27+ < div className = { classNames ( styles . rewards , className ) } > { returnRate } %</ div >
6828 ) ;
69-
70- return renderComponent ;
7129} ;
0 commit comments