Skip to content

Commit

Permalink
Site Editor: Remove unnecessary selector from 'PageTemplates' (#52903)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Jul 26, 2023
1 parent 56e9efc commit 06c704e
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions packages/edit-site/src/components/page-templates/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import {
__experimentalVStack as VStack,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { useSelect } from '@wordpress/data';
import { store as coreStore, useEntityRecords } from '@wordpress/core-data';
import { useEntityRecords } from '@wordpress/core-data';
import { decodeEntities } from '@wordpress/html-entities';

/**
Expand All @@ -21,7 +20,6 @@ import Link from '../routes/link';
import AddedBy from '../list/added-by';
import TemplateActions from '../template-actions';
import AddNewTemplate from '../add-new-template';
import { store as editSiteStore } from '../../store';

export default function PageTemplates() {
const { records: templates } = useEntityRecords(
Expand All @@ -32,15 +30,6 @@ export default function PageTemplates() {
}
);

const { canCreate } = useSelect( ( select ) => {
const { supportsTemplatePartsMode } =
select( editSiteStore ).getSettings();
return {
postType: select( coreStore ).getPostType( 'wp_template' ),
canCreate: ! supportsTemplatePartsMode,
};
} );

const columns = [
{
header: __( 'Template' ),
Expand Down Expand Up @@ -89,13 +78,11 @@ export default function PageTemplates() {
<Page
title={ __( 'Templates' ) }
actions={
canCreate && (
<AddNewTemplate
templateType={ 'wp_template' }
showIcon={ false }
toggleProps={ { variant: 'primary' } }
/>
)
<AddNewTemplate
templateType={ 'wp_template' }
showIcon={ false }
toggleProps={ { variant: 'primary' } }
/>
}
>
{ templates && <Table data={ templates } columns={ columns } /> }
Expand Down

0 comments on commit 06c704e

Please sign in to comment.