Skip to content

Commit 514ce3f

Browse files
authored
Don't show oneshot expiry if ineligible (#11351)
1 parent b87d3a5 commit 514ce3f

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

packages/common/src/utils/challenges.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export type ChallengeRewardsInfo = {
1515
title: string
1616
description: (amount: OptimisticUserChallenge | undefined) => string
1717
fullDescription?: (amount: OptimisticUserChallenge | undefined) => string
18+
optionalDescription?: string
1819
progressLabel?: string
1920
remainingLabel?: string
2021
completedLabel?: string
@@ -313,8 +314,9 @@ export const challengeRewardsConfig: Record<
313314
description: () =>
314315
`We're thrilled to reward our talented artist community for driving Audius' growth and success!`,
315316
fullDescription: () =>
316-
`We're thrilled to reward our talented artist community for driving Audius' growth and success! \n\nClaim your tokens before they expire on 05/13/25!`,
317-
317+
`We're thrilled to reward our talented artist community for driving Audius' growth and success!`,
318+
optionalDescription:
319+
'\n\nClaim your tokens before they expire on 05/13/25!',
318320
panelButtonText: '',
319321
id: ChallengeName.OneShot,
320322
remainingLabel: 'Ineligible',

packages/mobile/src/components/challenge-rewards-drawer/ChallengeDescription.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ type DescriptionContent =
1414
| {
1515
description?: never
1616
renderDescription: () => ReactNode
17+
optionalDescription?: never
18+
}
19+
| {
20+
description: ReactNode
21+
renderDescription?: never
22+
optionalDescription?: ReactNode
1723
}
18-
| { description: ReactNode; renderDescription?: never }
1924

2025
type ChallengeDescriptionProps = {
2126
/** Indicates if the challenge has a cooldown period */
@@ -29,6 +34,7 @@ type ChallengeDescriptionProps = {
2934
export const ChallengeDescription = ({
3035
description,
3136
renderDescription,
37+
optionalDescription,
3238
isCooldownChallenge = true
3339
}: ChallengeDescriptionProps) => {
3440
const styles = useStyles()
@@ -40,6 +46,7 @@ export const ChallengeDescription = ({
4046
<Flex gap='m' mb='l'>
4147
<Text variant='body' size='l'>
4248
{description}
49+
{optionalDescription}
4350
</Text>
4451
{isCooldownChallenge ? (
4552
<Text variant='body' color='subdued'>

packages/mobile/src/components/challenge-rewards-drawer/ChallengeRewardsDrawerContent.tsx

+8-11
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ const messages = {
5151
type ChallengeRewardsDrawerContentProps = {
5252
/** The description of the challenge */
5353
description: string
54+
/** The optional description of the challenge */
55+
optionalDescription?: string
5456
/** The current progress the user has made */
5557
currentStep: number
5658
/** The number of steps the user has to complete in total */
@@ -90,6 +92,7 @@ type ChallengeRewardsDrawerContentProps = {
9092
*/
9193
export const ChallengeRewardsDrawerContent = ({
9294
description,
95+
optionalDescription,
9396
amount,
9497
currentStep,
9598
stepCount = 1,
@@ -157,17 +160,11 @@ export const ChallengeRewardsDrawerContent = ({
157160
return (
158161
<>
159162
<ScrollView style={styles.content}>
160-
{isVerifiedChallenge ? (
161-
<ChallengeDescription
162-
description={description}
163-
isCooldownChallenge={isCooldownChallenge}
164-
/>
165-
) : (
166-
<ChallengeDescription
167-
description={description}
168-
isCooldownChallenge={isCooldownChallenge}
169-
/>
170-
)}
163+
<ChallengeDescription
164+
description={description}
165+
optionalDescription={isClaimable ? optionalDescription : undefined}
166+
isCooldownChallenge={isCooldownChallenge}
167+
/>
171168
<Flex alignItems='center' gap='3xl' w='100%'>
172169
<Flex row alignItems='center' gap='xl'>
173170
<ChallengeReward amount={amount} subtext={messages.audio} />

packages/mobile/src/components/challenge-rewards-drawer/ChallengeRewardsDrawerProvider.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ export const ChallengeRewardsDrawerProvider = () => {
237237
? config.fullDescription(challenge)
238238
: config.description(challenge)
239239
}
240+
optionalDescription={config.optionalDescription}
240241
progressLabel={config.progressLabel ?? 'Completed'}
241242
completedLabel={config.completedLabel}
242243
amount={progressRewardAmount}

packages/web/src/pages/rewards-page/components/modals/ChallengeRewardsModal/ChallengeRewardsModal.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ const ChallengeRewardsBody = ({ dismissModal }: BodyProps) => {
288288
const currentStepCount = challenge?.current_step_count || 0
289289
const {
290290
fullDescription,
291+
optionalDescription,
291292
progressLabel,
292293
completedLabel,
293294
isVerifiedChallenge
@@ -343,6 +344,7 @@ const ChallengeRewardsBody = ({ dismissModal }: BodyProps) => {
343344
) : null}
344345
<Text variant='body' style={{ whiteSpace: 'pre-line' }}>
345346
{fullDescription?.(challenge)}
347+
{challenge?.claimableAmount ? optionalDescription : null}
346348
</Text>
347349
{isCooldownChallenge ? (
348350
<Text variant='body' color='subdued'>

0 commit comments

Comments
 (0)