Disable play/suffle buttons from empty collections.

This commit is contained in:
Franco Montenegro 2022-05-04 11:23:28 -03:00 committed by jessopb
parent de825fd4dc
commit 63ce691b90

View file

@ -54,6 +54,7 @@ function CollectionActions(props: Props) {
const isMobile = useIsMobile(); const isMobile = useIsMobile();
const claimId = claim && claim.claim_id; const claimId = claim && claim.claim_id;
const webShareable = true; // collections have cost? const webShareable = true; // collections have cost?
const isEmptyCollection = !firstItem;
const doPlay = React.useCallback( const doPlay = React.useCallback(
(playUri) => { (playUri) => {
@ -84,6 +85,7 @@ function CollectionActions(props: Props) {
icon={ICONS.PLAY} icon={ICONS.PLAY}
label={__('Play')} label={__('Play')}
title={__('Play')} title={__('Play')}
disabled={isEmptyCollection}
onClick={() => { onClick={() => {
doToggleShuffleList(collectionId, false); doToggleShuffleList(collectionId, false);
doPlay(firstItem); doPlay(firstItem);
@ -94,6 +96,7 @@ function CollectionActions(props: Props) {
icon={ICONS.SHUFFLE} icon={ICONS.SHUFFLE}
label={__('Shuffle Play')} label={__('Shuffle Play')}
title={__('Shuffle Play')} title={__('Shuffle Play')}
disabled={isEmptyCollection}
onClick={() => { onClick={() => {
doToggleShuffleList(collectionId, true); doToggleShuffleList(collectionId, true);
setDoShuffle(true); setDoShuffle(true);