Browse Source

Fix play buttons not starting playback

master
jeffvli 3 years ago
committed by Jeff
parent
commit
e5b98faa8b
  1. 6
      src/components/library/ArtistView.tsx

6
src/components/library/ArtistView.tsx

@ -33,6 +33,7 @@ import { appendPlayQueue, setPlayQueue } from '../../redux/playQueueSlice';
import { notifyToast } from '../shared/toast';
import { isCached } from '../../shared/utils';
import { StyledButton } from '../shared/styled';
import { setStatus } from '../../redux/playerSlice';
interface ArtistParams {
id: string;
@ -42,6 +43,7 @@ const ArtistView = ({ ...rest }: any) => {
const dispatch = useAppDispatch();
const queryClient = useQueryClient();
const history = useHistory();
const playQueue = useAppSelector((state) => state.playQueue);
const misc = useAppSelector((state) => state.misc);
const [viewType, setViewType] = useState(settings.getSync('albumViewType') || 'list');
const { id } = useParams<ArtistParams>();
@ -100,12 +102,16 @@ const ArtistView = ({ ...rest }: any) => {
const handlePlay = async () => {
const songs = await getAllArtistSongs(data.id);
dispatch(setPlayQueue({ entries: songs }));
dispatch(setStatus('PLAYING'));
notifyToast('info', `Playing ${songs.length} song(s)`);
};
const handlePlayAppend = async (type: 'next' | 'later') => {
const songs = await getAllArtistSongs(data.id);
dispatch(appendPlayQueue({ entries: songs, type }));
if (playQueue.entry.length < 1) {
dispatch(setStatus('PLAYING'));
}
notifyToast('info', `Added ${songs.length} song(s)`);
};

Loading…
Cancel
Save