From fd5f025c6b162529e9eb82af3c8c673f5be9c62d Mon Sep 17 00:00:00 2001
From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com>
Date: Fri, 2 Jun 2023 16:30:13 +1000
Subject: [PATCH] Remove new template part screen as it was covered by pattern
screen
---
.../index.js | 6 +-
.../index.js | 103 ------------------
.../edit-site/src/components/sidebar/index.js | 4 -
3 files changed, 3 insertions(+), 110 deletions(-)
delete mode 100644 packages/edit-site/src/components/sidebar-navigation-screen-template-part/index.js
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-pattern/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-pattern/index.js
index fbaf69eb42186c..fc733387d4c3ad 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen-pattern/index.js
+++ b/packages/edit-site/src/components/sidebar-navigation-screen-pattern/index.js
@@ -37,8 +37,8 @@ function usePatternTitleAndDescription( postType, postId ) {
if ( ! descriptionText && addedBy.text ) {
descriptionText = sprintf(
- // translators: %s: template part title e.g: "Header".
- __( 'This is your %s template part.' ),
+ // translators: %s: pattern title e.g: "Header".
+ __( 'This is your %s pattern.' ),
getTitle()
);
}
@@ -67,7 +67,7 @@ function usePatternTitleAndDescription( postType, postId ) {
{ addedBy.isCustomized && (
- { _x( '(Customized)', 'template part' ) }
+ { _x( '(Customized)', 'pattern' ) }
) }
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-template-part/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-template-part/index.js
deleted file mode 100644
index 1823b97594f522..00000000000000
--- a/packages/edit-site/src/components/sidebar-navigation-screen-template-part/index.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { __, sprintf, _x } from '@wordpress/i18n';
-import { useDispatch, useSelect } from '@wordpress/data';
-import { pencil } from '@wordpress/icons';
-import {
- __experimentalUseNavigator as useNavigator,
- Icon,
-} from '@wordpress/components';
-import { store as coreStore } from '@wordpress/core-data';
-
-/**
- * Internal dependencies
- */
-import SidebarNavigationScreen from '../sidebar-navigation-screen';
-import useEditedEntityRecord from '../use-edited-entity-record';
-import { unlock } from '../../private-apis';
-import { store as editSiteStore } from '../../store';
-import SidebarButton from '../sidebar-button';
-import { useAddedBy } from '../list/added-by';
-
-function useTemplateTitleAndDescription( postType, postId ) {
- const { getDescription, getTitle, record } = useEditedEntityRecord(
- postType,
- postId
- );
- const currentTheme = useSelect(
- ( select ) => select( coreStore ).getCurrentTheme(),
- []
- );
- const addedBy = useAddedBy( postType, postId );
- const isAddedByActiveTheme =
- addedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;
- const title = getTitle();
- let descriptionText = getDescription();
-
- if ( ! descriptionText && addedBy.text ) {
- descriptionText = sprintf(
- // translators: %s: template part title e.g: "Header".
- __( 'This is your %s template part.' ),
- getTitle()
- );
- }
-
- const description = (
- <>
- { descriptionText }
-
- { addedBy.text && ! isAddedByActiveTheme && (
-
-
-
- { addedBy.imageUrl ? (
-
- ) : (
-
- ) }
-
- { addedBy.text }
-
-
- { addedBy.isCustomized && (
-
- { _x( '(Customized)', 'template part' ) }
-
- ) }
-
- ) }
- >
- );
-
- return { title, description };
-}
-
-export default function SidebarNavigationScreenTemplatePart() {
- const { params } = useNavigator();
- const { postType, postId } = params;
- const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
- const { title, description } = useTemplateTitleAndDescription(
- postType,
- postId
- );
-
- return (
- setCanvasMode( 'edit' ) }
- label={ __( 'Edit' ) }
- icon={ pencil }
- />
- }
- description={ description }
- />
- );
-}
diff --git a/packages/edit-site/src/components/sidebar/index.js b/packages/edit-site/src/components/sidebar/index.js
index 0f1ebf2aadea6f..c30905b8bd2047 100644
--- a/packages/edit-site/src/components/sidebar/index.js
+++ b/packages/edit-site/src/components/sidebar/index.js
@@ -15,7 +15,6 @@ import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
import SidebarNavigationScreenLibrary from '../sidebar-navigation-screen-library';
import SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';
import SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';
-import SidebarNavigationScreenTemplatePart from '../sidebar-navigation-screen-template-part';
import SidebarNavigationScreenPattern from '../sidebar-navigation-screen-pattern';
import useSyncPathWithURL, {
getPathFromURL,
@@ -69,9 +68,6 @@ function SidebarScreens() {
-
-
-
>
);
}