Skip to content

Commit ae07f14

Browse files
Merge pull request #1 from sushiswap/farm/analytics
fix: refactor and fix small issues
2 parents 855d2a3 + 437586a commit ae07f14

File tree

6 files changed

+35
-7
lines changed

6 files changed

+35
-7
lines changed

src/features/analytics/farms/useTableConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export const useTableConfig = (chainId: number, farms: any) => {
154154
columns,
155155
data: data ?? [],
156156
initialState: {
157-
sortBy: [{ id: 'apr.annual', desc: true }],
157+
sortBy: [{ id: 'rewardApr.annual', desc: true }],
158158
},
159159
autoResetFilters: false,
160160
},
File renamed without changes.

src/hooks/useFarmRewardsWithUsers.ts renamed to src/features/analytics/hooks/useFarmRewardsWithUsers.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Chef, PairType } from 'app/features/onsen/enum'
66
import { usePositions } from 'app/features/onsen/hooks'
77
import { featureEnabled } from 'app/functions'
88
import { aprToApy } from 'app/functions/convert'
9+
import { useAllTokens } from 'app/hooks/Tokens'
910
import {
1011
useAverageBlockTime,
1112
useCeloPrice,
@@ -27,8 +28,6 @@ import {
2728
} from 'app/services/graph'
2829
import { useCallback, useMemo } from 'react'
2930

30-
import { useAllTokens } from './Tokens'
31-
3231
export function getRewards({
3332
chainId,
3433
pool,

src/pages/analytics/farms/[id].tsx

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ import { ChainId, Token } from '@sushiswap/core-sdk'
33
import { CurrencyLogo } from 'app/components/CurrencyLogo'
44
import DoubleCurrencyLogo from 'app/components/DoubleLogo'
55
import Typography from 'app/components/Typography'
6+
import UserTable from 'app/features/analytics/farms/user/UserTable'
67
import FormattedChartCard from 'app/features/analytics/FormattedChartCard'
7-
import UserTable from 'app/features/user/UserTable'
8+
import useFarmRewardHistories from 'app/features/analytics/hooks/useFarmRewardHistories'
9+
import useFarmRewardsWithUsers from 'app/features/analytics/hooks/useFarmRewardsWithUsers'
810
import { formatNumber, formatPercent } from 'app/functions'
9-
import useFarmRewardHistories from 'app/hooks/useFarmRewardHistories'
10-
import useFarmRewardsWithUsers from 'app/hooks/useFarmRewardsWithUsers'
1111
import { TridentBody, TridentHeader } from 'app/layouts/Trident'
12+
import Link from 'next/link'
1213
import { useRouter } from 'next/router'
1314
import { NextSeo } from 'next-seo'
1415
import React, { useMemo } from 'react'
@@ -97,7 +98,27 @@ export default function Pool() {
9798
<Typography variant="h2" className="text-high-emphesis" weight={700}>
9899
{token0 && token1 && (
99100
<>
100-
{token0?.symbol}/{token1?.symbol}
101+
<Link
102+
href={{
103+
pathname: `/analytics/tokens/${token0?.address}`,
104+
query: {
105+
chainId,
106+
},
107+
}}
108+
>
109+
{token0?.symbol}
110+
</Link>
111+
/
112+
<Link
113+
href={{
114+
pathname: `/analytics/tokens/${token1?.address}`,
115+
query: {
116+
chainId,
117+
},
118+
}}
119+
>
120+
{token1?.symbol}
121+
</Link>
101122
</>
102123
)}
103124
</Typography>
@@ -117,6 +138,14 @@ export default function Pool() {
117138
<div className="text-xl font-medium text-high-emphesis">{formatNumber(farm?.tvl ?? 0, true)}</div>
118139
</div>
119140
</div>
141+
<div className="flex flex-col">
142+
<div className="text-secondary">Value</div>
143+
<div className="flex items-center space-x-2">
144+
<div className="text-xl font-medium text-high-emphesis">
145+
{formatNumber(farm?.pair.reserveUSD / farm?.pair.totalSupply, true)}
146+
</div>
147+
</div>
148+
</div>
120149
<div className="flex flex-col">
121150
<div className="text-secondary">Rewards</div>
122151
<div className="flex items-center space-x-2">

0 commit comments

Comments
 (0)