2017-12-21 18:32:51 +01:00
|
|
|
import { createSelector } from 'reselect';
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2017-12-21 18:32:51 +01:00
|
|
|
export const selectState = state => state.content || {};
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2017-12-21 18:32:51 +01:00
|
|
|
export const selectFeaturedUris = createSelector(selectState, state => state.featuredUris);
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2017-05-04 05:44:08 +02:00
|
|
|
export const selectFetchingFeaturedUris = createSelector(
|
2017-12-21 18:32:51 +01:00
|
|
|
selectState,
|
2017-06-06 23:19:12 +02:00
|
|
|
state => !!state.fetchingFeaturedContent
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2017-12-21 18:32:51 +01:00
|
|
|
export const selectResolvingUris = createSelector(selectState, state => state.resolvingUris || []);
|
2017-05-02 06:48:16 +02:00
|
|
|
|
2017-12-21 18:32:51 +01:00
|
|
|
export const selectPlayingUri = createSelector(selectState, state => state.playingUri);
|
2017-09-18 04:08:43 +02:00
|
|
|
|
2017-12-13 22:36:30 +01:00
|
|
|
export const makeSelectIsUriResolving = uri =>
|
|
|
|
createSelector(
|
2017-09-08 05:15:05 +02:00
|
|
|
selectResolvingUris,
|
2017-12-21 18:32:51 +01:00
|
|
|
resolvingUris => resolvingUris && resolvingUris.indexOf(uri) !== -1
|
2017-09-08 05:15:05 +02:00
|
|
|
);
|
2017-07-17 08:06:04 +02:00
|
|
|
|
2017-10-12 15:37:24 +02:00
|
|
|
export const selectChannelClaimCounts = createSelector(
|
2017-12-21 18:32:51 +01:00
|
|
|
selectState,
|
2017-10-12 15:37:24 +02:00
|
|
|
state => state.channelClaimCounts || {}
|
2017-07-17 08:06:04 +02:00
|
|
|
);
|
|
|
|
|
2017-12-13 22:36:30 +01:00
|
|
|
export const makeSelectTotalItemsForChannel = uri =>
|
|
|
|
createSelector(selectChannelClaimCounts, byUri => byUri && byUri[uri]);
|
2017-10-10 01:19:50 +02:00
|
|
|
|
2017-12-13 22:36:30 +01:00
|
|
|
export const makeSelectTotalPagesForChannel = uri =>
|
|
|
|
createSelector(
|
2017-10-12 15:37:24 +02:00
|
|
|
selectChannelClaimCounts,
|
|
|
|
byUri => byUri && byUri[uri] && Math.ceil(byUri[uri] / 10)
|
|
|
|
);
|
2017-07-25 09:07:54 +02:00
|
|
|
|
2017-07-30 00:56:08 +02:00
|
|
|
export const selectRewardContentClaimIds = createSelector(
|
2017-12-21 18:32:51 +01:00
|
|
|
selectState,
|
2017-07-30 00:56:08 +02:00
|
|
|
state => state.rewardedContentClaimIds
|
2017-07-25 09:07:54 +02:00
|
|
|
);
|