Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
benisgold committed Nov 15, 2023
1 parent e26e143 commit 98c5312
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
15 changes: 9 additions & 6 deletions src/graphql/queries/metadata.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,15 @@ query getPointsDataForWallet($address: String!) {
avatarURL
}
}
earnings {
total
}
stats {
position {
current
user {
referralCode
earnings {
total
}
stats {
position {
current
}
}
}
}
Expand Down
10 changes: 6 additions & 4 deletions src/screens/PointsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -492,19 +492,21 @@ export default function PointsScreen() {
}, [accountAddress, dataUpdatedAt]);

const nextDistributionSeconds = data?.points?.meta?.distribution?.next;
const totalPointsString = data?.points?.earnings?.total.toLocaleString(
const totalPointsString = data?.points?.user?.earnings?.total.toLocaleString(
'en-US'
);
const totalPointsMaskSize = 50 * Math.max(totalPointsString?.length ?? 0, 4);

const canDisplayTotalPoints = !isNil(data?.points?.earnings?.total);
const canDisplayTotalPoints = !isNil(data?.points?.user?.earnings?.total);
const canDisplayNextRewardCard = !isNil(nextDistributionSeconds);
const canDisplayStreakCard = STREAKS_ENABLED;
const canDisplayReferralsCard = REFERRALS_ENABLED;
const canDisplayCards =
canDisplayNextRewardCard || canDisplayStreakCard || canDisplayReferralsCard;
const canDisplayReferralLink = REFERRALS_ENABLED;
const canDisplayCurrentRank = !isNil(data?.points?.stats?.position.current);
const canDisplayCurrentRank = !isNil(
data?.points?.user?.stats?.position.current
);
const canDisplayLeaderboard = !!data?.points?.leaderboard?.accounts;

const shouldDisplayError = !isFetching && !data?.points;
Expand Down Expand Up @@ -840,7 +842,7 @@ export default function PointsScreen() {
</Text>
</Box>
<Text color="label" size="17pt" weight="heavy">
{`#${data?.points?.stats?.position.current.toLocaleString(
{`#${data?.points?.user?.stats?.position.current.toLocaleString(
'en-US'
)}`}
</Text>
Expand Down

0 comments on commit 98c5312

Please sign in to comment.