Skip to content

Commit

Permalink
Remove: Unused code from the navigation inspector select logic. (#48044)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta authored Feb 13, 2023
1 parent 1c087d4 commit f580ad6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
32 changes: 0 additions & 32 deletions packages/edit-site/src/components/navigation-inspector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
*/
import { useSelect } from '@wordpress/data';
import { useState, useEffect } from '@wordpress/element';
import { SelectControl } from '@wordpress/components';
import { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';
import {
store as blockEditorStore,
BlockEditorProvider,
} from '@wordpress/block-editor';
import { speak } from '@wordpress/a11y';
import { useInstanceId } from '@wordpress/compose';
import { __ } from '@wordpress/i18n';

/**
Expand Down Expand Up @@ -71,11 +69,6 @@ export default function NavigationInspector( { onSelect } ) {
};
}, [] );

const navMenuListId = useInstanceId(
NavigationMenu,
'edit-site-navigation-inspector-menu'
);

const firstNavRefInTemplate = clientIdToRef[ firstNavigationBlockId ];
const firstNavigationMenuRef = navigationMenus?.[ 0 ]?.id;

Expand All @@ -99,14 +92,6 @@ export default function NavigationInspector( { onSelect } ) {
}
}, [ selectedNavigationBlockId ] );

let options = [];
if ( navigationMenus ) {
options = navigationMenus.map( ( { id, title } ) => ( {
value: id,
label: title.rendered,
} ) );
}

const [ innerBlocks, onInput, onChange ] = useEntityBlockEditor(
'postType',
'wp_navigation',
Expand Down Expand Up @@ -137,8 +122,6 @@ export default function NavigationInspector( { onSelect } ) {

const isLoading = ! ( hasResolvedNavigationMenus && hasLoadedInnerBlocks );

const hasMoreThanOneNavigationMenu = navigationMenus?.length > 1;

const hasNavigationMenus = !! navigationMenus?.length;

// Entity block editor will return entities that are not currently published.
Expand Down Expand Up @@ -178,21 +161,6 @@ export default function NavigationInspector( { onSelect } ) {
{ ! hasResolvedNavigationMenus && (
<div className="edit-site-navigation-inspector__placeholder" />
) }
{ hasResolvedNavigationMenus && hasMoreThanOneNavigationMenu && (
<SelectControl
__nextHasNoMarginBottom
className="edit-site-navigation-inspector__select-menu"
aria-controls={
// aria-controls should only apply when referenced element is in DOM
hasLoadedInnerBlocks ? navMenuListId : undefined
}
value={ currentMenuId || defaultNavigationMenuId }
options={ options }
onChange={ ( newMenuId ) =>
setCurrentMenuId( Number( newMenuId ) )
}
/>
) }
{ isLoading && (
<>
<div className="edit-site-navigation-inspector__placeholder is-child" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
.edit-site-sidebar-navigation-screen-navigation-menus {
.block-editor-list-view-block__menu-edit,
.edit-site-navigation-inspector__select-menu {
display: none;
}
.offcanvas-editor-list-view-leaf {
max-width: calc(100% - #{ $grid-unit-05 });
}
Expand Down

1 comment on commit f580ad6

@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 f580ad6.
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/4167538702
📝 Reported issues:

Please sign in to comment.