Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Oct 15, 2024
1 parent 3ae6f53 commit 8f312a8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/edit-site/src/components/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { unlock } from '../../lock-unlock';
import { useCommonCommands } from '../../hooks/commands/use-common-commands';
import { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';
import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
import useLayoutAreas from '../layout/router';
import useActiveRoute from '../layout/router';
import useSetCommandContext from '../../hooks/commands/use-set-command-context';
import { useRegisterSiteEditorRoutes } from '../site-editor-routes';

Expand All @@ -34,7 +34,7 @@ function AppLayout() {
useCommonCommands();
useSetCommandContext();
useRegisterSiteEditorRoutes();
const route = useLayoutAreas();
const route = useActiveRoute();

return <Layout route={ route } />;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/layout/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default function useActiveRoute() {
}

return {
key: matchedRoute.name,
name: matchedRoute.name,
areas: matchedRoute.areas,
widths: matchedRoute.widths,
};
Expand Down
4 changes: 2 additions & 2 deletions packages/edit-site/src/components/posts-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
*/
import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
import Layout from '../layout';
import useLayoutAreas from './router';
import useActiveRoute from './router';
import { unlock } from '../../lock-unlock';

const { RouterProvider } = unlock( routerPrivateApis );
Expand All @@ -21,7 +21,7 @@ const { GlobalStylesProvider } = unlock( editorPrivateApis );
function PostsLayout() {
// This ensures the edited entity id and type are initialized properly.
useInitEditedEntityFromURL();
const route = useLayoutAreas();
const route = useActiveRoute();
return <Layout route={ route } />;
}

Expand Down
6 changes: 3 additions & 3 deletions packages/edit-site/src/components/posts-app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import PostList from '../post-list';

const { useLocation } = unlock( routerPrivateApis );

export default function useLayoutAreas() {
export default function useActiveRoute() {
const { params = {} } = useLocation();
const { postType, layout, canvas } = params;
const labels = useSelect(
Expand All @@ -31,7 +31,7 @@ export default function useLayoutAreas() {
if ( [ 'post' ].includes( postType ) ) {
const isListLayout = layout === 'list' || ! layout;
return {
key: 'posts-list',
name: 'posts-list',
areas: {
sidebar: (
<SidebarNavigationScreen
Expand Down Expand Up @@ -59,7 +59,7 @@ export default function useLayoutAreas() {

// Fallback shows the home page preview
return {
key: 'default',
name: 'default',
areas: {
sidebar: <SidebarNavigationScreenMain />,
preview: <Editor isPostsList />,
Expand Down

0 comments on commit 8f312a8

Please sign in to comment.