Rename Main container to App in CM

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2021-06-01 08:54:47 +02:00
parent db23b58329
commit 0225603efe
13 changed files with 32 additions and 32 deletions

View File

@ -43,7 +43,7 @@ const SettingsPage = lazy(() =>
// These are internal plugins
const CM = lazy(() =>
import(
/* webpackChunkName: "content-manager" */ '@strapi/plugin-content-manager/admin/src/pages/Main'
/* webpackChunkName: "content-manager" */ '@strapi/plugin-content-manager/admin/src/pages/App'
)
);
const CTB = lazy(() =>

View File

@ -3,7 +3,7 @@ import { useSelector, shallowEqual } from 'react-redux';
import { request } from '@strapi/helper-plugin';
import formatLayouts from './utils/formatLayouts';
import reducer, { initialState } from './reducer';
import { makeSelectModelAndComponentSchemas } from '../../pages/Main/selectors';
import { makeSelectModelAndComponentSchemas } from '../../pages/App/selectors';
const useFetchContentTypeLayout = contentTypeUID => {
const [{ error, isLoading, layout, layouts }, dispatch] = useReducer(reducer, initialState);

View File

@ -0,0 +1,3 @@
export const GET_DATA = 'ContentManager/App/GET_DATA';
export const GET_DATA_SUCCEEDED = 'ContentManager/App/GET_DATA_SUCCEEDED';
export const RESET_PROPS = 'ContentManager/App/RESET_PROPS';

View File

@ -20,7 +20,7 @@ import CollectionTypeRecursivePath from '../CollectionTypeRecursivePath';
import ComponentSettingsView from '../ComponentSetttingsView';
import SingleTypeRecursivePath from '../SingleTypeRecursivePath';
import { getData, getDataSucceeded, resetProps } from './actions';
import makeSelectMain from './selectors';
import makeSelectApp from './selectors';
function Main({ getData, getDataSucceeded, isLoading, resetProps }) {
const toggleNotification = useNotification();
@ -86,7 +86,7 @@ Main.propTypes = {
resetProps: PropTypes.func.isRequired,
};
const mapStateToProps = makeSelectMain();
const mapStateToProps = makeSelectApp();
export function mapDispatchToProps(dispatch) {
return bindActionCreators(

View File

@ -0,0 +1,20 @@
import { createSelector } from 'reselect';
import pluginId from '../../pluginId';
import { initialState } from './reducer';
const selectAppDomain = () => state => {
return state[`${pluginId}_app`] || initialState;
};
const makeSelectApp = () =>
createSelector(selectAppDomain(), substate => {
return substate;
});
const makeSelectModelAndComponentSchemas = () =>
createSelector(selectAppDomain(), ({ components, models }) => ({
schemas: [...components, ...models],
}));
export default makeSelectApp;
export { makeSelectModelAndComponentSchemas, selectAppDomain };

View File

@ -2,7 +2,7 @@ import produce from 'immer';
import { getData, getDataSucceeded, resetProps } from '../actions';
import mainReducer from '../reducer';
describe('Content Manager | Main | reducer', () => {
describe('Content Manager | App | reducer', () => {
let state;
beforeEach(() => {

View File

@ -3,7 +3,7 @@ import { useParams } from 'react-router-dom';
import { CheckPagePermissions, LoadingIndicatorPage, request } from '@strapi/helper-plugin';
import { useSelector, shallowEqual } from 'react-redux';
import { getRequestUrl, mergeMetasWithSchema } from '../../utils';
import { makeSelectModelAndComponentSchemas } from '../Main/selectors';
import { makeSelectModelAndComponentSchemas } from '../App/selectors';
import pluginPermissions from '../../permissions';
import crudReducer, { crudInitialState } from '../../sharedReducers/crudReducer/reducer';
import { getData, getDataSucceeded } from '../../sharedReducers/crudReducer/actions';

View File

@ -14,7 +14,7 @@ import LayoutTitle from '../../components/LayoutTitle';
import PopupForm from '../../components/PopupForm';
import SettingsViewWrapper from '../../components/SettingsViewWrapper';
import SortableList from '../../components/SortableList';
import { makeSelectModelAndComponentSchemas } from '../Main/selectors';
import { makeSelectModelAndComponentSchemas } from '../App/selectors';
import LayoutDndProvider from '../../components/LayoutDndProvider';
import init from './init';
import reducer, { initialState } from './reducer';

View File

@ -1,3 +0,0 @@
export const GET_DATA = 'ContentManager/Main/GET_DATA';
export const GET_DATA_SUCCEEDED = 'ContentManager/Main/GET_DATA_SUCCEEDED';
export const RESET_PROPS = 'ContentManager/Main/RESET_PROPS';

View File

@ -1,20 +0,0 @@
import { createSelector } from 'reselect';
import pluginId from '../../pluginId';
import { initialState } from './reducer';
const selectMainDomain = () => state => {
return state[`${pluginId}_main`] || initialState;
};
const makeSelectMain = () =>
createSelector(selectMainDomain(), substate => {
return substate;
});
const makeSelectModelAndComponentSchemas = () =>
createSelector(selectMainDomain(), ({ components, models }) => ({
schemas: [...components, ...models],
}));
export default makeSelectMain;
export { makeSelectModelAndComponentSchemas, selectMainDomain };

View File

@ -1,4 +1,4 @@
import mainReducer from './pages/Main/reducer';
import appReducer from './pages/App/reducer';
import editViewLayoutManagerReducer from './pages/EditViewLayoutManager/reducer';
import listViewReducer from './pages/ListView/reducer';
import rbacManagerReducer from './hooks/useSyncRbac/reducer';
@ -6,7 +6,7 @@ import editViewCrudReducer from './sharedReducers/crudReducer/reducer';
import pluginId from './pluginId';
const reducers = {
[`${pluginId}_main`]: mainReducer,
[`${pluginId}_app`]: appReducer,
[`${pluginId}_listView`]: listViewReducer,
[`${pluginId}_rbacManager`]: rbacManagerReducer,
[`${pluginId}_editViewLayoutManager`]: editViewLayoutManagerReducer,