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
2 changes: 1 addition & 1 deletion packages/common/src/hooks/content/types.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export type LockedStatusVariant = 'premium' | 'gated'
export type LockedStatusVariant = 'premium' | 'gated' | 'tokenGated'
4 changes: 3 additions & 1 deletion packages/common/src/hooks/content/useIsTrackUnlockable.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useTrack } from '~/api'
import {
isContentSpecialAccess,
isContentTokenGated,
isContentUSDCPurchaseGated,
ID
} from '~/models'
Expand All @@ -14,6 +15,7 @@ export const useIsTrackUnlockable = (trackId: ID) => {

const isPurchaseable = isContentUSDCPurchaseGated(streamConditions)
const isSpecialAccess = isContentSpecialAccess(streamConditions)
const isTokenGated = isContentTokenGated(streamConditions)

return isPurchaseable || isSpecialAccess
return isPurchaseable || isSpecialAccess || isTokenGated
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useTrack } from '~/api'
import {
ID,
isContentSpecialAccess,
isContentTokenGated,
isContentUSDCPurchaseGated
} from '~/models'
import { Nullable } from '~/utils'
Expand All @@ -15,12 +16,15 @@ export const useTrackLockedStatusVariant = (trackId: ID) => {

const isPurchaseable = isContentUSDCPurchaseGated(streamConditions)
const isSpecialAccess = isContentSpecialAccess(streamConditions)
const isTokenGated = isContentTokenGated(streamConditions)

let variant: Nullable<LockedStatusVariant> = null
if (isPurchaseable) {
variant = 'premium'
} else if (isSpecialAccess) {
variant = 'gated'
} else if (isTokenGated) {
variant = 'tokenGated'
}

return variant
Expand Down
3 changes: 2 additions & 1 deletion packages/harmony/src/components/button/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
hoverColor,
variant = 'primary',
size = 'default',
rounded,
disabled,
...baseProps
} = props
Expand Down Expand Up @@ -176,7 +177,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
color: themeColors.static.white,
boxSizing: 'border-box',
border: 'none',
borderRadius: cornerRadius.s,
borderRadius: rounded ? cornerRadius['2xl'] : cornerRadius.s,
boxShadow: shadows.near,

...(isSmallOrXs
Expand Down
5 changes: 5 additions & 0 deletions packages/harmony/src/components/button/Button/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ export type ButtonProps = {
* The button size
*/
size?: ButtonSize

/**
* When true, uses fully rounded (pill-shaped) corners
*/
rounded?: boolean
} & Omit<BaseButtonProps, 'styles'>
14 changes: 2 additions & 12 deletions packages/mobile/src/components/core/AccessTypeLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import {
IconArtistCoin
} from '@audius/harmony-native'

import { CoinGatedLabelSvg } from './CoinGatedLabelSvg'

type AccessTypeLabelProps = {
type?: AccessType
scheduledReleaseDate?: string
Expand Down Expand Up @@ -59,8 +57,8 @@ const ACCESS_TYPE_CONFIG: Record<AccessType, AccessTypeConfig> = {
},
[AccessType.TOKEN_GATED]: {
icon: IconArtistCoin,
label: 'Coin Gated',
color: 'artistCoin'
label: 'Fan Club',
color: 'subdued'
},
[AccessType.EXTRAS]: {
icon: IconReceive,
Expand All @@ -79,14 +77,6 @@ export const AccessTypeLabel = (props: AccessTypeLabelProps) => {
? config.label(scheduledReleaseDate)
: config.label

if (type === AccessType.TOKEN_GATED) {
return (
<Flex direction='row' gap='xs' alignItems='center'>
<CoinGatedLabelSvg />
</Flex>
)
}

return (
<Flex direction='row' gap='xs' alignItems='center'>
{config.icon ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { useDispatch, useSelector } from 'react-redux'

import type { FlexProps } from '@audius/harmony-native'
import {
Button,
Flex,
IconLock,
IconLockUnlocked,
Expand All @@ -47,7 +48,7 @@ const { setLockedContentId } = gatedContentActions
const messages = {
unlocking: 'Unlocking',
locked: 'Locked',
buyArtistCoin: 'Buy Fan Club Token',
unlock: 'Unlock',
price: (price: string) => `$${price}`
}

Expand Down Expand Up @@ -148,7 +149,7 @@ export const LineupTileAccessStatus = ({
USDC(streamConditions.usdc_purchase.price / 100).toLocaleString()
)
: isTokenGated
? messages.buyArtistCoin
? messages.unlock
: isUnlocking
? messages.unlocking
: messages.locked
Expand Down Expand Up @@ -180,6 +181,20 @@ export const LineupTileAccessStatus = ({
style: { backgroundColor }
}

if (isTokenGated && !hasStreamAccess && !isUnlocking) {
return (
<Button
variant='secondary'
size='small'
rounded
onPress={handlePressWithBlock}
style={{ height: 24 }}
>
{buttonText}
</Button>
)
}

return (
<TouchableOpacity onPressIn={blockTilePress} onPress={handlePressWithBlock}>
<Flex
Expand Down Expand Up @@ -208,9 +223,9 @@ export const LineupTileAccessStatus = ({
style={styles.loadingSpinner}
fill={color.icon.staticWhite}
/>
) : !isTokenGated ? (
) : (
<IconLock color='white' size='s' />
) : null}
)}
{showButtonText ? (
<Text color='white' variant='label' size='m'>
{buttonText}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@ const NavigationContainer = (props: NavigationContainerProps) => {
},
CoinRedeemScreen: {
path: 'coins/:ticker/redeem/:code?'
},
ExclusiveTracksScreen: {
path: 'coins/:ticker/exclusive-tracks'
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ import { makeStyles, flexRowCentered, typography } from 'app/styles'
import { spacing } from 'app/styles/spacing'
import { useThemeColors } from 'app/utils/theme'

import { CoinGatedLabelSvg } from '../core/CoinGatedLabelSvg'
import { TrackImage } from '../image/TrackImage'
import { TrackDogEar } from '../track/TrackDogEar'

const messages = {
specialAccess: 'SPECIAL ACCESS',
premiumTrack: 'PREMIUM TRACK',
coinGated: 'COIN GATED',
coinGated: 'FAN CLUB',
earn: (amount: string) => `Earn ${amount} $AUDIO for this purchase!`
}

Expand Down Expand Up @@ -142,26 +141,20 @@ export const TrackDetailsTile = ({
<View style={styles.metadataContainer}>
{showLabel ? (
<View style={styles.streamContentLabelContainer}>
{isTokenGated ? (
<CoinGatedLabelSvg style={{ height: 28, width: 108 }} />
) : (
<>
<IconComponent
fill={color}
width={spacing(5)}
height={spacing(5)}
/>
<Text
fontSize='small'
colorValue={color}
weight='demiBold'
textTransform='uppercase'
style={styles.streamContentLabel}
>
{title}
</Text>
</>
)}
<IconComponent
fill={color}
width={spacing(5)}
height={spacing(5)}
/>
<Text
fontSize='small'
colorValue={color}
weight='demiBold'
textTransform='uppercase'
style={styles.streamContentLabel}
>
{title}
</Text>
</View>
) : null}
<Text
Expand Down
24 changes: 24 additions & 0 deletions packages/mobile/src/components/track/TrackLockedStatusBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ import {
} from '@audius/common/hooks'
import type { ID } from '@audius/common/models'

import { Flex, IconLock, Text } from '@audius/harmony-native'

import { LockedStatusBadge } from '../core/LockedStatusBadge'

const messages = {
membersOnly: 'Members Only'
}

type TrackLockedStatusBadgeProps = {
trackId: ID
}
Expand All @@ -16,5 +22,23 @@ export const TrackLockedStatusBadge = (props: TrackLockedStatusBadgeProps) => {
const variant = useTrackLockedStatusVariant(trackId)
if (!variant) return null

if (variant === 'tokenGated' && !hasStreamAccess) {
return (
<Flex
direction='row'
gap='xs'
alignItems='center'
justifyContent='center'
>
<IconLock size='s' color='default' />
<Flex>
<Text variant='body' size='xs' color='default'>
{messages.membersOnly}
</Text>
</Flex>
</Flex>
)
}

return <LockedStatusBadge variant={variant} locked={!hasStreamAccess} />
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const Button = (props: ButtonProps) => {
hexColor,
variant = 'primary',
size = 'default',
rounded,
disabled,
style,
gradient,
Expand Down Expand Up @@ -199,7 +200,7 @@ export const Button = (props: ButtonProps) => {

const buttonStyles: ViewStyle = {
borderWidth: 0,
borderRadius: cornerRadius.s,
borderRadius: rounded ? cornerRadius['2xl'] : cornerRadius.s,
alignItems: 'center',
justifyContent: 'center',
// TODO bring this back properly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,10 @@ export type ButtonProps = {
*/
size?: ButtonSize

/**
* When true, uses fully rounded (pill-shaped) corners
*/
rounded?: boolean

style?: StyleProp<ViewStyle>
} & Omit<BaseButtonProps, 'styles'>
8 changes: 1 addition & 7 deletions packages/mobile/src/screens/app-screen/AppTabScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ import { ChatScreen } from 'app/screens/chat-screen/ChatScreen'
import { ChatUserListScreen } from 'app/screens/chat-screen/ChatUserListScreen'
import {
CoinDetailsScreen,
EditCoinDetailsScreen,
ExclusiveTracksScreen
EditCoinDetailsScreen
} from 'app/screens/coin-details-screen'
import { CoinRedeemScreen } from 'app/screens/coin-redeem-screen'
import { CollectionScreen } from 'app/screens/collection-screen/CollectionScreen'
Expand Down Expand Up @@ -123,7 +122,6 @@ export type AppTabScreenParamList = {
CoinDetailsScreen: { ticker: string }
CoinRedeemScreen: { ticker: string; code?: string }
EditCoinDetailsScreen: { ticker: string }
ExclusiveTracksScreen: { ticker: string }
Upload: {
initialMetadata?: Partial<TrackMetadataForUpload>
}
Expand Down Expand Up @@ -246,10 +244,6 @@ export const AppTabScreen = ({ baseScreen, Stack }: AppTabScreenProps) => {
name='EditCoinDetailsScreen'
component={EditCoinDetailsScreen}
/>
<Stack.Screen
name='ExclusiveTracksScreen'
component={ExclusiveTracksScreen}
/>
<Stack.Screen
name='ArtistCoinsExplore'
component={ArtistCoinsExploreScreen}
Expand Down
Loading
Loading