mirror of
https://github.com/austinried/subtracks.git
synced 2026-02-10 15:02:42 +01:00
fix current idx not being set on toggle shuffle
switch to passing params instead of function
This commit is contained in:
@@ -5,7 +5,7 @@ import GradientScrollView from '@app/components/GradientScrollView'
|
||||
import Header from '@app/components/Header'
|
||||
import ListItem from '@app/components/ListItem'
|
||||
import { useArtistInfo } from '@app/hooks/music'
|
||||
import { useIsPlaying, useSetQueue } from '@app/hooks/trackplayer'
|
||||
import { useSetQueue } from '@app/hooks/trackplayer'
|
||||
import { Album, Song } from '@app/models/music'
|
||||
import colors from '@app/styles/colors'
|
||||
import font from '@app/styles/font'
|
||||
@@ -45,7 +45,6 @@ const TopSongs = React.memo<{
|
||||
artistId: string
|
||||
}>(({ songs, name, artistId }) => {
|
||||
const setQueue = useSetQueue()
|
||||
const isPlaying = useIsPlaying()
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -54,7 +53,8 @@ const TopSongs = React.memo<{
|
||||
<ListItem
|
||||
key={i}
|
||||
item={s}
|
||||
isPlaying={() => isPlaying(artistId, i)}
|
||||
contextId={artistId}
|
||||
queueId={i}
|
||||
showArt={true}
|
||||
subtitle={s.album}
|
||||
onPress={() => setQueue(songs, name, 'artist', artistId, i)}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import GradientScrollView from '@app/components/GradientScrollView'
|
||||
import ListItem from '@app/components/ListItem'
|
||||
import NowPlayingBar from '@app/components/NowPlayingBar'
|
||||
import { mapTrackExtToSong, useIsPlaying, useSkipTo } from '@app/hooks/trackplayer'
|
||||
import { mapTrackExtToSong, useSkipTo } from '@app/hooks/trackplayer'
|
||||
import { useStore } from '@app/state/store'
|
||||
import { selectTrackPlayer } from '@app/state/trackplayer'
|
||||
import React from 'react'
|
||||
@@ -10,7 +10,6 @@ import { StyleSheet, View } from 'react-native'
|
||||
const NowPlayingQueue = React.memo<{}>(() => {
|
||||
const queue = useStore(selectTrackPlayer.queue)
|
||||
const skipTo = useSkipTo()
|
||||
const isPlaying = useIsPlaying()
|
||||
|
||||
return (
|
||||
<View style={styles.outerContainer}>
|
||||
@@ -20,7 +19,7 @@ const NowPlayingQueue = React.memo<{}>(() => {
|
||||
<ListItem
|
||||
key={i}
|
||||
item={song}
|
||||
isPlaying={() => isPlaying(undefined, i)}
|
||||
queueId={i}
|
||||
onPress={() => skipTo(i)}
|
||||
showArt={true}
|
||||
subtitle={`${song.artist} • ${song.album}`}
|
||||
|
||||
@@ -327,7 +327,7 @@ const PlayerControls = () => {
|
||||
<View style={controlsStyles.container}>
|
||||
<View style={controlsStyles.top}>
|
||||
<View style={controlsStyles.center}>
|
||||
<PressableOpacity onPress={() => toggleRepeat()} disabled={disabled}>
|
||||
<PressableOpacity onPress={() => toggleRepeat()} disabled={disabled} hitSlop={16}>
|
||||
<Icon name="repeat" size={26} color={repeatMode === RepeatMode.Off ? 'white' : colors.accent} />
|
||||
<Text style={[controlsStyles.repeatExt, repeatMode === RepeatMode.Track ? { opacity: 1 } : {}]}>1</Text>
|
||||
</PressableOpacity>
|
||||
@@ -346,16 +346,16 @@ const PlayerControls = () => {
|
||||
</View>
|
||||
|
||||
<View style={controlsStyles.center}>
|
||||
<PressableOpacity onPress={() => toggleShuffle()} disabled={disabled}>
|
||||
<PressableOpacity onPress={() => toggleShuffle()} disabled={disabled} hitSlop={16}>
|
||||
<Icon name="shuffle" size={26} color={shuffled ? colors.accent : 'white'} />
|
||||
</PressableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
<View style={controlsStyles.bottom}>
|
||||
<PressableOpacity onPress={undefined} disabled={true}>
|
||||
<PressableOpacity onPress={undefined} disabled={true} hitSlop={16}>
|
||||
<IconMatCom name="cast-audio" size={20} color="white" />
|
||||
</PressableOpacity>
|
||||
<PressableOpacity onPress={() => navigation.navigate('queue')} disabled={disabled}>
|
||||
<PressableOpacity onPress={() => navigation.navigate('queue')} disabled={disabled} hitSlop={16}>
|
||||
<IconMatCom name="playlist-play" size={24} color="white" />
|
||||
</PressableOpacity>
|
||||
</View>
|
||||
|
||||
@@ -3,7 +3,7 @@ import Header from '@app/components/Header'
|
||||
import ListItem from '@app/components/ListItem'
|
||||
import NothingHere from '@app/components/NothingHere'
|
||||
import { useActiveListRefresh2 } from '@app/hooks/server'
|
||||
import { useIsPlaying, useSetQueue } from '@app/hooks/trackplayer'
|
||||
import { useSetQueue } from '@app/hooks/trackplayer'
|
||||
import { ListableItem, SearchResults, Song } from '@app/models/music'
|
||||
import { selectMusic } from '@app/state/music'
|
||||
import { useStore } from '@app/state/store'
|
||||
@@ -15,12 +15,12 @@ import { ActivityIndicator, StatusBar, StyleSheet, TextInput, View } from 'react
|
||||
|
||||
const SongItem = React.memo<{ item: Song }>(({ item }) => {
|
||||
const setQueue = useSetQueue()
|
||||
const isPlaying = useIsPlaying()
|
||||
|
||||
return (
|
||||
<ListItem
|
||||
item={item}
|
||||
isPlaying={() => isPlaying(item.id, 0)}
|
||||
contextId={item.id}
|
||||
queueId={0}
|
||||
showArt={true}
|
||||
showStar={false}
|
||||
onPress={() => setQueue([item], item.title, 'song', item.id, 0)}
|
||||
|
||||
@@ -5,7 +5,7 @@ import ListItem from '@app/components/ListItem'
|
||||
import ListPlayerControls from '@app/components/ListPlayerControls'
|
||||
import NothingHere from '@app/components/NothingHere'
|
||||
import { useAlbumWithSongs, useCoverArtUri, usePlaylistWithSongs } from '@app/hooks/music'
|
||||
import { useIsPlaying, useSetQueue } from '@app/hooks/trackplayer'
|
||||
import { useSetQueue } from '@app/hooks/trackplayer'
|
||||
import { AlbumWithSongs, PlaylistWithSongs, Song } from '@app/models/music'
|
||||
import colors from '@app/styles/colors'
|
||||
import font from '@app/styles/font'
|
||||
@@ -28,7 +28,6 @@ const Songs = React.memo<{
|
||||
itemId: string
|
||||
}>(({ songs, name, type, itemId }) => {
|
||||
const setQueue = useSetQueue()
|
||||
const isPlaying = useIsPlaying()
|
||||
|
||||
const _songs = [...songs]
|
||||
let typeName = ''
|
||||
@@ -57,7 +56,8 @@ const Songs = React.memo<{
|
||||
<ListItem
|
||||
key={i}
|
||||
item={s}
|
||||
isPlaying={() => isPlaying(itemId, i)}
|
||||
contextId={itemId}
|
||||
queueId={i}
|
||||
subtitle={s.artist}
|
||||
onPress={() => setQueue(songs, name, type, itemId, i)}
|
||||
showArt={type === 'playlist'}
|
||||
|
||||
Reference in New Issue
Block a user