1+ import { useCallback } from 'react'
2+
13import { useCurrentUserId , useToggleFavoriteTrack } from '@audius/common/api'
2- import { useGatedContentAccess } from '@audius/common/hooks'
4+ import {
5+ useGatedContentAccess ,
6+ useQueueNewFeatureBadge
7+ } from '@audius/common/hooks'
38import { FavoriteSource , SquareSizes } from '@audius/common/models'
49import type { Track , User } from '@audius/common/models'
510import { playbackSelectors } from '@audius/common/store'
611import type { Nullable } from '@audius/common/utils'
712import { TouchableOpacity , Animated , View } from 'react-native'
813import { useSelector } from 'react-redux'
914
10- import { IconLock } from '@audius/harmony-native'
15+ import { IconButton , IconIndent , IconLock } from '@audius/harmony-native'
1116import { FavoriteButton } from 'app/components/favorite-button'
1217import Text from 'app/components/text'
18+ import { useDrawer } from 'app/hooks/useDrawer'
1319import { makeStyles } from 'app/styles'
1420import { useColor } from 'app/utils/theme'
1521import { zIndex } from 'app/utils/zIndex'
@@ -23,7 +29,8 @@ import { NOW_PLAYING_HEIGHT, PLAY_BAR_HEIGHT } from './constants'
2329const { getPreviewing } = playbackSelectors
2430
2531const messages = {
26- preview : 'PREVIEW'
32+ preview : 'PREVIEW' ,
33+ queueLabel : 'Queue'
2734}
2835
2936const useStyles = makeStyles ( ( { palette, spacing } ) => ( {
@@ -59,6 +66,11 @@ const useStyles = makeStyles(({ palette, spacing }) => ({
5966 justifyContent : 'flex-start' ,
6067 gap : spacing ( 3 )
6168 } ,
69+ queueContainer : {
70+ flexShrink : 0 ,
71+ alignItems : 'center' ,
72+ justifyContent : 'center'
73+ } ,
6274 playContainer : {
6375 flexShrink : 1 ,
6476 alignItems : 'center' ,
@@ -151,6 +163,18 @@ export const PlayBar = (props: PlayBarProps) => {
151163 source : FavoriteSource . PLAYBAR
152164 } )
153165
166+ const { onOpen : openQueue } = useDrawer ( 'Queue' )
167+ const {
168+ showBadge : showQueueNewFeatureBadge ,
169+ dismiss : dismissQueueNewFeatureBadge
170+ } = useQueueNewFeatureBadge ( )
171+ const handleOpenQueue = useCallback ( ( ) => {
172+ if ( showQueueNewFeatureBadge ) {
173+ dismissQueueNewFeatureBadge ( )
174+ }
175+ openQueue ( )
176+ } , [ showQueueNewFeatureBadge , dismissQueueNewFeatureBadge , openQueue ] )
177+
154178 const renderFavoriteButton = ( ) => {
155179 return (
156180 < FavoriteButton
@@ -231,6 +255,15 @@ export const PlayBar = (props: PlayBarProps) => {
231255 </ View >
232256 ) : null }
233257 </ TouchableOpacity >
258+ < View style = { styles . queueContainer } >
259+ < IconButton
260+ icon = { IconIndent }
261+ onPress = { handleOpenQueue }
262+ size = 'l'
263+ color = { showQueueNewFeatureBadge ? 'active' : 'default' }
264+ aria-label = { messages . queueLabel }
265+ />
266+ </ View >
234267 < View style = { styles . playContainer } >
235268 < PlayButton wrapperStyle = { styles . playIcon } />
236269 </ View >
0 commit comments