From 427f5e07ef8f4c403f1d18fa0f9f2d63962109a2 Mon Sep 17 00:00:00 2001 From: Jerry Jones Date: Tue, 21 May 2024 14:44:42 -0500 Subject: [PATCH] Cleanup tech debt The showPattern and showMedia and related constants were not needed in menu.js. Also, they were using children to render inner content which has also been removed. --- .../src/components/inserter/menu.js | 36 ++----------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/packages/block-editor/src/components/inserter/menu.js b/packages/block-editor/src/components/inserter/menu.js index bda1584c22149..8a5e209c464bd 100644 --- a/packages/block-editor/src/components/inserter/menu.js +++ b/packages/block-editor/src/components/inserter/menu.js @@ -26,8 +26,7 @@ import Tips from './tips'; import InserterPreviewPanel from './preview-panel'; import BlockTypesTab from './block-types-tab'; import BlockPatternsTab from './block-patterns-tab'; -import { PatternCategoryPreviewPanel } from './block-patterns-tab/pattern-category-preview-panel'; -import { MediaTab, MediaCategoryPanel } from './media-tab'; +import { MediaTab } from './media-tab'; import InserterSearchResults from './search-results'; import useInsertionPoint from './hooks/use-insertion-point'; import InserterTabs from './tabs'; @@ -133,13 +132,6 @@ function InserterMenu( [ setSelectedPatternCategory, __experimentalOnPatternCategorySelection ] ); - const showPatternPanel = - selectedTab === 'patterns' && - ! delayedFilterValue && - !! selectedPatternCategory; - - const showMediaPanel = selectedTab === 'media' && !! selectedMediaCategory; - const inserterSearch = useMemo( () => { if ( selectedTab === 'media' ) { return null; @@ -233,18 +225,7 @@ function InserterMenu( onInsert={ onInsertPattern } onSelectCategory={ onClickPatternCategory } selectedCategory={ selectedPatternCategory } - > - { showPatternPanel && ( - - ) } - + /> ); }, [ destinationRootClientId, @@ -253,7 +234,6 @@ function InserterMenu( onClickPatternCategory, patternFilter, selectedPatternCategory, - showPatternPanel, ] ); const mediaTab = useMemo( () => { @@ -263,22 +243,13 @@ function InserterMenu( selectedCategory={ selectedMediaCategory } onSelectCategory={ setSelectedMediaCategory } onInsert={ onInsert } - > - { showMediaPanel && ( - - ) } - + /> ); }, [ destinationRootClientId, onInsert, selectedMediaCategory, setSelectedMediaCategory, - showMediaPanel, ] ); const handleSetSelectedTab = ( value ) => { @@ -304,7 +275,6 @@ function InserterMenu( return (