From b3990a71195b6f26d5a01bb1500cd214b4d30e5e Mon Sep 17 00:00:00 2001 From: scruffian Date: Wed, 11 Oct 2023 13:33:18 +0100 Subject: [PATCH] remove unused file --- .../template-panel/replace-template-button.js | 89 ------------------- 1 file changed, 89 deletions(-) delete mode 100644 packages/edit-site/src/components/sidebar-edit-mode/template-panel/replace-template-button.js diff --git a/packages/edit-site/src/components/sidebar-edit-mode/template-panel/replace-template-button.js b/packages/edit-site/src/components/sidebar-edit-mode/template-panel/replace-template-button.js deleted file mode 100644 index 658aacd331debc..00000000000000 --- a/packages/edit-site/src/components/sidebar-edit-mode/template-panel/replace-template-button.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * WordPress dependencies - */ -import { useSelect, useDispatch } from '@wordpress/data'; -import { useState } from '@wordpress/element'; -import { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor'; -import { MenuItem, Modal } from '@wordpress/components'; -import { __ } from '@wordpress/i18n'; -import { store as coreStore } from '@wordpress/core-data'; -import { useAsyncList } from '@wordpress/compose'; -import { serialize } from '@wordpress/blocks'; - -/** - * Internal dependencies - */ -import { store as editSiteStore } from '../../../store'; - -export default function ReplaceTemplateButton( { - onClick, - availableTemplates, -} ) { - const { editEntityRecord } = useDispatch( coreStore ); - const [ showModal, setShowModal ] = useState( false ); - const onClose = () => { - setShowModal( false ); - }; - - const { postId, postType } = useSelect( ( select ) => { - return { - postId: select( editSiteStore ).getEditedPostId(), - postType: select( editSiteStore ).getEditedPostType(), - }; - }, [] ); - - const onTemplateSelect = async ( selectedTemplate ) => { - onClose(); // Close the template suggestions modal first. - onClick(); - await editEntityRecord( 'postType', postType, postId, { - blocks: selectedTemplate.blocks, - content: serialize( selectedTemplate.blocks ), - } ); - }; - - if ( ! availableTemplates.length || availableTemplates.length < 1 ) { - return null; - } - - return ( - <> - setShowModal( true ) } - > - { __( 'Replace template' ) } - - - { showModal && ( - -
- -
-
- ) } - - ); -} - -function TemplatesList( { availableTemplates, onSelect } ) { - const shownTemplates = useAsyncList( availableTemplates ); - - return ( - - ); -}