Skip to content

Commit

Permalink
Fix cooldown summary table (#6445)
Browse files Browse the repository at this point in the history
  • Loading branch information
dharit-tan authored Oct 24, 2023
1 parent d790864 commit fdcddf0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ export const useAudioMatchingChallengeCooldownSchedule = (
cooldownChallengesSummary:
claimableAmount > 0
? getAudioMatchingChallengeCooldownSummary(claimableAmount)
: undefined
: undefined,
isEmpty:
cooldownChallenges.every((c) => c === undefined) && claimableAmount === 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export const CooldownSummaryTable = ({
}: {
challengeId: ChallengeRewardID
}) => {
const { cooldownChallenges, cooldownChallengesSummary } =
const { cooldownChallenges, cooldownChallengesSummary, isEmpty } =
useAudioMatchingChallengeCooldownSchedule(challengeId)
return cooldownChallengesSummary ? (
return !isEmpty ? (
<SummaryTable
title={messages.upcomingRewards}
secondaryTitle={messages.audio}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ export const AudioMatchingRewardsModalContent = ({
const wm = useWithMobileStyle(styles.mobile)
const navigateToPage = useNavigateToPage()
const { fullDescription } = challengeRewardsConfig[challengeName]
const { cooldownChallenges, claimableAmount, cooldownChallengesSummary } =
useAudioMatchingChallengeCooldownSchedule(challenge?.challenge_id)
const {
cooldownChallenges,
claimableAmount,
cooldownChallengesSummary,
isEmpty: isCooldownChallengesEmpty
} = useAudioMatchingChallengeCooldownSchedule(challenge?.challenge_id)
const userChallenge = useSelector(getOptimisticUserChallenges)[challengeName]

const progressDescription = (
Expand Down Expand Up @@ -158,7 +162,7 @@ export const AudioMatchingRewardsModalContent = ({
</div>
{progressStatusLabel}
</div>
{cooldownChallengesSummary ? (
{!isCooldownChallengesEmpty ? (
<SummaryTable
title={messages.upcomingRewards}
items={cooldownChallenges}
Expand Down

0 comments on commit fdcddf0

Please sign in to comment.