Skip to content
Merged
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
39 changes: 36 additions & 3 deletions packages/mobile/src/components/now-playing-drawer/PlayBar.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { useCallback } from 'react'

import { useCurrentUserId, useToggleFavoriteTrack } from '@audius/common/api'
import { useGatedContentAccess } from '@audius/common/hooks'
import {
useGatedContentAccess,
useQueueNewFeatureBadge
} from '@audius/common/hooks'
import { FavoriteSource, SquareSizes } from '@audius/common/models'
import type { Track, User } from '@audius/common/models'
import { playbackSelectors } from '@audius/common/store'
import type { Nullable } from '@audius/common/utils'
import { TouchableOpacity, Animated, View } from 'react-native'
import { useSelector } from 'react-redux'

import { IconLock } from '@audius/harmony-native'
import { IconButton, IconIndent, IconLock } from '@audius/harmony-native'
import { FavoriteButton } from 'app/components/favorite-button'
import Text from 'app/components/text'
import { useDrawer } from 'app/hooks/useDrawer'
import { makeStyles } from 'app/styles'
import { useColor } from 'app/utils/theme'
import { zIndex } from 'app/utils/zIndex'
Expand All @@ -23,7 +29,8 @@ import { NOW_PLAYING_HEIGHT, PLAY_BAR_HEIGHT } from './constants'
const { getPreviewing } = playbackSelectors

const messages = {
preview: 'PREVIEW'
preview: 'PREVIEW',
queueLabel: 'Queue'
}

const useStyles = makeStyles(({ palette, spacing }) => ({
Expand Down Expand Up @@ -59,6 +66,11 @@ const useStyles = makeStyles(({ palette, spacing }) => ({
justifyContent: 'flex-start',
gap: spacing(3)
},
queueContainer: {
flexShrink: 0,
alignItems: 'center',
justifyContent: 'center'
},
playContainer: {
flexShrink: 1,
alignItems: 'center',
Expand Down Expand Up @@ -151,6 +163,18 @@ export const PlayBar = (props: PlayBarProps) => {
source: FavoriteSource.PLAYBAR
})

const { onOpen: openQueue } = useDrawer('Queue')
const {
showBadge: showQueueNewFeatureBadge,
dismiss: dismissQueueNewFeatureBadge
} = useQueueNewFeatureBadge()
const handleOpenQueue = useCallback(() => {
if (showQueueNewFeatureBadge) {
dismissQueueNewFeatureBadge()
}
openQueue()
}, [showQueueNewFeatureBadge, dismissQueueNewFeatureBadge, openQueue])

const renderFavoriteButton = () => {
return (
<FavoriteButton
Expand Down Expand Up @@ -231,6 +255,15 @@ export const PlayBar = (props: PlayBarProps) => {
</View>
) : null}
</TouchableOpacity>
<View style={styles.queueContainer}>
<IconButton
icon={IconIndent}
onPress={handleOpenQueue}
size='l'
color={showQueueNewFeatureBadge ? 'active' : 'default'}
aria-label={messages.queueLabel}
/>
</View>
<View style={styles.playContainer}>
<PlayButton wrapperStyle={styles.playIcon} />
</View>
Expand Down
Loading