This repository has been archived by the owner on Oct 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PAY-1559][PAY-1560] Adds USDC variants for track tiles on web/mobile…
… web (#3724)
- Loading branch information
Showing
23 changed files
with
271 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,4 @@ export type ColorValue = | |
| 'accentOrangeLight1' | ||
| 'accentPurple' | ||
| 'accentBlue' | ||
| 'specialLightGreen' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
packages/web/src/components/track/PremiumConditionsPill.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.container { | ||
align-items: center; | ||
background-color: var(--accent-blue); | ||
border-radius: var(--unit-1); | ||
color: var(--static-white); | ||
display: flex; | ||
gap: var(--unit-1); | ||
justify-content: center; | ||
height: var(--unit-6); | ||
min-width: var(--unit-16); | ||
padding: var(--unit-2) var(--unit-3); | ||
} | ||
|
||
.container svg { | ||
width: var(--unit-4); | ||
height: var(--unit-4); | ||
} | ||
|
||
.container path { | ||
fill: var(--static-white); | ||
} | ||
|
||
.gatedContent { | ||
background-color: var(--accent-blue); | ||
} | ||
|
||
.premiumContent { | ||
background-color: var(--special-light-green); | ||
} | ||
|
||
.spinner { | ||
height: var(--unit-4); | ||
width: var(--unit-4); | ||
} | ||
|
||
.spinner g path { | ||
stroke: var(--static-white); | ||
} |
50 changes: 50 additions & 0 deletions
50
packages/web/src/components/track/PremiumConditionsPill.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { | ||
PremiumConditions, | ||
formatUSDCWeiToUSDString, | ||
isPremiumContentUSDCPurchaseGated | ||
} from '@audius/common' | ||
import { IconLock } from '@audius/stems' | ||
import cn from 'classnames' | ||
|
||
import LoadingSpinner from 'components/loading-spinner/LoadingSpinner' | ||
|
||
import styles from './PremiumConditionsPill.module.css' | ||
|
||
const messages = { | ||
unlocking: 'Unlocking', | ||
locked: 'Locked' | ||
} | ||
|
||
export const PremiumConditionsPill = ({ | ||
premiumConditions, | ||
unlocking | ||
}: { | ||
premiumConditions: PremiumConditions | ||
unlocking: boolean | ||
}) => { | ||
const isPurchase = isPremiumContentUSDCPurchaseGated(premiumConditions) | ||
const icon = unlocking ? ( | ||
<LoadingSpinner className={styles.spinner} /> | ||
) : isPurchase ? null : ( | ||
<IconLock /> | ||
) | ||
|
||
let message = null | ||
if (unlocking) { | ||
// Show only spinner when unlocking a purchase | ||
message = isPurchase ? null : messages.unlocking | ||
} else { | ||
message = isPurchase | ||
? `$${formatUSDCWeiToUSDString(premiumConditions.usdc_purchase.price)}` | ||
: messages.locked | ||
} | ||
|
||
const colorStyle = isPurchase ? styles.premiumContent : styles.gatedContent | ||
|
||
return ( | ||
<div className={cn(styles.container, colorStyle)}> | ||
{icon} | ||
{message} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.