diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-pages-dataviews/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-pages-dataviews/index.js deleted file mode 100644 index 3bb3c9c0c8fe02..00000000000000 --- a/packages/edit-site/src/components/sidebar-navigation-screen-pages-dataviews/index.js +++ /dev/null @@ -1,103 +0,0 @@ -/** - * WordPress dependencies - */ -import { - __experimentalTruncate as Truncate, - __experimentalVStack as VStack, -} from '@wordpress/components'; -import { layout } from '@wordpress/icons'; -import { useMemo } from '@wordpress/element'; -import { useEntityRecords, store as coreStore } from '@wordpress/core-data'; -import { decodeEntities } from '@wordpress/html-entities'; -import { __ } from '@wordpress/i18n'; -import { useSelect } from '@wordpress/data'; - -/** - * Internal dependencies - */ -import { useLink } from '../routes/link'; -import { TEMPLATE_POST_TYPE } from '../../utils/constants'; -import SidebarNavigationItem from '../sidebar-navigation-item'; -import SidebarNavigationScreen from '../sidebar-navigation-screen'; -import DataViewsSidebarContent from '../sidebar-dataviews'; - -const PageItem = ( { postType = 'page', postId, ...props } ) => { - const linkInfo = useLink( - { - postType, - postId, - }, - { - backPath: '/page', - } - ); - return ; -}; - -export default function SidebarNavigationScreenPagesDataViews() { - const { records: templateRecords } = useEntityRecords( - 'postType', - TEMPLATE_POST_TYPE, - { - per_page: -1, - } - ); - - const { frontPage, postsPage } = useSelect( ( select ) => { - const { getEntityRecord } = select( coreStore ); - const siteSettings = getEntityRecord( 'root', 'site' ); - return { - frontPage: siteSettings?.page_on_front, - postsPage: siteSettings?.page_for_posts, - }; - }, [] ); - - const templates = useMemo( () => { - if ( ! templateRecords ) { - return []; - } - - const isHomePageBlog = frontPage === postsPage; - const homeTemplate = - templateRecords?.find( - ( template ) => template.slug === 'front-page' - ) || - templateRecords?.find( ( template ) => template.slug === 'home' ) || - templateRecords?.find( ( template ) => template.slug === 'index' ); - - return [ - isHomePageBlog ? homeTemplate : null, - ...templateRecords?.filter( ( { slug } ) => - [ '404', 'search' ].includes( slug ) - ), - ].filter( Boolean ); - }, [ templateRecords, frontPage, postsPage ] ); - - return ( - } - backPath="/page" - footer={ - - { templates?.map( ( item ) => ( - - - { decodeEntities( - item.title?.rendered || __( '(no title)' ) - ) } - - - ) ) } - - } - /> - ); -} diff --git a/packages/edit-site/src/components/sidebar/index.js b/packages/edit-site/src/components/sidebar/index.js index 1890d3afcf7ba0..ea705b25efde3f 100644 --- a/packages/edit-site/src/components/sidebar/index.js +++ b/packages/edit-site/src/components/sidebar/index.js @@ -13,6 +13,7 @@ import { } from '@wordpress/components'; import { privateApis as routerPrivateApis } from '@wordpress/router'; import { useViewportMatch } from '@wordpress/compose'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies @@ -32,7 +33,8 @@ import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen import SaveHub from '../save-hub'; import { unlock } from '../../lock-unlock'; import SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages'; -import SidebarNavigationScreenPagesDataViews from '../sidebar-navigation-screen-pages-dataviews'; +import SidebarNavigationScreen from '../sidebar-navigation-screen'; +import DataViewsSidebarContent from '../sidebar-dataviews'; import SidebarNavigationScreenPage from '../sidebar-navigation-screen-page'; const { useLocation } = unlock( routerPrivateApis ); @@ -71,7 +73,10 @@ function SidebarScreens() { - + } + />