2016-06-10 00:16:01 -03:00
|
|
|
import auth from './auth';
|
|
|
|
import config from './config';
|
2016-10-10 15:34:21 -03:00
|
|
|
import integrations, * as fromIntegrations from './integrations';
|
2016-10-18 12:32:39 -02:00
|
|
|
import entries, * as fromEntries from './entries';
|
2018-06-11 19:03:43 -07:00
|
|
|
import cursors from './cursors';
|
2016-10-10 15:34:21 -03:00
|
|
|
import editorialWorkflow, * as fromEditorialWorkflow from './editorialWorkflow';
|
2016-06-10 00:16:01 -03:00
|
|
|
import entryDraft from './entryDraft';
|
|
|
|
import collections from './collections';
|
2016-12-07 15:44:07 -02:00
|
|
|
import search from './search';
|
2019-12-18 18:16:02 +02:00
|
|
|
import medias from './medias';
|
2017-08-14 09:00:47 -04:00
|
|
|
import mediaLibrary from './mediaLibrary';
|
2019-02-08 12:26:59 -05:00
|
|
|
import deploys, * as fromDeploys from './deploys';
|
2016-11-11 17:54:58 -02:00
|
|
|
import globalUI from './globalUI';
|
2019-12-18 18:16:02 +02:00
|
|
|
import { Status } from '../constants/publishModes';
|
|
|
|
import { State } from '../types/redux';
|
2016-06-10 00:16:01 -03:00
|
|
|
|
|
|
|
const reducers = {
|
|
|
|
auth,
|
|
|
|
config,
|
|
|
|
collections,
|
2016-12-07 15:44:07 -02:00
|
|
|
search,
|
2016-10-10 15:34:21 -03:00
|
|
|
integrations,
|
2016-06-10 00:16:01 -03:00
|
|
|
entries,
|
2018-06-11 19:03:43 -07:00
|
|
|
cursors,
|
2016-09-06 13:04:17 -03:00
|
|
|
editorialWorkflow,
|
2016-06-10 00:16:01 -03:00
|
|
|
entryDraft,
|
2016-10-18 12:32:39 -02:00
|
|
|
medias,
|
2019-12-18 18:16:02 +02:00
|
|
|
mediaLibrary,
|
2019-02-08 12:26:59 -05:00
|
|
|
deploys,
|
2016-11-11 17:54:58 -02:00
|
|
|
globalUI,
|
2016-06-10 00:16:01 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
export default reducers;
|
|
|
|
|
2016-09-06 13:04:17 -03:00
|
|
|
/*
|
|
|
|
* Selectors
|
|
|
|
*/
|
2019-12-18 18:16:02 +02:00
|
|
|
export const selectEntry = (state: State, collection: string, slug: string) =>
|
2016-06-10 00:16:01 -03:00
|
|
|
fromEntries.selectEntry(state.entries, collection, slug);
|
|
|
|
|
2019-12-18 18:16:02 +02:00
|
|
|
export const selectEntries = (state: State, collection: string) =>
|
2016-06-10 00:16:01 -03:00
|
|
|
fromEntries.selectEntries(state.entries, collection);
|
|
|
|
|
2019-12-18 18:16:02 +02:00
|
|
|
export const selectPublishedSlugs = (state: State, collection: string) =>
|
2019-04-10 21:38:53 +01:00
|
|
|
fromEntries.selectPublishedSlugs(state.entries, collection);
|
|
|
|
|
2019-12-18 18:16:02 +02:00
|
|
|
export const selectSearchedEntries = (state: State) => {
|
2016-12-07 15:44:07 -02:00
|
|
|
const searchItems = state.search.get('entryIds');
|
2018-08-07 14:46:54 -06:00
|
|
|
return (
|
|
|
|
searchItems &&
|
|
|
|
searchItems.map(({ collection, slug }) =>
|
|
|
|
fromEntries.selectEntry(state.entries, collection, slug),
|
|
|
|
)
|
|
|
|
);
|
2016-12-07 15:44:07 -02:00
|
|
|
};
|
2016-10-10 15:34:21 -03:00
|
|
|
|
2019-12-18 18:16:02 +02:00
|
|
|
export const selectDeployPreview = (state: State, collection: string, slug: string) =>
|
2019-02-08 12:26:59 -05:00
|
|
|
fromDeploys.selectDeployPreview(state.deploys, collection, slug);
|
|
|
|
|
2019-12-18 18:16:02 +02:00
|
|
|
export const selectUnpublishedEntry = (state: State, collection: string, slug: string) =>
|
2017-01-11 20:58:15 -02:00
|
|
|
fromEditorialWorkflow.selectUnpublishedEntry(state.editorialWorkflow, collection, slug);
|
2016-09-06 13:04:17 -03:00
|
|
|
|
2019-12-18 18:16:02 +02:00
|
|
|
export const selectUnpublishedEntriesByStatus = (state: State, status: Status) =>
|
2017-01-11 20:58:15 -02:00
|
|
|
fromEditorialWorkflow.selectUnpublishedEntriesByStatus(state.editorialWorkflow, status);
|
2016-09-06 13:04:17 -03:00
|
|
|
|
2019-12-18 18:16:02 +02:00
|
|
|
export const selectUnpublishedSlugs = (state: State, collection: string) =>
|
2019-04-10 21:38:53 +01:00
|
|
|
fromEditorialWorkflow.selectUnpublishedSlugs(state.editorialWorkflow, collection);
|
|
|
|
|
2019-12-18 18:16:02 +02:00
|
|
|
export const selectIntegration = (state: State, collection: string | null, hook: string) =>
|
2016-10-10 15:34:21 -03:00
|
|
|
fromIntegrations.selectIntegration(state.integrations, collection, hook);
|