{props.formatted.days
? ` ${props.formatted.days}d ${props.formatted.hours}h ${props.formatted.minutes}m ${props.formatted.seconds}s`
: ` ${props.formatted.hours}:${props.formatted.minutes}:${props.formatted.seconds}`}
}
/>}
>
)
}
export default function Rewards ({ ssrData }) {
// only poll for updates to rewards and not leaderboard
const { data: rewardsData } = useQuery(
REWARDS,
SSR ? {} : { pollInterval: 1000, nextFetchPolicy: 'cache-and-network' })
const { data } = useQuery(REWARDS_FULL)
if (!data && !ssrData) return
let { rewards: [{ total, sources, time, leaderboard }] } = useData(data, ssrData)
if (rewardsData?.rewards?.length > 0) {
total = rewardsData.rewards[0].total
sources = rewardsData.rewards[0].sources
time = rewardsData.rewards[0].time
}
function EstimatedReward ({ rank }) {
return (
estimated reward: {numWithUnits(Math.floor(total * proportions[rank - 1]))}
)
}
return (
{leaderboard?.users &&
leaderboard
}
)
}
export function DonateButton () {
const showModal = useShowModal()
const toaster = useToast()
const strike = useLightning()
const [donateToRewards] = useMutation(
gql`
mutation donateToRewards($sats: Int!, $hash: String, $hmac: String) {
donateToRewards(sats: $sats, hash: $hash, hmac: $hmac)
}`)
return (
<>
>
)
}