diff --git a/packages/edit-site/src/components/site-editor-routes/patterns.js b/packages/edit-site/src/components/site-editor-routes/patterns.js index db97c4b5c080fd..fa60aaf7eb268e 100644 --- a/packages/edit-site/src/components/site-editor-routes/patterns.js +++ b/packages/edit-site/src/components/site-editor-routes/patterns.js @@ -1,15 +1,42 @@ +/** + * WordPress dependencies + */ +import { privateApis as routerPrivateApis } from '@wordpress/router'; + /** * Internal dependencies */ +import Editor from '../editor'; +import { unlock } from '../../lock-unlock'; import SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns'; import PagePatterns from '../page-patterns'; +const { useLocation } = unlock( routerPrivateApis ); + +function MobilePatternsView() { + const { query = {} } = useLocation(); + const { canvas = 'view', postType, categoryId } = query; + + if ( canvas === 'edit' ) { + return ; + } + + if ( + ( postType === 'wp_block' || postType === 'wp_template_part' ) && + !! categoryId + ) { + return ; + } + + return ; +} + export const patternsRoute = { name: 'patterns', path: '/pattern', areas: { sidebar: , content: , - mobile: , + mobile: , }, };