stacker.news/components/footer-rewards.js

23 lines
582 B
JavaScript
Raw Normal View History

2023-07-06 17:43:51 +00:00
import { gql, useQuery } from '@apollo/client'
import Link from 'next/link'
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
}
}`
export default function Rewards () {
const { data } = useQuery(REWARDS, SSR ? { ssr: false } : { pollInterval: 60000, nextFetchPolicy: 'cache-and-network' })
2023-08-15 17:41:51 +00:00
const total = data?.rewards?.total
2023-07-06 17:43:51 +00:00
return (
<Link href='/rewards' className='nav-link p-0 p-0 d-inline-flex'>
{total ? <span><RewardLine total={total} /></span> : 'rewards'}
2023-07-06 17:43:51 +00:00
</Link>
)
}