From 610886006380cc72281062162bb85fd891f3b867 Mon Sep 17 00:00:00 2001 From: Franco Montenegro Date: Wed, 4 May 2022 12:20:06 -0300 Subject: [PATCH] Do not show shuffle option for empty collections. --- ui/component/claimMenuList/view.jsx | 31 ++++++++++++++++++----------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/ui/component/claimMenuList/view.jsx b/ui/component/claimMenuList/view.jsx index f1f57787d..b444a804e 100644 --- a/ui/component/claimMenuList/view.jsx +++ b/ui/component/claimMenuList/view.jsx @@ -110,6 +110,11 @@ function ClaimMenuList(props: Props) { const [doShuffle, setDoShuffle] = React.useState(false); const incognitoClaim = contentChannelUri && !contentChannelUri.includes('@'); const isChannel = !incognitoClaim && !contentSigningChannel; + // $FlowFixMe + const claimLength = claim && claim.value && claim.value.claims && claim.value.claims.length; + // $FlowFixMe + const claimCount = editedCollection ? editedCollection.items.length : claimLength; + const isEmptyCollection = (Number(claimCount) || 0) <= 0; const { channelName } = parseURI(contentChannelUri); const showDelete = claimIsMine || (fileInfo && (fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0)); const subscriptionLabel = repostedClaim @@ -297,18 +302,20 @@ function ClaimMenuList(props: Props) { {__('View List')} - { - if (!resolvedList) fetchItems(); - setDoShuffle(true); - }} - > -
- - {__('Shuffle Play')} -
-
+ {!isEmptyCollection && ( + { + if (!resolvedList) fetchItems(); + setDoShuffle(true); + }} + > +
+ + {__('Shuffle Play')} +
+
+ )} {isMyCollection && ( <>