Browse Source

Add toasts, change wording for play vs append

master
jeffvli 3 years ago
parent
commit
0f7b0e3caa
  1. 6
      src/components/card/Card.tsx
  2. 3
      src/components/library/AlbumView.tsx
  3. 2
      src/components/library/ArtistView.tsx
  4. 2
      src/components/playlist/PlaylistView.tsx

6
src/components/card/Card.tsx

@ -58,19 +58,19 @@ const Card = ({
if (playClick.type === 'playlist') { if (playClick.type === 'playlist') {
const res = await getPlaylist(playClick.id); const res = await getPlaylist(playClick.id);
dispatch(setPlayQueue({ entries: res.song })); dispatch(setPlayQueue({ entries: res.song }));
notifyToast('info', `Added ${res.song.length} song(s) to the queue`); notifyToast('info', `Playing ${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(setPlayQueue({ entries: res.song })); dispatch(setPlayQueue({ entries: res.song }));
notifyToast('info', `Added ${res.song.length} song(s) to the queue`); notifyToast('info', `Playing ${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(setPlayQueue({ entries: songs })); dispatch(setPlayQueue({ entries: songs }));
notifyToast('info', `Added ${songs.length} song(s) to the queue`); notifyToast('info', `Playing ${songs.length} song(s)`);
} }
dispatch(setStatus('PLAYING')); dispatch(setStatus('PLAYING'));

3
src/components/library/AlbumView.tsx

@ -26,6 +26,7 @@ import GenericPageHeader from '../layout/GenericPageHeader';
import { TagLink } from './styled'; import { TagLink } from './styled';
import { setStatus } from '../../redux/playerSlice'; import { setStatus } from '../../redux/playerSlice';
import { addModalPage } from '../../redux/miscSlice'; import { addModalPage } from '../../redux/miscSlice';
import { notifyToast } from '../shared/toast';
interface AlbumParams { interface AlbumParams {
id: string; id: string;
@ -92,6 +93,7 @@ const AlbumView = ({ ...rest }: any) => {
const handlePlay = () => { const handlePlay = () => {
dispatch(setPlayQueue({ entries: data.song })); dispatch(setPlayQueue({ entries: data.song }));
dispatch(setStatus('PLAYING')); dispatch(setStatus('PLAYING'));
notifyToast('info', `Playing ${data.song.length} song(s)`);
}; };
const handlePlayAppend = () => { const handlePlayAppend = () => {
@ -99,6 +101,7 @@ const AlbumView = ({ ...rest }: any) => {
if (playQueue.entry.length < 1) { if (playQueue.entry.length < 1) {
dispatch(setStatus('PLAYING')); dispatch(setStatus('PLAYING'));
} }
notifyToast('info', `Added ${data.song.length} song(s) to the queue`);
}; };
const handleFavorite = async () => { const handleFavorite = async () => {

2
src/components/library/ArtistView.tsx

@ -92,7 +92,7 @@ const ArtistView = ({ ...rest }: any) => {
const handlePlay = async () => { const handlePlay = async () => {
const songs = await getAllArtistSongs(data.id); const songs = await getAllArtistSongs(data.id);
dispatch(setPlayQueue({ entries: songs })); dispatch(setPlayQueue({ entries: songs }));
notifyToast('info', `Added ${songs.length} song(s) to the queue`); notifyToast('info', `Playing ${songs.length} song(s)`);
}; };
const handlePlayAppend = async () => { const handlePlayAppend = async () => {

2
src/components/playlist/PlaylistView.tsx

@ -161,6 +161,7 @@ const PlaylistView = ({ ...rest }) => {
const handlePlay = () => { const handlePlay = () => {
dispatch(setPlayQueue({ entries: playlist.entry })); dispatch(setPlayQueue({ entries: playlist.entry }));
dispatch(setStatus('PLAYING')); dispatch(setStatus('PLAYING'));
notifyToast('info', `Playing ${playlist.entry.length} song(s)`);
}; };
const handlePlayAppend = () => { const handlePlayAppend = () => {
@ -168,6 +169,7 @@ const PlaylistView = ({ ...rest }) => {
if (playQueue.entry.length < 1) { if (playQueue.entry.length < 1) {
dispatch(setStatus('PLAYING')); dispatch(setStatus('PLAYING'));
} }
notifyToast('info', `Added ${playlist.entry.length} song(s) to the queue`);
}; };
const handleSave = async (recovery: boolean) => { const handleSave = async (recovery: boolean) => {

Loading…
Cancel
Save