diff --git a/ui/component/claimMenuList/view.jsx b/ui/component/claimMenuList/view.jsx index b444a804e..36085b24d 100644 --- a/ui/component/claimMenuList/view.jsx +++ b/ui/component/claimMenuList/view.jsx @@ -340,9 +340,9 @@ function ClaimMenuList(props: Props) { )} ) : ( - isPlayable && ( - <> - {/* WATCH LATER */} + <> + {/* WATCH LATER */} + {isPlayable && ( handleAdd(hasClaimInWatchLater, __('Watch Later'), COLLECTIONS_CONSTS.WATCH_LATER_ID)} @@ -352,45 +352,45 @@ function ClaimMenuList(props: Props) { {hasClaimInWatchLater ? __('In Watch Later') : __('Watch Later')} - {/* FAVORITES LIST */} + )} + {/* FAVORITES LIST */} + handleAdd(hasClaimInFavorites, __('Favorites'), COLLECTIONS_CONSTS.FAVORITES_ID)} + > +
+ + {hasClaimInFavorites ? __('In Favorites') : __('Favorites')} +
+
+ {/* CURRENTLY ONLY SUPPORT PLAYLISTS FOR PLAYABLE; LATER DIFFERENT TYPES */} + openModal(MODALS.COLLECTION_ADD, { uri, type: 'playlist' })} + > +
+ + {__('Add to Lists')} +
+
+ {lastUsedCollection && lastUsedCollectionIsNotBuiltin && ( handleAdd(hasClaimInFavorites, __('Favorites'), COLLECTIONS_CONSTS.FAVORITES_ID)} + onSelect={() => + handleAdd(hasClaimInLastUsedCollection, lastUsedCollection.name, lastUsedCollection.id) + } >
- - {hasClaimInFavorites ? __('In Favorites') : __('Favorites')} + {!hasClaimInLastUsedCollection && } + {hasClaimInLastUsedCollection && } + {!hasClaimInLastUsedCollection && + __('Add to %collection%', { collection: lastUsedCollection.name })} + {hasClaimInLastUsedCollection && __('In %collection%', { collection: lastUsedCollection.name })}
- {/* CURRENTLY ONLY SUPPORT PLAYLISTS FOR PLAYABLE; LATER DIFFERENT TYPES */} - openModal(MODALS.COLLECTION_ADD, { uri, type: 'playlist' })} - > -
- - {__('Add to Lists')} -
-
- {lastUsedCollection && lastUsedCollectionIsNotBuiltin && ( - - handleAdd(hasClaimInLastUsedCollection, lastUsedCollection.name, lastUsedCollection.id) - } - > -
- {!hasClaimInLastUsedCollection && } - {hasClaimInLastUsedCollection && } - {!hasClaimInLastUsedCollection && - __('Add to %collection%', { collection: lastUsedCollection.name })} - {hasClaimInLastUsedCollection && __('In %collection%', { collection: lastUsedCollection.name })} -
-
- )} -
- - ) + )} +
+ )} {!isChannelPage && ( diff --git a/ui/component/viewers/videoViewer/index.js b/ui/component/viewers/videoViewer/index.js index 3b1f0df8a..6d6bc67db 100644 --- a/ui/component/viewers/videoViewer/index.js +++ b/ui/component/viewers/videoViewer/index.js @@ -34,12 +34,38 @@ const select = (state, props) => { const playingUri = selectPlayingUri(state); const collectionId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID) || (playingUri && playingUri.collectionId); const isMarkdownOrComment = playingUri && (playingUri.source === 'markdown' || playingUri.source === 'comment'); + const isClaimPlayable = (uri) => { + const claim = makeSelectClaimForUri(uri)(state); + // $FlowFixMe + return ( + claim && + // $FlowFixMe + claim.value && + // $FlowFixMe + claim.value.stream_type && + // $FlowFixMe + (claim.value.stream_type === 'audio' || claim.value.stream_type === 'video') + ); + }; + const nextUriInCollection = (fromUri) => { + return makeSelectNextUrlForCollectionAndUrl(collectionId, fromUri)(state); + }; + const prevUriInCollection = (fromUri) => { + return makeSelectPreviousUrlForCollectionAndUrl(collectionId, fromUri)(state); + }; let nextRecommendedUri; let previousListUri; if (collectionId) { - nextRecommendedUri = makeSelectNextUrlForCollectionAndUrl(collectionId, uri)(state); - previousListUri = makeSelectPreviousUrlForCollectionAndUrl(collectionId, uri)(state); + nextRecommendedUri = uri; + previousListUri = uri; + // Find previous and next playable item in the collection. + do { + nextRecommendedUri = nextUriInCollection(nextRecommendedUri); + } while (nextRecommendedUri && !isClaimPlayable(nextRecommendedUri)); + do { + previousListUri = prevUriInCollection(previousListUri); + } while (previousListUri && !isClaimPlayable(previousListUri)); } else { const recommendedContent = selectRecommendedContentForUri(state, uri); nextRecommendedUri = recommendedContent && recommendedContent[0];