2017-04-23 16:56:50 +07:00
|
|
|
import { createSelector } from 'reselect'
|
|
|
|
import {
|
|
|
|
selectDaemonReady,
|
|
|
|
selectCurrentPage,
|
2017-04-24 14:25:27 +07:00
|
|
|
selectCurrentUri,
|
2017-04-23 16:56:50 +07:00
|
|
|
} from 'selectors/app'
|
|
|
|
|
|
|
|
export const _selectState = state => state.content || {}
|
|
|
|
|
2017-05-03 23:44:08 -04:00
|
|
|
export const selectFeaturedUris = createSelector(
|
2017-04-23 16:56:50 +07:00
|
|
|
_selectState,
|
2017-05-10 20:59:47 -04:00
|
|
|
(state) => state.featuredUris
|
2017-04-23 16:56:50 +07:00
|
|
|
)
|
|
|
|
|
2017-05-03 23:44:08 -04:00
|
|
|
export const selectFetchingFeaturedUris = createSelector(
|
2017-04-23 16:56:50 +07:00
|
|
|
_selectState,
|
|
|
|
(state) => !!state.fetchingFeaturedContent
|
|
|
|
)
|
|
|
|
|
2017-04-24 14:25:27 +07:00
|
|
|
export const selectFetchingFileInfos = createSelector(
|
|
|
|
_selectState,
|
|
|
|
(state) => state.fetchingFileInfos || {}
|
|
|
|
)
|
|
|
|
|
2017-04-23 23:10:45 +07:00
|
|
|
export const selectFetchingDownloadedContent = createSelector(
|
|
|
|
_selectState,
|
|
|
|
(state) => !!state.fetchingDownloadedContent
|
|
|
|
)
|
|
|
|
|
|
|
|
export const selectDownloadedContent = createSelector(
|
|
|
|
_selectState,
|
|
|
|
(state) => state.downloadedContent || {}
|
|
|
|
)
|
|
|
|
|
2017-04-25 12:47:21 +07:00
|
|
|
export const selectDownloadedContentFileInfos = createSelector(
|
|
|
|
selectDownloadedContent,
|
|
|
|
(downloadedContent) => downloadedContent.fileInfos || []
|
|
|
|
)
|
|
|
|
|
2017-04-23 23:10:45 +07:00
|
|
|
export const selectFetchingPublishedContent = createSelector(
|
|
|
|
_selectState,
|
|
|
|
(state) => !!state.fetchingPublishedContent
|
|
|
|
)
|
|
|
|
|
|
|
|
export const selectPublishedContent = createSelector(
|
|
|
|
_selectState,
|
|
|
|
(state) => state.publishedContent || {}
|
|
|
|
)
|
|
|
|
|
2017-05-02 11:48:16 +07:00
|
|
|
|
|
|
|
export const selectResolvingUris = createSelector(
|
|
|
|
_selectState,
|
|
|
|
(state) => state.resolvingUris || []
|
|
|
|
)
|
|
|
|
|
|
|
|
const selectResolvingUri = (state, props) => {
|
|
|
|
return selectResolvingUris(state).indexOf(props.uri) != -1
|
|
|
|
}
|
|
|
|
|
|
|
|
export const makeSelectResolvingUri = () => {
|
|
|
|
return createSelector(
|
|
|
|
selectResolvingUri,
|
|
|
|
(resolving) => resolving
|
|
|
|
)
|
|
|
|
}
|