Skip to content

Commit

Permalink
Fix mobile premium track remix visibility (#6843)
Browse files Browse the repository at this point in the history
Co-authored-by: Saliou Diallo <saliou@audius.co>
  • Loading branch information
sddioulde and Saliou Diallo authored Dec 4, 2023
1 parent 942fcb8 commit a9b35ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,15 @@ export const RemixSettingsScreen = () => {
useEffect(() => {
if (isPremium) {
setRemixOf(null)
}
if (isPremium && !isUsdcGated) {
setRemixesVisible(false)
} else {
setRemixesVisible(true)
}
// adding the useField setters cause infinite rendering
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isPremium])
}, [isPremium, isUsdcGated])

const handleFetchParentTrack = useMemo(
() =>
Expand Down Expand Up @@ -288,7 +290,7 @@ export const RemixSettingsScreen = () => {
<Switch
value={!remixesVisible}
onValueChange={(value) => setRemixesVisible(!value)}
isDisabled={isPremium}
isDisabled={isPremium && !isUsdcGated}
/>
</View>
<Text {...descriptionProps}>{messages.hideRemixesDescription}</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ const RemixSettingsModal = ({

const [url, setUrl] = useState<string | null>(null)

const isUSDCPurchaseGated = isPremiumContentUSDCPurchaseGated(premiumConditions)
const isHideRemixesDisabled = isPremium && !isUSDCPurchaseGated

useEffect(() => {
if (url === null && track && isOpen) {
setUrl(fullTrackPage(track.permalink))
Expand Down Expand Up @@ -189,13 +192,12 @@ const RemixSettingsModal = ({
{isPremium ? (
<HelpCallout
className={styles.disableInfo}
content={`${messages.changeAvailabilityPrefix} ${
isPremiumContentUSDCPurchaseGated(premiumConditions)
? messages.premium
: isPremiumContentCollectibleGated(premiumConditions)
content={`${messages.changeAvailabilityPrefix} ${isUSDCPurchaseGated
? messages.premium
: isPremiumContentCollectibleGated(premiumConditions)
? messages.collectibleGated
: messages.specialAccess
}${messages.changeAvailabilitySuffix}`}
}${messages.changeAvailabilitySuffix}`}
/>
) : null}
<div className={styles.toggleRow}>
Expand Down Expand Up @@ -244,19 +246,19 @@ const RemixSettingsModal = ({
<div className={styles.divider} />

<div className={styles.toggleRow}>
<span className={cn({ [styles.remixDisabled]: isPremium })}>
<span className={cn({ [styles.remixDisabled]: isHideRemixesDisabled })}>
{messages.hideOtherRemixes}
</span>
<Switch
isOn={!!hideRemixes || isPremium}
isOn={!!hideRemixes || isHideRemixesDisabled}
handleToggle={() => onToggleHideRemixes?.()}
isDisabled={isPremium}
isDisabled={isHideRemixesDisabled}
allowCheckedWhileDisabled
/>
</div>
<div
className={cn(styles.subtext, {
[styles.remixDisabled]: isPremium
[styles.remixDisabled]: isHideRemixesDisabled
})}
>
{messages.preventOtherRemixes}
Expand Down

0 comments on commit a9b35ad

Please sign in to comment.