diff --git a/api/resolvers/rewards.js b/api/resolvers/rewards.js index a65ebc43..1fe4e278 100644 --- a/api/resolvers/rewards.js +++ b/api/resolvers/rewards.js @@ -1,6 +1,5 @@ import { amountSchema, validateSchema } from '@/lib/validate' import { getAd, getItem } from './item' -import { topUsers } from './user' import performPaidAction from '../paidAction' import { GqlInputError } from '@/lib/error' @@ -152,13 +151,6 @@ export default { } }, Rewards: { - leaderboard: async (parent, args, { models, ...context }) => { - // get to and from using postgres because it's easier to do there - const [{ to, from }] = await models.$queryRaw` - SELECT date_trunc('day', (now() AT TIME ZONE 'America/Chicago')) AT TIME ZONE 'America/Chicago' as from, - (date_trunc('day', (now() AT TIME ZONE 'America/Chicago')) AT TIME ZONE 'America/Chicago') + interval '1 day - 1 second' as to` - return await topUsers(parent, { when: 'custom', to: new Date(to).getTime().toString(), from: new Date(from).getTime().toString(), limit: 500 }, { models, ...context }) - }, total: async (parent, args, { models }) => { if (!parent.total) { return 0 diff --git a/api/typeDefs/rewards.js b/api/typeDefs/rewards.js index 6a104486..2b0a8719 100644 --- a/api/typeDefs/rewards.js +++ b/api/typeDefs/rewards.js @@ -18,7 +18,6 @@ export default gql` total: Int! time: Date! sources: [NameValue!]! - leaderboard: UsersNullable ad: Item } diff --git a/pages/rewards/index.js b/pages/rewards/index.js index 627e3093..0d36401c 100644 --- a/pages/rewards/index.js +++ b/pages/rewards/index.js @@ -14,7 +14,6 @@ import dynamic from 'next/dynamic' import { FAST_POLL_INTERVAL, SSR } from '@/lib/constants' import { useToast } from '@/components/toast' import { useLightning } from '@/components/lightning' -import { ListUsers } from '@/components/user-list' import { Col, Row } from 'react-bootstrap' import { useData } from '@/components/use-data' import { GrowthPieChartSkeleton } from '@/components/charts-skeletons' @@ -42,25 +41,6 @@ ${ITEM_FULL_FIELDS} ad { ...ItemFullFields } - leaderboard { - users { - id - name - photoId - ncomments - nposts - proportion - - optional { - streak - gunStreak - horseStreak - stacked - spent - referrals - } - } - } } } ` @@ -98,14 +78,14 @@ export function RewardLine ({ total, time }) { } export default function Rewards ({ ssrData }) { - // only poll for updates to rewards and not leaderboard + // only poll for updates to rewards const { data: rewardsData } = useQuery( REWARDS, SSR ? {} : { pollInterval: FAST_POLL_INTERVAL, nextFetchPolicy: 'cache-and-network' }) const { data } = useQuery(REWARDS_FULL) const dat = useData(data, ssrData) - let { rewards: [{ total, sources, time, leaderboard, ad }] } = useMemo(() => { + let { rewards: [{ total, sources, time, ad }] } = useMemo(() => { return dat || { rewards: [{}] } }, [dat]) @@ -117,20 +97,6 @@ export default function Rewards ({ ssrData }) { if (!dat) return - function EstimatedReward ({ rank, user }) { - if (!user) return null - const referrerReward = Math.max(Math.floor(total * user.proportion * 0.2), 0) - const reward = Math.max(Math.floor(total * user.proportion) - referrerReward, 0) - - return ( -
- - estimated reward: {numWithUnits(reward)} (+ {numWithUnits(referrerReward)} to referrers) - -
- ) - } - return ( {ad && @@ -141,7 +107,7 @@ export default function Rewards ({ ssrData }) { } - +
@@ -159,13 +125,6 @@ export default function Rewards ({ ssrData }) {
- {leaderboard?.users && - -

leaderboard

-
- -
- }
)