lbry-desktop/ui/js/selectors/content.js
2017-09-07 23:15:05 -04:00

39 lines
970 B
JavaScript

import { createSelector } from "reselect";
export const _selectState = state => state.content || {};
export const selectFeaturedUris = createSelector(
_selectState,
state => state.featuredUris
);
export const selectFetchingFeaturedUris = createSelector(
_selectState,
state => !!state.fetchingFeaturedContent
);
export const selectResolvingUris = createSelector(
_selectState,
state => state.resolvingUris || []
);
export const makeSelectIsUriResolving = uri => {
return createSelector(
selectResolvingUris,
resolvingUris => resolvingUris && resolvingUris.indexOf(uri) != -1
);
};
export const selectChannelPages = createSelector(
_selectState,
state => state.channelPages || {}
);
export const makeSelectTotalPagesForChannel = uri => {
return createSelector(selectChannelPages, byUri => byUri && byUri[uri]);
};
export const selectRewardContentClaimIds = createSelector(
_selectState,
state => state.rewardedContentClaimIds
);