Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions packages/mobile/src/screens/audio-screen/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '@audius/common'
import { View, Image } from 'react-native'
import { TouchableOpacity } from 'react-native-gesture-handler'
import LinearGradient from 'react-native-linear-gradient'

import IconArrow from 'app/assets/images/iconArrow.svg'
import IconCheck from 'app/assets/images/iconCheck.svg'
Expand All @@ -22,7 +23,8 @@ const messages = {
completeLabel: 'COMPLETE',
claimReward: 'Claim Your Reward',
readyToClaim: 'Ready to Claim',
viewDetails: 'View Details'
viewDetails: 'View Details',
new: 'New!'
}

const useStyles = makeStyles(({ spacing, palette, typography }) => ({
Expand Down Expand Up @@ -53,12 +55,19 @@ const useStyles = makeStyles(({ spacing, palette, typography }) => ({
fontFamily: typography.fontByWeight.demiBold,
lineHeight: spacing(4),
color: palette.secondary,
backgroundColor: palette.background,
borderWidth: 1,
borderRadius: 12,
borderColor: palette.backgroundSecondary,
overflow: 'hidden'
},
readyToClaimPill: {
backgroundColor: palette.background
},
newChallengeText: {
textShadowOffset: { width: 0, height: 1.4 },
textShadowRadius: 8,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spacing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a one-off hard-coded value from figma that I don't think is supposed to be tied to the grid. But generally I'm with you 101%.

textShadowColor: 'rgba(0,0,0,0.2)'
},
header: {
flexDirection: 'row',
marginBottom: spacing(2)
Expand Down Expand Up @@ -129,6 +138,8 @@ export const Panel = ({
const shouldShowProgressBar =
stepCount > 1 && challenge?.challenge_type !== 'aggregate' && !hasDisbursed
const needsDisbursement = challenge && challenge.claimableAmount > 0
const showNewChallengePill =
!needsDisbursement && isAudioMatchingChallenge(id)

const shouldShowProgress = !!progressLabel
let progressLabelFilled: string | null = null
Expand Down Expand Up @@ -180,6 +191,23 @@ export const Panel = ({
<View style={styles.pillContainer}>
{needsDisbursement ? (
<Text style={styles.pillMessage}>{messages.readyToClaim}</Text>
) : showNewChallengePill ? (
<LinearGradient
useAngle={true}
angle={125}
colors={['#19CCA2', '#61FA66']}
style={styles.pillMessage}
>
<Text
variant='body'
fontSize='medium'
weight='demiBold'
color='staticWhite'
style={styles.newChallengeText}
>
{messages.new}
</Text>
</LinearGradient>
) : null}
</View>
<View style={styles.content}>
Expand Down
24 changes: 18 additions & 6 deletions packages/web/src/pages/audio-rewards-page/ChallengeRewardsTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { useDispatch, useSelector } from 'react-redux'

import { useSetVisibility } from 'common/hooks/useModalState'
import LoadingSpinner from 'components/loading-spinner/LoadingSpinner'
import { Text } from 'components/typography'
import { useIsAudioMatchingChallengesEnabled } from 'hooks/useIsAudioMatchingChallengesEnabled'
import { useRemoteVar } from 'hooks/useRemoteConfig'
import { useWithMobileStyle } from 'hooks/useWithMobileStyle'
Expand All @@ -46,7 +47,8 @@ const messages = {
completeLabel: 'COMPLETE',
claimReward: 'Claim Your Reward',
readyToClaim: 'Ready to Claim',
viewDetails: 'View Details'
viewDetails: 'View Details',
new: 'New!'
}

type RewardPanelProps = {
Expand Down Expand Up @@ -85,6 +87,8 @@ const RewardPanel = ({
challenge.max_steps > 1 &&
challenge.challenge_type !== 'aggregate' &&
!hasDisbursed
const showNewChallengePill =
isAudioMatchingChallenge(id) && !needsDisbursement

let progressLabelFilled: string
if (shouldShowCompleted) {
Expand Down Expand Up @@ -135,11 +139,19 @@ const RewardPanel = ({
>
<div className={wm(styles.rewardPanelTop)}>
<div className={wm(styles.pillContainer)}>
{needsDisbursement && (
<span className={wm(styles.pillMessage)}>
{messages.readyToClaim}
</span>
)}
{needsDisbursement ? (
<span className={styles.pillMessage}>{messages.readyToClaim}</span>
) : showNewChallengePill ? (
<Text
as='span'
className={styles.newChallengePill}
variant='body'
strength='strong'
color='staticWhite'
>
{messages.new}
</Text>
) : null}
</div>
<span className={wm(styles.rewardTitle)}>
{icon}
Expand Down
11 changes: 11 additions & 0 deletions packages/web/src/pages/audio-rewards-page/RewardsTile.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@
background-color: var(--background);
}

.newChallengePill {
background: linear-gradient(125deg, #19cca2 0%, #61fa66 100%);
border: 1px solid var(--border-default);
border-radius: var(--unit-3);
align-items: center;
display: flex;
justify-content: center;
padding: var(--unit-1) var(--unit-2);
text-shadow: 0px 1.4px 8px rgba(0, 0, 0, 0.2), 0px 6px 15px rgba(0, 0, 0, 0.1);
}

.rewardTitle {
color: var(--neutral);
font-size: var(--font-2xl);
Expand Down