2023-07-06 17:43:51 +00:00
|
|
|
import { gql, useQuery } from '@apollo/client'
|
|
|
|
import Link from 'next/link'
|
2024-03-20 00:37:31 +00:00
|
|
|
import { RewardLine } from '@/pages/rewards'
|
|
|
|
import { SSR } from '@/lib/constants'
|
2023-07-06 17:43:51 +00:00
|
|
|
|
|
|
|
const REWARDS = gql`
|
|
|
|
{
|
2023-08-15 17:41:51 +00:00
|
|
|
rewards {
|
2023-07-06 17:43:51 +00:00
|
|
|
total
|
2024-03-01 16:28:55 +00:00
|
|
|
time
|
2023-07-06 17:43:51 +00:00
|
|
|
}
|
|
|
|
}`
|
|
|
|
|
|
|
|
export default function Rewards () {
|
2023-07-31 19:54:30 +00:00
|
|
|
const { data } = useQuery(REWARDS, SSR ? { ssr: false } : { pollInterval: 60000, nextFetchPolicy: 'cache-and-network' })
|
2023-08-30 00:13:21 +00:00
|
|
|
const total = data?.rewards?.[0]?.total
|
2024-03-01 16:28:55 +00:00
|
|
|
const time = data?.rewards?.[0]?.time
|
2023-07-06 17:43:51 +00:00
|
|
|
return (
|
2023-07-23 15:08:43 +00:00
|
|
|
<Link href='/rewards' className='nav-link p-0 p-0 d-inline-flex'>
|
2024-03-01 16:28:55 +00:00
|
|
|
{total ? <span><RewardLine total={total} time={time} /></span> : 'rewards'}
|
2023-07-06 17:43:51 +00:00
|
|
|
</Link>
|
|
|
|
)
|
|
|
|
}
|