|
@ -22,6 +22,7 @@ import { |
|
|
FavoriteOverlayButton, |
|
|
FavoriteOverlayButton, |
|
|
AppendOverlayButton, |
|
|
AppendOverlayButton, |
|
|
ModalViewOverlayButton, |
|
|
ModalViewOverlayButton, |
|
|
|
|
|
AppendNextOverlayButton, |
|
|
} from './styled'; |
|
|
} from './styled'; |
|
|
import { setStatus } from '../../redux/playerSlice'; |
|
|
import { setStatus } from '../../redux/playerSlice'; |
|
|
import { addModalPage } from '../../redux/miscSlice'; |
|
|
import { addModalPage } from '../../redux/miscSlice'; |
|
@ -75,22 +76,22 @@ const Card = ({ |
|
|
dispatch(fixPlayer2Index()); |
|
|
dispatch(fixPlayer2Index()); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const handlePlayAppend = async () => { |
|
|
const handlePlayAppend = async (type: 'next' | 'later') => { |
|
|
if (playClick.type === 'playlist') { |
|
|
if (playClick.type === 'playlist') { |
|
|
const res = await getPlaylist(playClick.id); |
|
|
const res = await getPlaylist(playClick.id); |
|
|
dispatch(appendPlayQueue({ entries: res.song })); |
|
|
dispatch(appendPlayQueue({ entries: res.song, type })); |
|
|
notifyToast('info', `Added ${res.song.length} song(s)`); |
|
|
notifyToast('info', `Added ${res.song.length} song(s)`); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (playClick.type === 'album') { |
|
|
if (playClick.type === 'album') { |
|
|
const res = await getAlbum(playClick.id); |
|
|
const res = await getAlbum(playClick.id); |
|
|
dispatch(appendPlayQueue({ entries: res.song })); |
|
|
dispatch(appendPlayQueue({ entries: res.song, type })); |
|
|
notifyToast('info', `Added ${res.song.length} song(s)`); |
|
|
notifyToast('info', `Added ${res.song.length} song(s)`); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (playClick.type === 'artist') { |
|
|
if (playClick.type === 'artist') { |
|
|
const songs = await getAllArtistSongs(playClick.id); |
|
|
const songs = await getAllArtistSongs(playClick.id); |
|
|
dispatch(appendPlayQueue({ entries: songs })); |
|
|
dispatch(appendPlayQueue({ entries: songs, type })); |
|
|
notifyToast('info', `Added ${songs.length} song(s)`); |
|
|
notifyToast('info', `Added ${songs.length} song(s)`); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -171,20 +172,25 @@ const Card = ({ |
|
|
onClick={handlePlayClick} |
|
|
onClick={handlePlayClick} |
|
|
/> |
|
|
/> |
|
|
<AppendOverlayButton |
|
|
<AppendOverlayButton |
|
|
onClick={handlePlayAppend} |
|
|
onClick={() => handlePlayAppend('later')} |
|
|
size="xs" |
|
|
size={size <= 160 ? 'xs' : 'sm'} |
|
|
icon={<Icon icon="plus" />} |
|
|
icon={<Icon icon="plus" />} |
|
|
/> |
|
|
/> |
|
|
|
|
|
<AppendNextOverlayButton |
|
|
|
|
|
onClick={() => handlePlayAppend('next')} |
|
|
|
|
|
size={size <= 160 ? 'xs' : 'sm'} |
|
|
|
|
|
icon={<Icon icon="plus-circle" />} |
|
|
|
|
|
/> |
|
|
{playClick.type !== 'playlist' && ( |
|
|
{playClick.type !== 'playlist' && ( |
|
|
<FavoriteOverlayButton |
|
|
<FavoriteOverlayButton |
|
|
onClick={handleFavorite} |
|
|
onClick={handleFavorite} |
|
|
size="xs" |
|
|
size={size <= 160 ? 'xs' : 'sm'} |
|
|
icon={<Icon icon={rest.details.starred ? 'heart' : 'heart-o'} />} |
|
|
icon={<Icon icon={rest.details.starred ? 'heart' : 'heart-o'} />} |
|
|
/> |
|
|
/> |
|
|
)} |
|
|
)} |
|
|
{!rest.isModal && ( |
|
|
{!rest.isModal && ( |
|
|
<ModalViewOverlayButton |
|
|
<ModalViewOverlayButton |
|
|
size="xs" |
|
|
size={size <= 160 ? 'xs' : 'sm'} |
|
|
icon={<Icon icon="external-link" />} |
|
|
icon={<Icon icon="external-link" />} |
|
|
onClick={handleOpenModal} |
|
|
onClick={handleOpenModal} |
|
|
/> |
|
|
/> |
|
|