Merge pull request #140 from lbryio/flow

add generic metadata selector
This commit is contained in:
Sean Yesmunt 2019-05-07 15:17:11 -04:00 committed by GitHub
commit 32916b04e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

5
dist/bundle.es.js vendored
View file

@ -1229,6 +1229,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 makeSelectDateForUri = uri => reselect.createSelector(makeSelectClaimForUri(uri), claim => {
@ -3463,6 +3467,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

@ -109,6 +109,9 @@ export {
makeSelectFetchingChannelClaims,
makeSelectClaimsInChannelForPage,
makeSelectMetadataForUri,
makeSelectMetadataItemForUri,
makeSelectThumbnailForUri,
makeSelectCoverForUri,
makeSelectTitleForUri,
makeSelectDateForUri,
makeSelectContentTypeForUri,
@ -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),