add generic metadata selector

This commit is contained in:
Sean Yesmunt 2019-05-06 13:57:07 -04:00
parent 26d68d8259
commit 459bea2257
3 changed files with 16 additions and 2 deletions

5
dist/bundle.es.js vendored
View file

@ -1231,6 +1231,10 @@ const makeSelectMetadataForUri = uri => reselect.createSelector(makeSelectClaimF
return metadata || (claim === undefined ? undefined : null);
});
const makeSelectMetadataItemForUri = (uri, key) => reselect.createSelector(makeSelectMetadataForUri(uri), metadata => {
return metadata ? metadata[key] : undefined;
});
const makeSelectTitleForUri = uri => reselect.createSelector(makeSelectMetadataForUri(uri), metadata => metadata && metadata.title);
const makeSelectContentTypeForUri = uri => reselect.createSelector(makeSelectClaimForUri(uri), claim => {
@ -3496,6 +3500,7 @@ exports.makeSelectFirstRecommendedFileForUri = makeSelectFirstRecommendedFileFor
exports.makeSelectIsUriResolving = makeSelectIsUriResolving;
exports.makeSelectLoadingForUri = makeSelectLoadingForUri;
exports.makeSelectMetadataForUri = makeSelectMetadataForUri;
exports.makeSelectMetadataItemForUri = makeSelectMetadataItemForUri;
exports.makeSelectNsfwCountForChannel = makeSelectNsfwCountForChannel;
exports.makeSelectNsfwCountFromUris = makeSelectNsfwCountFromUris;
exports.makeSelectPendingByUri = makeSelectPendingByUri;

View file

@ -110,6 +110,9 @@ export {
makeSelectFetchingChannelClaims,
makeSelectClaimsInChannelForPage,
makeSelectMetadataForUri,
makeSelectMetadataItemForUri,
makeSelectThumbnailForUri,
makeSelectCoverForUri,
makeSelectTitleForUri,
makeSelectContentTypeForUri,
makeSelectIsUriResolving,
@ -144,8 +147,6 @@ export {
selectPlayingUri,
selectChannelClaimCounts,
selectCurrentChannelPage,
makeSelectThumbnailForUri,
makeSelectCoverForUri,
} from 'redux/selectors/claims';
export {

View file

@ -172,6 +172,14 @@ export const makeSelectMetadataForUri = (uri: string) =>
}
);
export const makeSelectMetadataItemForUri = (uri: string, key: string) =>
createSelector(
makeSelectMetadataForUri(uri),
(metadata: ChannelMetadata | StreamMetadata) => {
return metadata ? metadata[key] : undefined;
}
);
export const makeSelectTitleForUri = (uri: string) =>
createSelector(
makeSelectMetadataForUri(uri),