Skip to content

Commit

Permalink
[PAY-2126] Fix now playing play bar layouts (#6645)
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondjacobson authored Nov 10, 2023
1 parent effeb6b commit 749c240
Showing 1 changed file with 67 additions and 44 deletions.
111 changes: 67 additions & 44 deletions packages/mobile/src/components/now-playing-drawer/PlayBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
playerSelectors,
usePremiumContentAccess
} from '@audius/common'
import { TouchableOpacity, Animated, View, Dimensions } from 'react-native'
import { TouchableOpacity, Animated, View } from 'react-native'
import { useDispatch, useSelector } from 'react-redux'

import IconLock from 'app/assets/images/iconLock.svg'
Expand Down Expand Up @@ -40,15 +40,36 @@ const useStyles = makeStyles(({ palette, spacing }) => ({
alignItems: 'center',
zIndex: zIndex.PLAY_BAR
},
// Group: Favorite Button, Track Content, Play Button
container: {
height: '100%',
width: '100%',
paddingLeft: spacing(3),
paddingRight: spacing(3),
gap: spacing(3),
flexDirection: 'row',
alignItems: 'center'
},
favoriteContainer: {
flexShrink: 1,
alignItems: 'center',
justifyContent: 'center'
},
trackContainer: {
paddingRight: spacing(1),
height: '100%',
width: '100%',
flexGrow: 1,
flexShrink: 1,
alignItems: 'center',
justifyContent: 'flex-start'
flexDirection: 'row',
justifyContent: 'flex-start',
gap: spacing(3)
},
playContainer: {
flexShrink: 1,
alignItems: 'center',
justifyContent: 'center'
},
playIcon: {
width: spacing(8),
Expand All @@ -58,46 +79,22 @@ const useStyles = makeStyles(({ palette, spacing }) => ({
width: 28,
height: 28
},
trackInfo: {
height: '100%',
flexShrink: 1,
flexGrow: 1,
alignItems: 'center',
flexDirection: 'row',
gap: spacing(3)
},
// Group: Artwork, Text
artworkContainer: {
position: 'relative',
height: 26,
width: 26,
borderRadius: 2,
overflow: 'hidden'
},
artwork: {
height: '100%',
trackTextContainer: {
flexGrow: 1,
flexShrink: 1,
width: '100%',
backgroundColor: palette.neutralLight7
},
lockOverlay: {
backgroundColor: '#000',
opacity: 0.4,
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
alignItems: 'center',
justifyContent: 'center',
elevation: 10,
zIndex: 10
},
trackText: {
alignItems: 'center',
flexDirection: 'row'
},
// Group: Title, separator, artist
title: {
flexShrink: 1,
color: palette.neutral,
maxWidth: Dimensions.get('window').width / 3.5,
fontSize: spacing(3)
},
separator: {
Expand All @@ -107,9 +104,29 @@ const useStyles = makeStyles(({ palette, spacing }) => ({
fontSize: spacing(4)
},
artist: {
flexGrow: 1,
flexShrink: 1,
color: palette.neutral,
maxWidth: Dimensions.get('window').width / 4,
fontSize: spacing(3)
},
// Artwork interior
artwork: {
height: 26,
width: 26,
backgroundColor: palette.neutralLight7
},
lockOverlay: {
backgroundColor: '#000',
opacity: 0.4,
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
alignItems: 'center',
justifyContent: 'center',
elevation: 10,
zIndex: 10
}
}))

Expand Down Expand Up @@ -179,10 +196,12 @@ export const PlayBar = (props: PlayBarProps) => {
translateYAnimation={translationAnim}
/>
<View style={styles.container}>
{shouldShowPreviewLock ? null : renderFavoriteButton()}
{shouldShowPreviewLock ? null : (
<View style={styles.favoriteContainer}>{renderFavoriteButton()}</View>
)}
<TouchableOpacity
activeOpacity={1}
style={styles.trackInfo}
style={styles.trackContainer}
onPress={onPress}
>
{track ? (
Expand All @@ -199,7 +218,7 @@ export const PlayBar = (props: PlayBarProps) => {
/>
</View>
) : null}
<View style={styles.trackText}>
<View style={styles.trackTextContainer}>
<Text numberOfLines={1} weight='bold' style={styles.title}>
{track?.title ?? ''}
</Text>
Expand All @@ -215,16 +234,20 @@ export const PlayBar = (props: PlayBarProps) => {
</Text>
</View>
{shouldShowPreviewLock ? (
<LockedStatusBadge
variant='purchase'
locked
coloredWhenLocked
iconSize='small'
text={messages.preview}
/>
<View>
<LockedStatusBadge
variant='purchase'
locked
coloredWhenLocked
iconSize='small'
text={messages.preview}
/>
</View>
) : null}
</TouchableOpacity>
<PlayButton wrapperStyle={styles.playIcon} />
<View style={styles.playContainer}>
<PlayButton wrapperStyle={styles.playIcon} />
</View>
</View>
</Animated.View>
)
Expand Down

0 comments on commit 749c240

Please sign in to comment.