Skip to content

Commit 09a9e8b

Browse files
authored
feat(mobile): add queue icon to mini player (#14340)
1 parent a2018a1 commit 09a9e8b

1 file changed

Lines changed: 36 additions & 3 deletions

File tree

  • packages/mobile/src/components/now-playing-drawer

packages/mobile/src/components/now-playing-drawer/PlayBar.tsx

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1+
import { useCallback } from 'react'
2+
13
import { useCurrentUserId, useToggleFavoriteTrack } from '@audius/common/api'
2-
import { useGatedContentAccess } from '@audius/common/hooks'
4+
import {
5+
useGatedContentAccess,
6+
useQueueNewFeatureBadge
7+
} from '@audius/common/hooks'
38
import { FavoriteSource, SquareSizes } from '@audius/common/models'
49
import type { Track, User } from '@audius/common/models'
510
import { playbackSelectors } from '@audius/common/store'
611
import type { Nullable } from '@audius/common/utils'
712
import { TouchableOpacity, Animated, View } from 'react-native'
813
import { useSelector } from 'react-redux'
914

10-
import { IconLock } from '@audius/harmony-native'
15+
import { IconButton, IconIndent, IconLock } from '@audius/harmony-native'
1116
import { FavoriteButton } from 'app/components/favorite-button'
1217
import Text from 'app/components/text'
18+
import { useDrawer } from 'app/hooks/useDrawer'
1319
import { makeStyles } from 'app/styles'
1420
import { useColor } from 'app/utils/theme'
1521
import { zIndex } from 'app/utils/zIndex'
@@ -23,7 +29,8 @@ import { NOW_PLAYING_HEIGHT, PLAY_BAR_HEIGHT } from './constants'
2329
const { getPreviewing } = playbackSelectors
2430

2531
const messages = {
26-
preview: 'PREVIEW'
32+
preview: 'PREVIEW',
33+
queueLabel: 'Queue'
2734
}
2835

2936
const 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

Comments
 (0)