2017-06-06 23:19:12 +02:00
|
|
|
import { createSelector } from "reselect";
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
export const _selectState = state => state.content || {};
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2017-05-04 05:44:08 +02:00
|
|
|
export const selectFeaturedUris = createSelector(
|
2017-04-23 11:56:50 +02:00
|
|
|
_selectState,
|
2017-06-06 23:19:12 +02:00
|
|
|
state => state.featuredUris
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2017-05-04 05:44:08 +02:00
|
|
|
export const selectFetchingFeaturedUris = createSelector(
|
2017-04-23 11:56:50 +02: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-05-15 18:34:33 +02:00
|
|
|
export const selectResolvingUris = createSelector(
|
2017-05-02 06:48:16 +02:00
|
|
|
_selectState,
|
2017-06-06 23:19:12 +02:00
|
|
|
state => state.resolvingUris || []
|
2017-06-06 06:21:55 +02:00
|
|
|
);
|
2017-05-02 06:48:16 +02:00
|
|
|
|
|
|
|
const selectResolvingUri = (state, props) => {
|
2017-06-06 23:19:12 +02:00
|
|
|
return selectResolvingUris(state).indexOf(props.uri) != -1;
|
2017-06-06 06:21:55 +02:00
|
|
|
};
|
2017-05-02 06:48:16 +02:00
|
|
|
|
2017-05-15 05:50:59 +02:00
|
|
|
export const makeSelectIsResolvingForUri = () => {
|
2017-06-06 23:19:12 +02:00
|
|
|
return createSelector(selectResolvingUri, resolving => resolving);
|
2017-06-06 06:21:55 +02:00
|
|
|
};
|
2017-07-17 08:06:04 +02:00
|
|
|
|
|
|
|
export const selectChannelPages = createSelector(
|
|
|
|
_selectState,
|
|
|
|
state => state.channelPages || {}
|
|
|
|
);
|
|
|
|
|
|
|
|
const selectTotalPagesForChannel = (state, props) => {
|
|
|
|
return selectChannelPages(state)[props.uri];
|
|
|
|
};
|
|
|
|
|
|
|
|
export const makeSelectTotalPagesForChannel = () => {
|
|
|
|
return createSelector(selectTotalPagesForChannel, totalPages => totalPages);
|
|
|
|
};
|
2017-07-25 09:07:54 +02:00
|
|
|
|
2017-07-30 00:56:08 +02:00
|
|
|
export const selectRewardContentClaimIds = createSelector(
|
2017-07-25 09:07:54 +02:00
|
|
|
_selectState,
|
2017-07-30 00:56:08 +02:00
|
|
|
state => state.rewardedContentClaimIds
|
2017-07-25 09:07:54 +02:00
|
|
|
);
|