fix back button to rewards page
This commit is contained in:
parent
0b0e36e3cb
commit
71619dfa2c
@ -18,6 +18,7 @@ import { useLightning } from '../../components/lightning'
|
|||||||
import { ListUsers } from '../../components/user-list'
|
import { ListUsers } from '../../components/user-list'
|
||||||
import { Col, Row } from 'react-bootstrap'
|
import { Col, Row } from 'react-bootstrap'
|
||||||
import { proportions } from '../../lib/madness'
|
import { proportions } from '../../lib/madness'
|
||||||
|
import { useData } from '../../components/use-data'
|
||||||
|
|
||||||
const GrowthPieChart = dynamic(() => import('../../components/charts').then(mod => mod.GrowthPieChart), {
|
const GrowthPieChart = dynamic(() => import('../../components/charts').then(mod => mod.GrowthPieChart), {
|
||||||
loading: () => <div>Loading...</div>
|
loading: () => <div>Loading...</div>
|
||||||
@ -89,16 +90,17 @@ export function RewardLine ({ total, time }) {
|
|||||||
|
|
||||||
export default function Rewards ({ ssrData }) {
|
export default function Rewards ({ ssrData }) {
|
||||||
// only poll for updates to rewards and not leaderboard
|
// only poll for updates to rewards and not leaderboard
|
||||||
const { data } = useQuery(
|
const { data: rewardsData } = useQuery(
|
||||||
REWARDS,
|
REWARDS,
|
||||||
SSR ? {} : { pollInterval: 1000, nextFetchPolicy: 'cache-and-network' })
|
SSR ? {} : { pollInterval: 1000, nextFetchPolicy: 'cache-and-network' })
|
||||||
|
const { data } = useQuery(REWARDS_FULL)
|
||||||
if (!data && !ssrData) return <PageLoading />
|
if (!data && !ssrData) return <PageLoading />
|
||||||
|
|
||||||
let { rewards: [{ total, sources, time, leaderboard }] } = ssrData
|
let { rewards: [{ total, sources, time, leaderboard }] } = useData(data, ssrData)
|
||||||
if (data?.rewards?.length > 0) {
|
if (rewardsData?.rewards?.length > 0) {
|
||||||
total = data.rewards[0].total
|
total = rewardsData.rewards[0].total
|
||||||
sources = data.rewards[0].sources
|
sources = rewardsData.rewards[0].sources
|
||||||
time = data.rewards[0].time
|
time = rewardsData.rewards[0].time
|
||||||
}
|
}
|
||||||
|
|
||||||
function EstimatedReward ({ rank }) {
|
function EstimatedReward ({ rank }) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user