-
Notifications
You must be signed in to change notification settings - Fork 4k
/
index.js
56 lines (51 loc) · 1.35 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* WordPress dependencies
*/
import { useSelect } from '@wordpress/data';
import { store as interfaceStore } from '@wordpress/interface';
import { store as coreStore } from '@wordpress/core-data';
/**
* Internal dependencies
*/
import { store as editSiteStore } from '../../store';
import { useLocation } from '../routes';
import Editor from '../editor';
import List from '../list';
import getIsListPage from '../../utils/get-is-list-page';
export default function EditSiteApp( { reboot } ) {
const { params } = useLocation();
const {
isInserterOpen,
isListViewOpen,
sidebarIsOpened,
postType,
} = useSelect(
( select ) => {
const { isInserterOpened, isListViewOpened } = select(
editSiteStore
);
// The currently selected entity to display. Typically template or template part.
return {
isInserterOpen: isInserterOpened(),
isListViewOpen: isListViewOpened(),
sidebarIsOpened: !! select(
interfaceStore
).getActiveComplementaryArea( editSiteStore.name ),
postType: select( coreStore ).getPostType( params.postType ),
};
},
[ params.postType ]
);
const isListPage = getIsListPage( params );
return isListPage
? List.renderLayout( {
postType,
activeTemplateType: params.postType,
} )
: Editor.renderLayout( {
isInserterOpen,
isListViewOpen,
sidebarIsOpened,
reboot,
} );
}