mirror of
https://github.com/austinried/subtracks.git
synced 2025-12-27 17:19:27 +01:00
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import GradientScrollView from '@app/components/GradientScrollView'
|
|
import ListItem from '@app/components/ListItem'
|
|
import NowPlayingBar from '@app/components/NowPlayingBar'
|
|
import { useSkipTo } from '@app/hooks/trackplayer'
|
|
import { useStore } from '@app/state/store'
|
|
import { selectTrackPlayer } from '@app/state/trackplayer'
|
|
import { selectTrackPlayerMap } from '@app/state/trackplayermap'
|
|
import React from 'react'
|
|
import { StyleSheet, View } from 'react-native'
|
|
|
|
const NowPlayingQueue = React.memo<{}>(() => {
|
|
const queue = useStore(selectTrackPlayer.queue)
|
|
const mapTrackExtToSong = useStore(selectTrackPlayerMap.mapTrackExtToSong)
|
|
const skipTo = useSkipTo()
|
|
|
|
return (
|
|
<View style={styles.outerContainer}>
|
|
<GradientScrollView style={styles.container}>
|
|
<View style={styles.content}>
|
|
{queue.map(mapTrackExtToSong).map((song, i) => (
|
|
<ListItem
|
|
key={i}
|
|
item={song}
|
|
queueId={i}
|
|
onPress={() => skipTo(i)}
|
|
showArt={true}
|
|
subtitle={`${song.artist} • ${song.album}`}
|
|
/>
|
|
))}
|
|
</View>
|
|
</GradientScrollView>
|
|
<NowPlayingBar />
|
|
</View>
|
|
)
|
|
})
|
|
|
|
const styles = StyleSheet.create({
|
|
outerContainer: {
|
|
flex: 1,
|
|
},
|
|
container: {
|
|
flex: 1,
|
|
},
|
|
content: {
|
|
alignItems: 'center',
|
|
paddingTop: 10,
|
|
paddingHorizontal: 20,
|
|
},
|
|
})
|
|
|
|
export default NowPlayingQueue
|