fix(My Library): Set playlistID when playing from details (#377)

This commit is contained in:
Yannis Petitot
2021-04-06 17:57:07 +02:00
committed by GitHub
parent c20e7979cb
commit 5a76904232
3 changed files with 5 additions and 5 deletions
@@ -4,7 +4,7 @@ import { useDownloadHistory } from '../HistoryProvider';
import { getAudioFilePath, makePlaylist } from './audioPlayer.helpers';
import { useAudioPlayer } from './AudioPlayerProvider.bs';
const useBeatmapSong = ({ id, title, artist }, mode = '', items = []) => {
const useBeatmapSong = ({ id, title, artist, collectionName }, mode = '', items = []) => {
const isLibraryMode = mode === 'library';
const osuSongPath = useSelector(getOsuSongPath);
@@ -26,7 +26,7 @@ const useBeatmapSong = ({ id, title, artist }, mode = '', items = []) => {
if (isSelected) audioPlayer.togglePlayPause();
else if (isLibraryMode) {
audioPlayer.setAudio({ id, title, artist }, audioPath || undefined);
audioPlayer.setPlaylist(makePlaylist(items, osuSongPath, history.history));
audioPlayer.setPlaylist(makePlaylist(items, osuSongPath, history.history), collectionName);
} else audioPlayer.setAudio({ id, title, artist }, audioPath || undefined, previewTime || undefined);
};
@@ -42,7 +42,7 @@ const CollectionDetails = ({ windowSize, collection, select, collectionName }) =
itemCount={itemCount}
itemSize={50}
width={listWidth}
itemData={{ items: displayedItems, itemMode: 'library' }}
itemData={{ items: displayedItems, itemMode: 'library', collectionName }}
>
{BeatmapListItem}
</List>
@@ -90,7 +90,7 @@ const useStyle = createUseStyles({
});
const BeatmapListItem = ({ index, style, data }) => {
const { removeItemfromQueue = () => {}, items, itemMode = 'pack' || 'download' || 'library' } = data;
const { removeItemfromQueue = () => {}, items, itemMode = 'pack' || 'download' || 'library', collectionName } = data;
const isPackMode = itemMode === 'pack';
const isDownloadMode = itemMode === 'download';
const isLibraryMode = itemMode === 'library';
@@ -109,7 +109,7 @@ const BeatmapListItem = ({ index, style, data }) => {
const isDownloading = downloadProgress >= 0;
const isPaused = status === config.download.status.paused;
const { isPlaying, isSelected, playPreview } = useBeatmapSong({ id, title, artist }, itemMode, items);
const { isPlaying, isSelected, playPreview } = useBeatmapSong({ id, title, artist, collectionName }, itemMode, items);
const handleClick = () => {
if (isDownloadMode) return;