PromucFlow_constructor/app/client/src/selectors/appViewSelectors.tsx

38 lines
1.2 KiB
TypeScript
Raw Normal View History

import { createSelector } from "reselect";
2020-02-18 10:41:52 +00:00
import { AppState } from "reducers";
2019-11-25 05:07:27 +00:00
import { AppViewReduxState } from "reducers/uiReducers/appViewReducer";
import { PageListReduxState } from "reducers/entityReducers/pageListReducer";
const getAppViewState = (state: AppState) => state.ui.appView;
const getPageListState = (state: AppState): PageListReduxState =>
state.entities.pageList;
// For the viewer, this does not need to be wrapped in createCachedSelector, as it will not change in subsequent renders.
// export const getCurrentPageLayoutDSL = createSelector(
// getAppViewState,
// getDataTree,
// (view: AppViewReduxState, dataTree: DataTree) =>
// injectDataTreeIntoDsl(dataTree, view.dsl),
// );
export const getPageList = createSelector(
getPageListState,
(pageList: PageListReduxState) =>
pageList.pages.length > 0 ? pageList.pages : undefined,
);
2019-11-06 06:21:56 +00:00
export const getIsFetchingPage = createSelector(
getAppViewState,
(view: AppViewReduxState) => view.isFetchingPage,
);
2020-01-24 09:54:40 +00:00
export const getIsInitialized = createSelector(
getAppViewState,
(view: AppViewReduxState) => view.initialized,
);
2019-11-06 06:21:56 +00:00
export const getCurrentDSLPageId = createSelector(
getPageListState,
(pageList: PageListReduxState) => pageList.currentPageId,
2019-11-06 06:21:56 +00:00
);