Skip to content

Commit

Permalink
Site Editor: Fix the templates route on mobile (#67547)
Browse files Browse the repository at this point in the history
Co-authored-by: ramonjd <[email protected]>
Co-authored-by: tellthemachines <[email protected]>
  • Loading branch information
3 people authored Dec 4, 2024
1 parent fa636dc commit d017783
Showing 1 changed file with 1 addition and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
/**
* WordPress dependencies
*/
import { privateApis as routerPrivateApis } from '@wordpress/router';

/**
* Internal dependencies
*/
import Editor from '../editor';
import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
import { unlock } from '../../lock-unlock';
import PageTemplates from '../page-templates';

const { useLocation } = unlock( routerPrivateApis );

function MobileTemplatesView() {
const { query = {} } = useLocation();
const { canvas = 'view' } = query;

return canvas === 'edit' ? (
<Editor />
) : (
<SidebarNavigationScreenTemplatesBrowse backPath="/" />
);
}

export const templatesRoute = {
name: 'templates',
path: '/template',
Expand All @@ -34,7 +15,7 @@ export const templatesRoute = {
const isListView = query.layout === 'list';
return isListView ? <Editor /> : undefined;
},
mobile: <MobileTemplatesView />,
mobile: <PageTemplates />,
},
widths: {
content( { query } ) {
Expand Down

1 comment on commit d017783

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in d017783.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12152315176
📝 Reported issues:

Please sign in to comment.