Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PAY-3041] Fix green play button in TracksTable #8527

Merged
merged 3 commits into from
May 17, 2024
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
12 changes: 6 additions & 6 deletions packages/web/src/components/table/components/TablePlayButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type TablePlayButtonProps = {
paused?: boolean
playing?: boolean
isTrackPremium?: boolean
isOwned?: boolean
isLocked?: boolean
}

export const TablePlayButton = ({
Expand All @@ -24,28 +24,28 @@ export const TablePlayButton = ({
paused,
playing = false,
isTrackPremium = false,
isOwned = false
isLocked = false
}: TablePlayButtonProps) => {
const {
color: {
special,
special: { lightGreen },
primary: { p300 }
}
} = useTheme()
const showPremiumColor = isOwned && isTrackPremium
const shouldShowPremiumColor = isLocked && isTrackPremium
return (
<div onClick={onClick} className={cn(styles.tablePlayButton, className)}>
{playing && !paused ? (
<IconPause
className={styles.icon}
fill={showPremiumColor ? special.lightGreen : p300}
fill={shouldShowPremiumColor ? lightGreen : p300}
/>
) : (
<IconPlay
className={cn(styles.icon, {
[styles.hideDefault]: hideDefault && !playing
})}
fill={showPremiumColor ? special.lightGreen : p300}
fill={shouldShowPremiumColor ? lightGreen : p300}
/>
)}
</div>
Expand Down
8 changes: 6 additions & 2 deletions packages/web/src/components/track/desktop/TrackListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { memo, MouseEvent, useRef } from 'react'

import { useGetCurrentUserId } from '@audius/common/api'
import { useIsGatedContentPlaylistAddable } from '@audius/common/hooks'
import {
useGatedContentAccess,
useIsGatedContentPlaylistAddable
} from '@audius/common/hooks'
import {
ID,
isContentUSDCPurchaseGated,
Expand Down Expand Up @@ -65,6 +68,7 @@ const TrackListItem = ({
const isOwner = track?.owner_id === currentUserId
const isPlaylistAddable = useIsGatedContentPlaylistAddable(track as Track)
const isPremium = isContentUSDCPurchaseGated(track?.stream_conditions)
const { hasStreamAccess } = useGatedContentAccess(track as Track)

if (forceSkeleton) {
return (
Expand Down Expand Up @@ -170,7 +174,7 @@ const TrackListItem = ({
paused={!playing}
hideDefault={false}
isTrackPremium={isPremium}
isOwned={isOwner}
isLocked={!hasStreamAccess}
/>
</div>
) : null}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/track/mobile/TrackListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ const TrackListItem = ({
paused={!isPlaying}
hideDefault={false}
isTrackPremium={isPremium}
isOwned={!isLocked}
isLocked={isLocked}
/>
</div>
) : null}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/components/tracks-table/TracksTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export const TracksTable = ({
playing={active}
hideDefault={false}
isTrackPremium={isTrackPremium && isPremiumEnabled}
isOwned={!isLocked}
isLocked={isLocked}
/>
{isTrackUnlisted ? (
<IconVisibilityHidden
Expand Down