Skip to content

Commit

Permalink
Use post type constants for patterns and parts
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Oct 17, 2023
1 parent fb1c039 commit c673833
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/edit-site/src/hooks/commands/use-edit-mode-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ import { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';
import { PATTERN_MODALS } from '../../components/pattern-modal';
import { TEMPLATE_PART_MODALS } from '../../components/template-part-modal';
import { unlock } from '../../lock-unlock';
import { TEMPLATE_POST_TYPE, TEMPLATE_ORIGINS } from '../../utils/constants';
import {
PATTERN_TYPES,
TEMPLATE_ORIGINS,
TEMPLATE_PART_POST_TYPE,
TEMPLATE_POST_TYPE,
} from '../../utils/constants';

const { useHistory } = unlock( routerPrivateApis );

Expand Down Expand Up @@ -372,7 +377,7 @@ function usePatternCommands() {

const commands = [];

if ( record?.type === 'wp_block' ) {
if ( record?.type === PATTERN_TYPES.user ) {
commands.push( {
name: 'core/rename-pattern',
label: __( 'Rename pattern' ),
Expand All @@ -393,7 +398,7 @@ function usePatternCommands() {
} );
}

if ( record?.type === 'wp_template_part' ) {
if ( record?.type === TEMPLATE_PART_POST_TYPE ) {
if ( record?.source === TEMPLATE_ORIGINS.custom ) {
commands.push( {
name: 'core/rename-template-part',
Expand Down

0 comments on commit c673833

Please sign in to comment.