Skip to content

Commit

Permalink
Cleanup tech debt
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jeryj committed May 21, 2024
1 parent 9bd3182 commit 427f5e0
Showing 1 changed file with 3 additions and 33 deletions.
36 changes: 3 additions & 33 deletions packages/block-editor/src/components/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -233,18 +225,7 @@ function InserterMenu(
onInsert={ onInsertPattern }
onSelectCategory={ onClickPatternCategory }
selectedCategory={ selectedPatternCategory }
>
{ showPatternPanel && (
<PatternCategoryPreviewPanel
rootClientId={ destinationRootClientId }
onInsert={ onInsertPattern }
onHover={ onHoverPattern }
category={ selectedPatternCategory }
patternFilter={ patternFilter }
showTitlesAsTooltip
/>
) }
</BlockPatternsTab>
/>
);
}, [
destinationRootClientId,
Expand All @@ -253,7 +234,6 @@ function InserterMenu(
onClickPatternCategory,
patternFilter,
selectedPatternCategory,
showPatternPanel,
] );

const mediaTab = useMemo( () => {
Expand All @@ -263,22 +243,13 @@ function InserterMenu(
selectedCategory={ selectedMediaCategory }
onSelectCategory={ setSelectedMediaCategory }
onInsert={ onInsert }
>
{ showMediaPanel && (
<MediaCategoryPanel
rootClientId={ destinationRootClientId }
onInsert={ onInsert }
category={ selectedMediaCategory }
/>
) }
</MediaTab>
/>
);
}, [
destinationRootClientId,
onInsert,
selectedMediaCategory,
setSelectedMediaCategory,
showMediaPanel,
] );

const handleSetSelectedTab = ( value ) => {
Expand All @@ -304,7 +275,6 @@ function InserterMenu(
return (
<div
className={ clsx( 'block-editor-inserter__menu', {
'show-panel': showPatternPanel || showMediaPanel,
'is-zoom-out': isZoomOutMode,
} ) }
ref={ ref }
Expand Down

0 comments on commit 427f5e0

Please sign in to comment.