diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 2e80e74..d38ae0a 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -3697,6 +3697,19 @@ const makeSelectCollectionForId = id => reselect.createSelector(selectBuiltinCol return collection; }); +const makeSelectClaimUrlInCollection = url => reselect.createSelector(selectBuiltinCollections, selectResolvedCollections, selectMyUnpublishedCollections, selectMyEditedCollections, selectPendingCollections, (bLists, rLists, uLists, eLists, pLists) => { + const collections = [bLists, uLists, eLists, rLists, pLists]; + const itemsInCollections = []; + collections.map(list => { + Object.entries(list).forEach(([key, value]) => { + value.items.map(item => { + itemsInCollections.push(item); + }); + }); + }); + return itemsInCollections.includes(url); +}); + const makeSelectCollectionForIdHasClaimUrl = (id, url) => reselect.createSelector(makeSelectCollectionForId(id), collection => collection && collection.items.includes(url)); const makeSelectUrlsForCollectionId = id => reselect.createSelector(makeSelectCollectionForId(id), collection => collection && collection.items); @@ -7981,6 +7994,7 @@ exports.makeSelectClaimIsMine = makeSelectClaimIsMine; exports.makeSelectClaimIsNsfw = makeSelectClaimIsNsfw; exports.makeSelectClaimIsPending = makeSelectClaimIsPending; exports.makeSelectClaimIsStreamPlaceholder = makeSelectClaimIsStreamPlaceholder; +exports.makeSelectClaimUrlInCollection = makeSelectClaimUrlInCollection; exports.makeSelectClaimWasPurchased = makeSelectClaimWasPurchased; exports.makeSelectClaimsInChannelForPage = makeSelectClaimsInChannelForPage; exports.makeSelectCollectionForId = makeSelectCollectionForId; diff --git a/src/index.js b/src/index.js index cb38ecf..fd1090c 100644 --- a/src/index.js +++ b/src/index.js @@ -176,6 +176,7 @@ export { makeSelectMyPublishedCollectionForId, makeSelectUnpublishedCollectionForId, makeSelectCollectionForId, + makeSelectClaimUrlInCollection, makeSelectUrlsForCollectionId, makeSelectClaimIdsForCollectionId, makeSelectNameForCollectionId, diff --git a/src/redux/selectors/collections.js b/src/redux/selectors/collections.js index 24a8038..5d047b4 100644 --- a/src/redux/selectors/collections.js +++ b/src/redux/selectors/collections.js @@ -163,6 +163,27 @@ export const makeSelectCollectionForId = (id: string) => } ); +export const makeSelectClaimUrlInCollection = (url: string) => + createSelector( + selectBuiltinCollections, + selectResolvedCollections, + selectMyUnpublishedCollections, + selectMyEditedCollections, + selectPendingCollections, + (bLists, rLists, uLists, eLists, pLists) => { + const collections = [bLists, uLists, eLists, rLists, pLists]; + const itemsInCollections = []; + collections.map(list => { + Object.entries(list).forEach(([key, value]) => { + value.items.map(item => { + itemsInCollections.push(item); + }); + }); + }); + return itemsInCollections.includes(url); + } + ); + export const makeSelectCollectionForIdHasClaimUrl = (id: string, url: string) => createSelector( makeSelectCollectionForId(id),