fix duplicate songs showing as playing

made playing icon in line with text (doesn't work well with scaling)
This commit is contained in:
austinried
2021-08-10 17:33:07 +09:00
parent 2c0fdfed4d
commit ea45678733
6 changed files with 42 additions and 15 deletions

View File

@@ -243,6 +243,18 @@ export const useSetQueue = () => {
})
}
export const useIsPlaying = () => {
const queueContextId = useStore(selectTrackPlayer.queueContextId)
const currentTrackIdx = useStore(selectTrackPlayer.currentTrackIdx)
return (contextId: string | undefined, track: number) => {
if (contextId === undefined) {
return track === currentTrackIdx
}
return contextId === queueContextId && track === currentTrackIdx
}
}
function mapSongToTrack(song: Song, coverArtUri: (coverArt?: string) => string | undefined): TrackExt {
return {
id: song.id,