add makeSelectTagInClaimOrChannelForUri
This commit is contained in:
parent
3cb3859baf
commit
1fc5afa0c4
3 changed files with 35 additions and 4 deletions
7
dist/bundle.es.js
vendored
7
dist/bundle.es.js
vendored
|
@ -2575,6 +2575,12 @@ const makeSelectMyStreamUrlsForPage = (page = 1) => reselect.createSelector(sele
|
||||||
|
|
||||||
const selectMyStreamUrlsCount = reselect.createSelector(selectMyClaimUrisWithoutChannels, channels => channels.length);
|
const selectMyStreamUrlsCount = reselect.createSelector(selectMyClaimUrisWithoutChannels, channels => channels.length);
|
||||||
|
|
||||||
|
const makeSelectTagInClaimOrChannelForUri = (uri, tag) => reselect.createSelector(makeSelectClaimForUri(uri), claim => {
|
||||||
|
const claimTags = claim && claim.value && claim.value.tags || [];
|
||||||
|
const channelTags = claim && claim.signing_channel && claim.signing_channel.value && claim.signing_channel.value.tags || [];
|
||||||
|
return claimTags.includes(tag) || channelTags.includes(tag);
|
||||||
|
});
|
||||||
|
|
||||||
function numberWithCommas(x) {
|
function numberWithCommas(x) {
|
||||||
var parts = x.toString().split('.');
|
var parts = x.toString().split('.');
|
||||||
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||||
|
@ -6319,6 +6325,7 @@ exports.makeSelectSearchDownloadUrlsForPage = makeSelectSearchDownloadUrlsForPag
|
||||||
exports.makeSelectShortUrlForUri = makeSelectShortUrlForUri;
|
exports.makeSelectShortUrlForUri = makeSelectShortUrlForUri;
|
||||||
exports.makeSelectStreamingUrlForUri = makeSelectStreamingUrlForUri;
|
exports.makeSelectStreamingUrlForUri = makeSelectStreamingUrlForUri;
|
||||||
exports.makeSelectSupportsForUri = makeSelectSupportsForUri;
|
exports.makeSelectSupportsForUri = makeSelectSupportsForUri;
|
||||||
|
exports.makeSelectTagInClaimOrChannelForUri = makeSelectTagInClaimOrChannelForUri;
|
||||||
exports.makeSelectTagsForUri = makeSelectTagsForUri;
|
exports.makeSelectTagsForUri = makeSelectTagsForUri;
|
||||||
exports.makeSelectThumbnailForUri = makeSelectThumbnailForUri;
|
exports.makeSelectThumbnailForUri = makeSelectThumbnailForUri;
|
||||||
exports.makeSelectTitleForUri = makeSelectTitleForUri;
|
exports.makeSelectTitleForUri = makeSelectTitleForUri;
|
||||||
|
|
|
@ -161,6 +161,7 @@ export {
|
||||||
makeSelectDateForUri,
|
makeSelectDateForUri,
|
||||||
makeSelectAmountForUri,
|
makeSelectAmountForUri,
|
||||||
makeSelectTagsForUri,
|
makeSelectTagsForUri,
|
||||||
|
makeSelectTagInClaimOrChannelForUri,
|
||||||
makeSelectContentTypeForUri,
|
makeSelectContentTypeForUri,
|
||||||
makeSelectIsUriResolving,
|
makeSelectIsUriResolving,
|
||||||
makeSelectTotalItemsForChannel,
|
makeSelectTotalItemsForChannel,
|
||||||
|
|
|
@ -258,8 +258,8 @@ export const makeSelectMyPurchasesForPage = (query: ?string, page: number = 1) =
|
||||||
const end = Number(page) * Number(PAGE_SIZE);
|
const end = Number(page) * Number(PAGE_SIZE);
|
||||||
return matchingFileInfos && matchingFileInfos.length
|
return matchingFileInfos && matchingFileInfos.length
|
||||||
? matchingFileInfos
|
? matchingFileInfos
|
||||||
.slice(start, end)
|
.slice(start, end)
|
||||||
.map(fileInfo => fileInfo.canonical_url || fileInfo.permanent_url)
|
.map(fileInfo => fileInfo.canonical_url || fileInfo.permanent_url)
|
||||||
: [];
|
: [];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -365,8 +365,8 @@ export const makeSelectDateForUri = (uri: string) =>
|
||||||
(claim.value.release_time
|
(claim.value.release_time
|
||||||
? claim.value.release_time * 1000
|
? claim.value.release_time * 1000
|
||||||
: claim.meta && claim.meta.creation_timestamp
|
: claim.meta && claim.meta.creation_timestamp
|
||||||
? claim.meta.creation_timestamp * 1000
|
? claim.meta.creation_timestamp * 1000
|
||||||
: null);
|
: null);
|
||||||
if (!timestamp) {
|
if (!timestamp) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -680,6 +680,14 @@ export const makeSelectTagsForUri = (uri: string) =>
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const makeSelectChannelTagsForUri = (uri: string) =>
|
||||||
|
createSelector(
|
||||||
|
makeSelectMetadataForUri(uri),
|
||||||
|
(metadata: ?GenericMetadata) => {
|
||||||
|
return (metadata && metadata.tags) || [];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export const selectFetchingClaimSearchByQuery = createSelector(
|
export const selectFetchingClaimSearchByQuery = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
state => state.fetchingClaimSearchByQuery || {}
|
state => state.fetchingClaimSearchByQuery || {}
|
||||||
|
@ -775,3 +783,18 @@ export const selectMyStreamUrlsCount = createSelector(
|
||||||
selectMyClaimUrisWithoutChannels,
|
selectMyClaimUrisWithoutChannels,
|
||||||
channels => channels.length
|
channels => channels.length
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const makeSelectTagInClaimOrChannelForUri = (uri: string, tag: string) =>
|
||||||
|
createSelector(
|
||||||
|
makeSelectClaimForUri(uri),
|
||||||
|
claim => {
|
||||||
|
const claimTags = (claim && claim.value && claim.value.tags) || [];
|
||||||
|
const channelTags =
|
||||||
|
(claim &&
|
||||||
|
claim.signing_channel &&
|
||||||
|
claim.signing_channel.value &&
|
||||||
|
claim.signing_channel.value.tags) ||
|
||||||
|
[];
|
||||||
|
return claimTags.includes(tag) || channelTags.includes(tag);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
Loading…
Reference in a new issue