From 4afcedf64263de372c5e701a509619c23c556f92 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Thu, 29 Jun 2023 14:11:12 +1000 Subject: [PATCH 1/8] Rename Library nav screen directory --- .../category-item.js | 0 .../index.js | 0 .../style.scss | 0 .../use-default-pattern-categories.js | 0 .../use-my-patterns.js | 0 .../use-pattern-categories.js | 0 .../use-template-part-areas.js | 0 .../use-theme-patterns.js | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename packages/edit-site/src/components/{sidebar-navigation-screen-library => sidebar-navigation-screen-patterns}/category-item.js (100%) rename packages/edit-site/src/components/{sidebar-navigation-screen-library => sidebar-navigation-screen-patterns}/index.js (100%) rename packages/edit-site/src/components/{sidebar-navigation-screen-library => sidebar-navigation-screen-patterns}/style.scss (100%) rename packages/edit-site/src/components/{sidebar-navigation-screen-library => sidebar-navigation-screen-patterns}/use-default-pattern-categories.js (100%) rename packages/edit-site/src/components/{sidebar-navigation-screen-library => sidebar-navigation-screen-patterns}/use-my-patterns.js (100%) rename packages/edit-site/src/components/{sidebar-navigation-screen-library => sidebar-navigation-screen-patterns}/use-pattern-categories.js (100%) rename packages/edit-site/src/components/{sidebar-navigation-screen-library => sidebar-navigation-screen-patterns}/use-template-part-areas.js (100%) rename packages/edit-site/src/components/{sidebar-navigation-screen-library => sidebar-navigation-screen-patterns}/use-theme-patterns.js (100%) diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-library/category-item.js b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js similarity index 100% rename from packages/edit-site/src/components/sidebar-navigation-screen-library/category-item.js rename to packages/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-library/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js similarity index 100% rename from packages/edit-site/src/components/sidebar-navigation-screen-library/index.js rename to packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-library/style.scss b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/style.scss similarity index 100% rename from packages/edit-site/src/components/sidebar-navigation-screen-library/style.scss rename to packages/edit-site/src/components/sidebar-navigation-screen-patterns/style.scss diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-library/use-default-pattern-categories.js b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js similarity index 100% rename from packages/edit-site/src/components/sidebar-navigation-screen-library/use-default-pattern-categories.js rename to packages/edit-site/src/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-library/use-my-patterns.js b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js similarity index 100% rename from packages/edit-site/src/components/sidebar-navigation-screen-library/use-my-patterns.js rename to packages/edit-site/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-library/use-pattern-categories.js b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js similarity index 100% rename from packages/edit-site/src/components/sidebar-navigation-screen-library/use-pattern-categories.js rename to packages/edit-site/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-library/use-template-part-areas.js b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js similarity index 100% rename from packages/edit-site/src/components/sidebar-navigation-screen-library/use-template-part-areas.js rename to packages/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-library/use-theme-patterns.js b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js similarity index 100% rename from packages/edit-site/src/components/sidebar-navigation-screen-library/use-theme-patterns.js rename to packages/edit-site/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js From f244dc9465bbb96868cc8504cfd0901355c4055c Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Thu, 29 Jun 2023 14:17:10 +1000 Subject: [PATCH 2/8] Complete renaming of sidebar screen to patterns --- .../sidebar-navigation-screen-patterns/index.js | 14 +++++++------- .../sidebar-navigation-screen-patterns/style.scss | 2 +- packages/edit-site/src/components/sidebar/index.js | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js index 5aa32e7587ebd2..668e694788e8f9 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-patterns/index.js @@ -33,7 +33,7 @@ const templatePartAreaLabels = { uncategorized: __( 'Uncategorized' ), }; -export default function SidebarNavigationScreenLibrary() { +export default function SidebarNavigationScreenPatterns() { const isMobileViewport = useViewportMatch( 'medium', '<' ); const { categoryType, categoryId } = getQueryArgs( window.location.href ); const currentCategory = categoryId || DEFAULT_CATEGORY; @@ -68,7 +68,7 @@ export default function SidebarNavigationScreenLibrary() { return ( - { isLoading && __( 'Loading library' ) } + { isLoading && __( 'Loading patterns' ) } { ! isLoading && ( <> { ! hasTemplateParts && ! hasPatterns && ( - + { __( 'No template parts or patterns found' @@ -89,7 +89,7 @@ export default function SidebarNavigationScreenLibrary() { ) } { hasMyPatterns && ( - + ) } { hasTemplateParts && ( - + { Object.entries( templatePartAreas ).map( ( [ area, parts ] ) => ( ) } { hasPatterns && ( - + { patternCategories.map( ( category ) => ( - + From 2a9ce2e5c7f5b70956481091f78984cd2ee579ce Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Thu, 29 Jun 2023 14:24:10 +1000 Subject: [PATCH 3/8] Update library paths and main screen nav buttons --- .../core-commands/src/site-editor-navigation-commands.js | 2 +- .../edit-site/src/components/page-library/patterns-list.js | 4 ++-- packages/edit-site/src/components/page-main/index.js | 2 +- .../src/components/sidebar-navigation-screen-main/index.js | 4 ++-- .../components/sidebar-navigation-screen-pattern/index.js | 2 +- .../sidebar-navigation-screen-patterns/category-item.js | 6 +++--- .../sidebar-navigation-screen-templates-browse/index.js | 2 +- packages/edit-site/src/components/sidebar/index.js | 2 +- .../sync-state-with-url/use-sync-path-with-url.js | 2 +- packages/edit-site/src/utils/get-is-list-page.js | 6 +++--- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/core-commands/src/site-editor-navigation-commands.js b/packages/core-commands/src/site-editor-navigation-commands.js index 6331afd058de34..8f2003d0e08a27 100644 --- a/packages/core-commands/src/site-editor-navigation-commands.js +++ b/packages/core-commands/src/site-editor-navigation-commands.js @@ -203,7 +203,7 @@ function useSiteEditorBasicNavigationCommands() { icon: symbolFilled, callback: ( { close } ) => { const args = { - path: '/library', + path: '/patterns', }; const targetUrl = addQueryArgs( 'site-editor.php', args ); if ( isSiteEditor ) { diff --git a/packages/edit-site/src/components/page-library/patterns-list.js b/packages/edit-site/src/components/page-library/patterns-list.js index 32ab28944ecb13..30f46d727e13a0 100644 --- a/packages/edit-site/src/components/page-library/patterns-list.js +++ b/packages/edit-site/src/components/page-library/patterns-list.js @@ -53,10 +53,10 @@ export default function PatternsList( { categoryId, type } ) { onClick={ () => { // Go back in history if we came from the library page. // Otherwise push a stack onto the history. - if ( location.state?.backPath === '/library' ) { + if ( location.state?.backPath === '/patterns' ) { history.back(); } else { - history.push( { path: '/library' } ); + history.push( { path: '/patterns' } ); } } } /> diff --git a/packages/edit-site/src/components/page-main/index.js b/packages/edit-site/src/components/page-main/index.js index a6c05886888c45..444bb36e7569e0 100644 --- a/packages/edit-site/src/components/page-main/index.js +++ b/packages/edit-site/src/components/page-main/index.js @@ -22,7 +22,7 @@ export default function PageMain() { return ; } else if ( path === '/wp_template_part/all' ) { return ; - } else if ( path === '/library' ) { + } else if ( path === '/patterns' ) { return ; } diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js index 6e7810abe81c05..58b93d61c45a65 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js @@ -75,11 +75,11 @@ export default function SidebarNavigationScreenMain() { - { __( 'Library' ) } + { __( 'Patterns' ) } } 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 349cc5d43b431d..39f28dba6d5204 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 @@ -33,7 +33,7 @@ export default function SidebarNavigationScreenPattern() { const backPath = ! categoryType && postType === 'wp_template_part' ? '/wp_template_part/all' - : '/library'; + : '/patterns'; return ( - + diff --git a/packages/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js b/packages/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js index ee9fa0fffb801e..45f7eb1b044c1f 100644 --- a/packages/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js +++ b/packages/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js @@ -87,7 +87,7 @@ export default function useSyncPathWithURL() { postId: navigatorParams?.postId, path: undefined, } ); - } else if ( navigatorLocation.path === '/library' ) { + } else if ( navigatorLocation.path === '/patterns' ) { updateUrlParams( { postType: undefined, postId: undefined, diff --git a/packages/edit-site/src/utils/get-is-list-page.js b/packages/edit-site/src/utils/get-is-list-page.js index 11827432071bd3..600e686618bf94 100644 --- a/packages/edit-site/src/utils/get-is-list-page.js +++ b/packages/edit-site/src/utils/get-is-list-page.js @@ -16,9 +16,9 @@ export default function getIsListPage( return ( path === '/wp_template/all' || path === '/wp_template_part/all' || - ( path === '/library' && - // Don't treat "/library" without categoryType and categoryId as a list page - // in mobile because the sidebar covers the whole page. + ( path === '/patterns' && + // Don't treat "/patterns" without categoryType and categoryId as a + // list page in mobile because the sidebar covers the whole page. ( ! isMobileViewport || ( !! categoryType && !! categoryId ) ) ) ); } From 088d2109ba8d282508a98e290b59383d499be81b Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Thu, 29 Jun 2023 14:31:22 +1000 Subject: [PATCH 4/8] Rename PageLibrary directory --- .../src/components/{page-library => page-patterns}/grid-item.js | 0 .../src/components/{page-library => page-patterns}/grid.js | 0 .../src/components/{page-library => page-patterns}/index.js | 0 .../src/components/{page-library => page-patterns}/no-patterns.js | 0 .../components/{page-library => page-patterns}/patterns-list.js | 0 .../components/{page-library => page-patterns}/search-items.js | 0 .../src/components/{page-library => page-patterns}/style.scss | 0 .../{page-library => page-patterns}/use-library-settings.js | 0 .../components/{page-library => page-patterns}/use-patterns.js | 0 .../src/components/{page-library => page-patterns}/utils.js | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename packages/edit-site/src/components/{page-library => page-patterns}/grid-item.js (100%) rename packages/edit-site/src/components/{page-library => page-patterns}/grid.js (100%) rename packages/edit-site/src/components/{page-library => page-patterns}/index.js (100%) rename packages/edit-site/src/components/{page-library => page-patterns}/no-patterns.js (100%) rename packages/edit-site/src/components/{page-library => page-patterns}/patterns-list.js (100%) rename packages/edit-site/src/components/{page-library => page-patterns}/search-items.js (100%) rename packages/edit-site/src/components/{page-library => page-patterns}/style.scss (100%) rename packages/edit-site/src/components/{page-library => page-patterns}/use-library-settings.js (100%) rename packages/edit-site/src/components/{page-library => page-patterns}/use-patterns.js (100%) rename packages/edit-site/src/components/{page-library => page-patterns}/utils.js (100%) diff --git a/packages/edit-site/src/components/page-library/grid-item.js b/packages/edit-site/src/components/page-patterns/grid-item.js similarity index 100% rename from packages/edit-site/src/components/page-library/grid-item.js rename to packages/edit-site/src/components/page-patterns/grid-item.js diff --git a/packages/edit-site/src/components/page-library/grid.js b/packages/edit-site/src/components/page-patterns/grid.js similarity index 100% rename from packages/edit-site/src/components/page-library/grid.js rename to packages/edit-site/src/components/page-patterns/grid.js diff --git a/packages/edit-site/src/components/page-library/index.js b/packages/edit-site/src/components/page-patterns/index.js similarity index 100% rename from packages/edit-site/src/components/page-library/index.js rename to packages/edit-site/src/components/page-patterns/index.js diff --git a/packages/edit-site/src/components/page-library/no-patterns.js b/packages/edit-site/src/components/page-patterns/no-patterns.js similarity index 100% rename from packages/edit-site/src/components/page-library/no-patterns.js rename to packages/edit-site/src/components/page-patterns/no-patterns.js diff --git a/packages/edit-site/src/components/page-library/patterns-list.js b/packages/edit-site/src/components/page-patterns/patterns-list.js similarity index 100% rename from packages/edit-site/src/components/page-library/patterns-list.js rename to packages/edit-site/src/components/page-patterns/patterns-list.js diff --git a/packages/edit-site/src/components/page-library/search-items.js b/packages/edit-site/src/components/page-patterns/search-items.js similarity index 100% rename from packages/edit-site/src/components/page-library/search-items.js rename to packages/edit-site/src/components/page-patterns/search-items.js diff --git a/packages/edit-site/src/components/page-library/style.scss b/packages/edit-site/src/components/page-patterns/style.scss similarity index 100% rename from packages/edit-site/src/components/page-library/style.scss rename to packages/edit-site/src/components/page-patterns/style.scss diff --git a/packages/edit-site/src/components/page-library/use-library-settings.js b/packages/edit-site/src/components/page-patterns/use-library-settings.js similarity index 100% rename from packages/edit-site/src/components/page-library/use-library-settings.js rename to packages/edit-site/src/components/page-patterns/use-library-settings.js diff --git a/packages/edit-site/src/components/page-library/use-patterns.js b/packages/edit-site/src/components/page-patterns/use-patterns.js similarity index 100% rename from packages/edit-site/src/components/page-library/use-patterns.js rename to packages/edit-site/src/components/page-patterns/use-patterns.js diff --git a/packages/edit-site/src/components/page-library/utils.js b/packages/edit-site/src/components/page-patterns/utils.js similarity index 100% rename from packages/edit-site/src/components/page-library/utils.js rename to packages/edit-site/src/components/page-patterns/utils.js From 90a864e3d1da83aa129d06e3665805a682cb11d9 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Thu, 29 Jun 2023 14:46:38 +1000 Subject: [PATCH 5/8] Complete renaming in PagePatterns --- .../components/create-pattern-modal/index.js | 2 +- .../src/components/page-main/index.js | 4 ++-- .../src/components/page-patterns/grid-item.js | 14 ++++++------ .../src/components/page-patterns/grid.js | 2 +- .../src/components/page-patterns/index.js | 10 ++++----- .../components/page-patterns/no-patterns.js | 2 +- .../components/page-patterns/patterns-list.js | 8 +++---- .../src/components/page-patterns/style.scss | 22 +++++++++---------- ...ry-settings.js => use-pattern-settings.js} | 2 +- .../index.js | 2 +- .../use-theme-patterns.js | 2 +- 11 files changed, 35 insertions(+), 35 deletions(-) rename packages/edit-site/src/components/page-patterns/{use-library-settings.js => use-pattern-settings.js} (96%) diff --git a/packages/edit-site/src/components/create-pattern-modal/index.js b/packages/edit-site/src/components/create-pattern-modal/index.js index 2c7eb4599dee1a..7906cb2352c7b7 100644 --- a/packages/edit-site/src/components/create-pattern-modal/index.js +++ b/packages/edit-site/src/components/create-pattern-modal/index.js @@ -18,7 +18,7 @@ import { useDispatch } from '@wordpress/data'; /** * Internal dependencies */ -import { SYNC_TYPES, USER_PATTERN_CATEGORY } from '../page-library/utils'; +import { SYNC_TYPES, USER_PATTERN_CATEGORY } from '../page-patterns/utils'; export default function CreatePatternModal( { closeModal, diff --git a/packages/edit-site/src/components/page-main/index.js b/packages/edit-site/src/components/page-main/index.js index 444bb36e7569e0..af017a8db9700a 100644 --- a/packages/edit-site/src/components/page-main/index.js +++ b/packages/edit-site/src/components/page-main/index.js @@ -6,7 +6,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router'; /** * Internal dependencies */ -import PageLibrary from '../page-library'; +import PagePatterns from '../page-patterns'; import PageTemplateParts from '../page-template-parts'; import PageTemplates from '../page-templates'; import { unlock } from '../../lock-unlock'; @@ -23,7 +23,7 @@ export default function PageMain() { } else if ( path === '/wp_template_part/all' ) { return ; } else if ( path === '/patterns' ) { - return ; + return ; } return null; diff --git a/packages/edit-site/src/components/page-patterns/grid-item.js b/packages/edit-site/src/components/page-patterns/grid-item.js index 726f7a9896adc2..cc9d99fd900136 100644 --- a/packages/edit-site/src/components/page-patterns/grid-item.js +++ b/packages/edit-site/src/components/page-patterns/grid-item.js @@ -39,7 +39,7 @@ import { useLink } from '../routes/link'; export default function GridItem( { categoryId, composite, icon, item } ) { const instanceId = useInstanceId( GridItem ); - const descriptionId = `edit-site-library__pattern-description-${ instanceId }`; + const descriptionId = `edit-site-patterns__pattern-description-${ instanceId }`; const [ isDeleteDialogOpen, setIsDeleteDialogOpen ] = useState( false ); const { __experimentalDeleteReusableBlock } = @@ -61,10 +61,10 @@ export default function GridItem( { categoryId, composite, icon, item } ) { }; const isEmpty = ! item.blocks?.length; - const patternClassNames = classnames( 'edit-site-library__pattern', { + const patternClassNames = classnames( 'edit-site-patterns__pattern', { 'is-placeholder': isEmpty, } ); - const previewClassNames = classnames( 'edit-site-library__preview', { + const previewClassNames = classnames( 'edit-site-patterns__preview', { 'is-inactive': item.type === PATTERNS, } ); @@ -132,14 +132,14 @@ export default function GridItem( { categoryId, composite, icon, item } ) { ) }