@@ -31,7 +31,7 @@ export default function useLayoutAreas() {
31
31
const isSiteEditorLoading = useIsSiteEditorLoading ( ) ;
32
32
const history = useHistory ( ) ;
33
33
const { params } = useLocation ( ) ;
34
- const { postType, postId, path, layout, isCustom, canvas } = params ?? { } ;
34
+ const { postType, postId, path, layout, isCustom, canvas } = params ;
35
35
36
36
// Note: Since "sidebar" is not yet supported here,
37
37
// returning undefined from "mobile" means show the sidebar.
@@ -45,6 +45,7 @@ export default function useLayoutAreas() {
45
45
sidebar : (
46
46
< SidebarNavigationScreen
47
47
title = { __ ( 'Manage pages' ) }
48
+ backPath = { { } }
48
49
content = { < DataViewsSidebarContent /> }
49
50
/>
50
51
) ,
@@ -78,13 +79,33 @@ export default function useLayoutAreas() {
78
79
if ( postType && postId ) {
79
80
let sidebar ;
80
81
if ( postType === 'wp_template_part' || postType === 'wp_block' ) {
81
- sidebar = < SidebarNavigationScreenPattern /> ;
82
+ sidebar = (
83
+ < SidebarNavigationScreenPattern
84
+ backPath = { {
85
+ path : '/patterns' ,
86
+ categoryId : params . categoryId ,
87
+ categoryType : params . categoryType ,
88
+ } }
89
+ />
90
+ ) ;
82
91
} else if ( postType === 'wp_template' ) {
83
- sidebar = < SidebarNavigationScreenTemplate /> ;
92
+ sidebar = (
93
+ < SidebarNavigationScreenTemplate
94
+ backPath = { { path : '/wp_template' } }
95
+ />
96
+ ) ;
84
97
} else if ( postType === 'page' ) {
85
- sidebar = < SidebarNavigationScreenPage /> ;
98
+ sidebar = (
99
+ < SidebarNavigationScreenPage
100
+ backPath = { { path : '/page' , postId } }
101
+ />
102
+ ) ;
86
103
} else {
87
- sidebar = < SidebarNavigationScreenNavigationMenu /> ;
104
+ sidebar = (
105
+ < SidebarNavigationScreenNavigationMenu
106
+ backPath = { { path : '/navigation' } }
107
+ />
108
+ ) ;
88
109
}
89
110
return {
90
111
key : 'page' ,
@@ -104,7 +125,9 @@ export default function useLayoutAreas() {
104
125
return {
105
126
key : 'templates-list' ,
106
127
areas : {
107
- sidebar : < SidebarNavigationScreenTemplatesBrowse /> ,
128
+ sidebar : (
129
+ < SidebarNavigationScreenTemplatesBrowse backPath = { { } } />
130
+ ) ,
108
131
content : < PageTemplates /> ,
109
132
preview : isListLayout && (
110
133
< Editor isLoading = { isSiteEditorLoading } />
@@ -125,7 +148,7 @@ export default function useLayoutAreas() {
125
148
return {
126
149
key : 'patterns' ,
127
150
areas : {
128
- sidebar : < SidebarNavigationScreenPatterns /> ,
151
+ sidebar : < SidebarNavigationScreenPatterns backPath = { { } } /> ,
129
152
content : < PagePatterns /> ,
130
153
mobile : < PagePatterns /> ,
131
154
} ,
@@ -137,7 +160,9 @@ export default function useLayoutAreas() {
137
160
return {
138
161
key : 'styles' ,
139
162
areas : {
140
- sidebar : < SidebarNavigationScreenGlobalStyles /> ,
163
+ sidebar : (
164
+ < SidebarNavigationScreenGlobalStyles backPath = { { } } />
165
+ ) ,
141
166
preview : < Editor isLoading = { isSiteEditorLoading } /> ,
142
167
mobile : canvas === 'edit' && (
143
168
< Editor isLoading = { isSiteEditorLoading } />
@@ -152,7 +177,11 @@ export default function useLayoutAreas() {
152
177
return {
153
178
key : 'navigation' ,
154
179
areas : {
155
- sidebar : < SidebarNavigationScreenNavigationMenu /> ,
180
+ sidebar : (
181
+ < SidebarNavigationScreenNavigationMenu
182
+ backPath = { { path : '/navigation' } }
183
+ />
184
+ ) ,
156
185
preview : < Editor isLoading = { isSiteEditorLoading } /> ,
157
186
mobile : canvas === 'edit' && (
158
187
< Editor isLoading = { isSiteEditorLoading } />
@@ -163,7 +192,9 @@ export default function useLayoutAreas() {
163
192
return {
164
193
key : 'navigation' ,
165
194
areas : {
166
- sidebar : < SidebarNavigationScreenNavigationMenus /> ,
195
+ sidebar : (
196
+ < SidebarNavigationScreenNavigationMenus backPath = { { } } />
197
+ ) ,
167
198
preview : < Editor isLoading = { isSiteEditorLoading } /> ,
168
199
mobile : canvas === 'edit' && (
169
200
< Editor isLoading = { isSiteEditorLoading } />
0 commit comments