@wordpress/edit-site 5.25.1-next.79a6196f.0 → 5.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.26.0 (2024-01-10)
6
+
5
7
  ## 5.25.0 (2023-12-13)
6
8
 
7
9
  ## 5.24.0 (2023-11-29)
@@ -47,6 +47,8 @@ function SidebarNavigationScreenTemplates() {
47
47
  } = (0, _coreData.useEntityRecords)('postType', _constants.TEMPLATE_POST_TYPE, {
48
48
  per_page: -1
49
49
  });
50
+ const sortedTemplates = templates ? [...templates] : [];
51
+ sortedTemplates.sort((a, b) => a.title.rendered.localeCompare(b.title.rendered));
50
52
  const browseAllLink = (0, _link.useLink)({
51
53
  path: '/wp_template/all'
52
54
  });
@@ -60,73 +62,16 @@ function SidebarNavigationScreenTemplates() {
60
62
  as: _sidebarButton.default
61
63
  }
62
64
  }),
63
- content: (0, _react.createElement)(_react.Fragment, null, isLoading && (0, _i18n.__)('Loading templates…'), !isLoading && (0, _react.createElement)(SidebarTemplatesList, {
64
- templates: templates
65
- })),
65
+ content: (0, _react.createElement)(_react.Fragment, null, isLoading && (0, _i18n.__)('Loading templates…'), !isLoading && (0, _react.createElement)(_components.__experimentalItemGroup, null, !templates?.length && (0, _react.createElement)(_components.__experimentalItem, null, (0, _i18n.__)('No templates found')), sortedTemplates.map(template => (0, _react.createElement)(TemplateItem, {
66
+ postType: _constants.TEMPLATE_POST_TYPE,
67
+ postId: template.id,
68
+ key: template.id,
69
+ withChevron: true
70
+ }, (0, _htmlEntities.decodeEntities)(template.title?.rendered || template.slug))))),
66
71
  footer: !isMobileViewport && (0, _react.createElement)(_sidebarNavigationItem.default, {
67
72
  withChevron: true,
68
73
  ...browseAllLink
69
74
  }, (0, _i18n.__)('Manage all templates'))
70
75
  });
71
76
  }
72
- function TemplatesGroup({
73
- title,
74
- templates
75
- }) {
76
- return (0, _react.createElement)(_components.__experimentalItemGroup, null, !!title && (0, _react.createElement)(_components.__experimentalItem, {
77
- className: "edit-site-sidebar-navigation-screen-templates__templates-group-title"
78
- }, title), templates.map(template => (0, _react.createElement)(TemplateItem, {
79
- postType: _constants.TEMPLATE_POST_TYPE,
80
- postId: template.id,
81
- key: template.id,
82
- withChevron: true
83
- }, (0, _htmlEntities.decodeEntities)(template.title?.rendered || template.slug))));
84
- }
85
- function SidebarTemplatesList({
86
- templates
87
- }) {
88
- if (!templates?.length) {
89
- return (0, _react.createElement)(_components.__experimentalItemGroup, null, (0, _react.createElement)(_components.__experimentalItem, null, (0, _i18n.__)('No templates found')));
90
- }
91
- const sortedTemplates = templates ? [...templates] : [];
92
- sortedTemplates.sort((a, b) => a.title.rendered.localeCompare(b.title.rendered));
93
- const {
94
- hierarchyTemplates,
95
- customTemplates,
96
- ...plugins
97
- } = sortedTemplates.reduce((accumulator, template) => {
98
- const {
99
- original_source: originalSource,
100
- author_text: authorText
101
- } = template;
102
- if (originalSource === 'plugin') {
103
- if (!accumulator[authorText]) {
104
- accumulator[authorText] = [];
105
- }
106
- accumulator[authorText].push(template);
107
- } else if (template.is_custom) {
108
- accumulator.customTemplates.push(template);
109
- } else {
110
- accumulator.hierarchyTemplates.push(template);
111
- }
112
- return accumulator;
113
- }, {
114
- hierarchyTemplates: [],
115
- customTemplates: []
116
- });
117
- return (0, _react.createElement)(_components.__experimentalVStack, {
118
- spacing: 3
119
- }, !!hierarchyTemplates.length && (0, _react.createElement)(TemplatesGroup, {
120
- templates: hierarchyTemplates
121
- }), !!customTemplates.length && (0, _react.createElement)(TemplatesGroup, {
122
- title: (0, _i18n.__)('Custom'),
123
- templates: customTemplates
124
- }), Object.entries(plugins).map(([plugin, pluginTemplates]) => {
125
- return (0, _react.createElement)(TemplatesGroup, {
126
- key: plugin,
127
- title: plugin,
128
- templates: pluginTemplates
129
- });
130
- }));
131
- }
132
77
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_coreData","_htmlEntities","_compose","_sidebarNavigationScreen","_interopRequireDefault","_link","_sidebarNavigationItem","_addNewTemplate","_sidebarButton","_constants","TemplateItem","postType","postId","props","linkInfo","useLink","_react","createElement","default","SidebarNavigationScreenTemplates","isMobileViewport","useViewportMatch","records","templates","isResolving","isLoading","useEntityRecords","TEMPLATE_POST_TYPE","per_page","browseAllLink","path","canCreate","title","__","description","actions","templateType","toggleProps","as","SidebarButton","content","Fragment","SidebarTemplatesList","footer","withChevron","TemplatesGroup","__experimentalItemGroup","__experimentalItem","className","map","template","id","key","decodeEntities","rendered","slug","length","sortedTemplates","sort","a","b","localeCompare","hierarchyTemplates","customTemplates","plugins","reduce","accumulator","original_source","originalSource","author_text","authorText","push","is_custom","__experimentalVStack","spacing","Object","entries","plugin","pluginTemplates"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\nimport SidebarButton from '../sidebar-button';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_POST_TYPE,\n\t\t{ per_page: -1 }\n\t);\n\tconst browseAllLink = useLink( { path: '/wp_template/all' } );\n\tconst canCreate = ! isMobileViewport;\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Express the layout of your site with templates.'\n\t\t\t) }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: SidebarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading templates…' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<SidebarTemplatesList templates={ templates } />\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<SidebarNavigationItem withChevron { ...browseAllLink }>\n\t\t\t\t\t\t{ __( 'Manage all templates' ) }\n\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t)\n\t\t\t}\n\t\t/>\n\t);\n}\n\nfunction TemplatesGroup( { title, templates } ) {\n\treturn (\n\t\t<ItemGroup>\n\t\t\t{ !! title && (\n\t\t\t\t<Item className=\"edit-site-sidebar-navigation-screen-templates__templates-group-title\">\n\t\t\t\t\t{ title }\n\t\t\t\t</Item>\n\t\t\t) }\n\t\t\t{ templates.map( ( template ) => (\n\t\t\t\t<TemplateItem\n\t\t\t\t\tpostType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\tkey={ template.id }\n\t\t\t\t\twithChevron\n\t\t\t\t>\n\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\ttemplate.title?.rendered || template.slug\n\t\t\t\t\t) }\n\t\t\t\t</TemplateItem>\n\t\t\t) ) }\n\t\t</ItemGroup>\n\t);\n}\nfunction SidebarTemplatesList( { templates } ) {\n\tif ( ! templates?.length ) {\n\t\treturn (\n\t\t\t<ItemGroup>\n\t\t\t\t<Item>{ __( 'No templates found' ) }</Item>\n\t\t\t</ItemGroup>\n\t\t);\n\t}\n\tconst sortedTemplates = templates ? [ ...templates ] : [];\n\tsortedTemplates.sort( ( a, b ) =>\n\t\ta.title.rendered.localeCompare( b.title.rendered )\n\t);\n\tconst { hierarchyTemplates, customTemplates, ...plugins } =\n\t\tsortedTemplates.reduce(\n\t\t\t( accumulator, template ) => {\n\t\t\t\tconst {\n\t\t\t\t\toriginal_source: originalSource,\n\t\t\t\t\tauthor_text: authorText,\n\t\t\t\t} = template;\n\t\t\t\tif ( originalSource === 'plugin' ) {\n\t\t\t\t\tif ( ! accumulator[ authorText ] ) {\n\t\t\t\t\t\taccumulator[ authorText ] = [];\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ authorText ].push( template );\n\t\t\t\t} else if ( template.is_custom ) {\n\t\t\t\t\taccumulator.customTemplates.push( template );\n\t\t\t\t} else {\n\t\t\t\t\taccumulator.hierarchyTemplates.push( template );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{ hierarchyTemplates: [], customTemplates: [] }\n\t\t);\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t{ !! hierarchyTemplates.length && (\n\t\t\t\t<TemplatesGroup templates={ hierarchyTemplates } />\n\t\t\t) }\n\t\t\t{ !! customTemplates.length && (\n\t\t\t\t<TemplatesGroup\n\t\t\t\t\ttitle={ __( 'Custom' ) }\n\t\t\t\t\ttemplates={ customTemplates }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ Object.entries( plugins ).map(\n\t\t\t\t( [ plugin, pluginTemplates ] ) => {\n\t\t\t\t\treturn (\n\t\t\t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;IAC3C,CAAC,MAAM,IAAKA,QAAQ,CAACsB,SAAS,EAAG;MAChCN,WAAW,CAACH,eAAe,CAACQ,IAAI,CAAErB,QAAS,CAAC;IAC7C,CAAC,MAAM;MACNgB,WAAW,CAACJ,kBAAkB,CAACS,IAAI,CAAErB,QAAS,CAAC;IAChD;IACA,OAAOgB,WAAW;EACnB,CAAC,EACD;IAAEJ,kBAAkB,EAAE,EAAE;IAAEC,eAAe,EAAE;EAAG,CAC/C,CAAC;EACF,OACC,IAAA/C,MAAA,CAAAC,aAAA,EAACpB,WAAA,CAAA4E,oBAAM;IAACC,OAAO,EAAG;EAAG,GAClB,CAAC,CAAEZ,kBAAkB,CAACN,MAAM,IAC7B,IAAAxC,MAAA,CAAAC,aAAA,EAAC4B,cAAc;IAACtB,SAAS,EAAGuC;EAAoB,CAAE,CAClD,EACC,CAAC,CAAEC,eAAe,CAACP,MAAM,IAC1B,IAAAxC,MAAA,CAAAC,aAAA,EAAC4B,cAAc;IACdb,KAAK,EAAG,IAAAC,QAAE,EAAE,QAAS,CAAG;IACxBV,SAAS,EAAGwC;EAAiB,CAC7B,CACD,EACCY,MAAM,CAACC,OAAO,CAAEZ,OAAQ,CAAC,CAACf,GAAG,CAC9B,CAAE,CAAE4B,MAAM,EAAEC,eAAe,CAAE,KAAM;IAClC,OACC,IAAA9D,MAAA,CAAAC,aAAA,EAAC4B,cAAc;MACdO,GAAG,EAAGyB,MAAQ;MACd7C,KAAK,EAAG6C,MAAQ;MAChBtD,SAAS,EAAGuD;IAAiB,CAC7B,CAAC;EAEJ,CACD,CACO,CAAC;AAEX"}
1
+ {"version":3,"names":["_components","require","_i18n","_coreData","_htmlEntities","_compose","_sidebarNavigationScreen","_interopRequireDefault","_link","_sidebarNavigationItem","_addNewTemplate","_sidebarButton","_constants","TemplateItem","postType","postId","props","linkInfo","useLink","_react","createElement","default","SidebarNavigationScreenTemplates","isMobileViewport","useViewportMatch","records","templates","isResolving","isLoading","useEntityRecords","TEMPLATE_POST_TYPE","per_page","sortedTemplates","sort","a","b","title","rendered","localeCompare","browseAllLink","path","canCreate","__","description","actions","templateType","toggleProps","as","SidebarButton","content","Fragment","__experimentalItemGroup","length","__experimentalItem","map","template","id","key","withChevron","decodeEntities","slug","footer"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\nimport SidebarButton from '../sidebar-button';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_POST_TYPE,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tconst sortedTemplates = templates ? [ ...templates ] : [];\n\tsortedTemplates.sort( ( a, b ) =>\n\t\ta.title.rendered.localeCompare( b.title.rendered )\n\t);\n\n\tconst browseAllLink = useLink( { path: '/wp_template/all' } );\n\tconst canCreate = ! isMobileViewport;\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Express the layout of your site with templates.'\n\t\t\t) }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: SidebarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading templates…' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t{ ! templates?.length && (\n\t\t\t\t\t\t\t\t<Item>{ __( 'No templates found' ) }</Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ sortedTemplates.map( ( template ) => (\n\t\t\t\t\t\t\t\t<TemplateItem\n\t\t\t\t\t\t\t\t\tpostType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\ttemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\ttemplate.slug\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</TemplateItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<SidebarNavigationItem withChevron { ...browseAllLink }>\n\t\t\t\t\t\t{ __( 'Manage all templates' ) }\n\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t)\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,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,IAAAG,QAAE,EAAE,sBAAuB,CACP;EAExB,CACD,CAAC;AAEJ"}
@@ -2,7 +2,7 @@ import { createElement, Fragment } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
5
- import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item, __experimentalVStack as VStack } from '@wordpress/components';
5
+ import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item } from '@wordpress/components';
6
6
  import { __ } from '@wordpress/i18n';
7
7
  import { useEntityRecords } from '@wordpress/core-data';
8
8
  import { decodeEntities } from '@wordpress/html-entities';
@@ -39,6 +39,8 @@ export default function SidebarNavigationScreenTemplates() {
39
39
  } = useEntityRecords('postType', TEMPLATE_POST_TYPE, {
40
40
  per_page: -1
41
41
  });
42
+ const sortedTemplates = templates ? [...templates] : [];
43
+ sortedTemplates.sort((a, b) => a.title.rendered.localeCompare(b.title.rendered));
42
44
  const browseAllLink = useLink({
43
45
  path: '/wp_template/all'
44
46
  });
@@ -52,73 +54,16 @@ export default function SidebarNavigationScreenTemplates() {
52
54
  as: SidebarButton
53
55
  }
54
56
  }),
55
- content: createElement(Fragment, null, isLoading && __('Loading templates…'), !isLoading && createElement(SidebarTemplatesList, {
56
- templates: templates
57
- })),
57
+ content: createElement(Fragment, null, isLoading && __('Loading templates…'), !isLoading && createElement(ItemGroup, null, !templates?.length && createElement(Item, null, __('No templates found')), sortedTemplates.map(template => createElement(TemplateItem, {
58
+ postType: TEMPLATE_POST_TYPE,
59
+ postId: template.id,
60
+ key: template.id,
61
+ withChevron: true
62
+ }, decodeEntities(template.title?.rendered || template.slug))))),
58
63
  footer: !isMobileViewport && createElement(SidebarNavigationItem, {
59
64
  withChevron: true,
60
65
  ...browseAllLink
61
66
  }, __('Manage all templates'))
62
67
  });
63
68
  }
64
- function TemplatesGroup({
65
- title,
66
- templates
67
- }) {
68
- return createElement(ItemGroup, null, !!title && createElement(Item, {
69
- className: "edit-site-sidebar-navigation-screen-templates__templates-group-title"
70
- }, title), templates.map(template => createElement(TemplateItem, {
71
- postType: TEMPLATE_POST_TYPE,
72
- postId: template.id,
73
- key: template.id,
74
- withChevron: true
75
- }, decodeEntities(template.title?.rendered || template.slug))));
76
- }
77
- function SidebarTemplatesList({
78
- templates
79
- }) {
80
- if (!templates?.length) {
81
- return createElement(ItemGroup, null, createElement(Item, null, __('No templates found')));
82
- }
83
- const sortedTemplates = templates ? [...templates] : [];
84
- sortedTemplates.sort((a, b) => a.title.rendered.localeCompare(b.title.rendered));
85
- const {
86
- hierarchyTemplates,
87
- customTemplates,
88
- ...plugins
89
- } = sortedTemplates.reduce((accumulator, template) => {
90
- const {
91
- original_source: originalSource,
92
- author_text: authorText
93
- } = template;
94
- if (originalSource === 'plugin') {
95
- if (!accumulator[authorText]) {
96
- accumulator[authorText] = [];
97
- }
98
- accumulator[authorText].push(template);
99
- } else if (template.is_custom) {
100
- accumulator.customTemplates.push(template);
101
- } else {
102
- accumulator.hierarchyTemplates.push(template);
103
- }
104
- return accumulator;
105
- }, {
106
- hierarchyTemplates: [],
107
- customTemplates: []
108
- });
109
- return createElement(VStack, {
110
- spacing: 3
111
- }, !!hierarchyTemplates.length && createElement(TemplatesGroup, {
112
- templates: hierarchyTemplates
113
- }), !!customTemplates.length && createElement(TemplatesGroup, {
114
- title: __('Custom'),
115
- templates: customTemplates
116
- }), Object.entries(plugins).map(([plugin, pluginTemplates]) => {
117
- return createElement(TemplatesGroup, {
118
- key: plugin,
119
- title: plugin,
120
- templates: pluginTemplates
121
- });
122
- }));
123
- }
124
69
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalVStack","VStack","__","useEntityRecords","decodeEntities","useViewportMatch","SidebarNavigationScreen","useLink","SidebarNavigationItem","AddNewTemplate","SidebarButton","TEMPLATE_POST_TYPE","TemplateItem","postType","postId","props","linkInfo","createElement","SidebarNavigationScreenTemplates","isMobileViewport","records","templates","isResolving","isLoading","per_page","browseAllLink","path","canCreate","title","description","actions","templateType","toggleProps","as","content","Fragment","SidebarTemplatesList","footer","withChevron","TemplatesGroup","className","map","template","id","key","rendered","slug","length","sortedTemplates","sort","a","b","localeCompare","hierarchyTemplates","customTemplates","plugins","reduce","accumulator","original_source","originalSource","author_text","authorText","push","is_custom","spacing","Object","entries","plugin","pluginTemplates"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\nimport SidebarButton from '../sidebar-button';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_POST_TYPE,\n\t\t{ per_page: -1 }\n\t);\n\tconst browseAllLink = useLink( { path: '/wp_template/all' } );\n\tconst canCreate = ! isMobileViewport;\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Express the layout of your site with templates.'\n\t\t\t) }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: SidebarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading templates…' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<SidebarTemplatesList templates={ templates } />\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<SidebarNavigationItem withChevron { ...browseAllLink }>\n\t\t\t\t\t\t{ __( 'Manage all templates' ) }\n\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t)\n\t\t\t}\n\t\t/>\n\t);\n}\n\nfunction TemplatesGroup( { title, templates } ) {\n\treturn (\n\t\t<ItemGroup>\n\t\t\t{ !! title && (\n\t\t\t\t<Item className=\"edit-site-sidebar-navigation-screen-templates__templates-group-title\">\n\t\t\t\t\t{ title }\n\t\t\t\t</Item>\n\t\t\t) }\n\t\t\t{ templates.map( ( template ) => (\n\t\t\t\t<TemplateItem\n\t\t\t\t\tpostType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\tkey={ template.id }\n\t\t\t\t\twithChevron\n\t\t\t\t>\n\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\ttemplate.title?.rendered || template.slug\n\t\t\t\t\t) }\n\t\t\t\t</TemplateItem>\n\t\t\t) ) }\n\t\t</ItemGroup>\n\t);\n}\nfunction SidebarTemplatesList( { templates } ) {\n\tif ( ! templates?.length ) {\n\t\treturn (\n\t\t\t<ItemGroup>\n\t\t\t\t<Item>{ __( 'No templates found' ) }</Item>\n\t\t\t</ItemGroup>\n\t\t);\n\t}\n\tconst sortedTemplates = templates ? [ ...templates ] : [];\n\tsortedTemplates.sort( ( a, b ) =>\n\t\ta.title.rendered.localeCompare( b.title.rendered )\n\t);\n\tconst { hierarchyTemplates, customTemplates, ...plugins } =\n\t\tsortedTemplates.reduce(\n\t\t\t( accumulator, template ) => {\n\t\t\t\tconst {\n\t\t\t\t\toriginal_source: originalSource,\n\t\t\t\t\tauthor_text: authorText,\n\t\t\t\t} = template;\n\t\t\t\tif ( originalSource === 'plugin' ) {\n\t\t\t\t\tif ( ! accumulator[ authorText ] ) {\n\t\t\t\t\t\taccumulator[ authorText ] = [];\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ authorText ].push( template );\n\t\t\t\t} else if ( template.is_custom ) {\n\t\t\t\t\taccumulator.customTemplates.push( template );\n\t\t\t\t} else {\n\t\t\t\t\taccumulator.hierarchyTemplates.push( template );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{ hierarchyTemplates: [], customTemplates: [] }\n\t\t);\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t{ !! hierarchyTemplates.length && (\n\t\t\t\t<TemplatesGroup templates={ hierarchyTemplates } />\n\t\t\t) }\n\t\t\t{ !! customTemplates.length && (\n\t\t\t\t<TemplatesGroup\n\t\t\t\t\ttitle={ __( 'Custom' ) }\n\t\t\t\t\ttemplates={ customTemplates }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ Object.entries( plugins ).map(\n\t\t\t\t( [ plugin, pluginTemplates ] ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TemplatesGroup\n\t\t\t\t\t\t\tkey={ plugin }\n\t\t\t\t\t\t\ttitle={ plugin }\n\t\t\t\t\t\t\ttemplates={ pluginTemplates }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,QACxB,uB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AC9B,CAAE,CAAE0B,MAAM,EAAEC,eAAe,CAAE,KAAM;IAClC,OACCnD,aAAA,CAACsB,cAAc;MACdK,GAAG,EAAGuB,MAAQ;MACdvC,KAAK,EAAGuC,MAAQ;MAChB9C,SAAS,EAAG+C;IAAiB,CAC7B,CAAC;EAEJ,CACD,CACO,CAAC;AAEX"}
1
+ {"version":3,"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__","useEntityRecords","decodeEntities","useViewportMatch","SidebarNavigationScreen","useLink","SidebarNavigationItem","AddNewTemplate","SidebarButton","TEMPLATE_POST_TYPE","TemplateItem","postType","postId","props","linkInfo","createElement","SidebarNavigationScreenTemplates","isMobileViewport","records","templates","isResolving","isLoading","per_page","sortedTemplates","sort","a","b","title","rendered","localeCompare","browseAllLink","path","canCreate","description","actions","templateType","toggleProps","as","content","Fragment","length","map","template","id","key","withChevron","slug","footer"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\nimport SidebarButton from '../sidebar-button';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_POST_TYPE,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tconst sortedTemplates = templates ? [ ...templates ] : [];\n\tsortedTemplates.sort( ( a, b ) =>\n\t\ta.title.rendered.localeCompare( b.title.rendered )\n\t);\n\n\tconst browseAllLink = useLink( { path: '/wp_template/all' } );\n\tconst canCreate = ! isMobileViewport;\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Express the layout of your site with templates.'\n\t\t\t) }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: SidebarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading templates…' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t{ ! templates?.length && (\n\t\t\t\t\t\t\t\t<Item>{ __( 'No templates found' ) }</Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ sortedTemplates.map( ( template ) => (\n\t\t\t\t\t\t\t\t<TemplateItem\n\t\t\t\t\t\t\t\t\tpostType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\ttemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\ttemplate.slug\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</TemplateItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<SidebarNavigationItem withChevron { ...browseAllLink }>\n\t\t\t\t\t\t{ __( 'Manage all templates' ) }\n\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t)\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,QACpB,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,SAASC,OAAO,QAAQ,gBAAgB;AACxC,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,OAAOC,cAAc,MAAM,qBAAqB;AAChD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,MAAMC,YAAY,GAAGA,CAAE;EAAEC,QAAQ;EAAEC,MAAM;EAAE,GAAGC;AAAM,CAAC,KAAM;EAC1D,MAAMC,QAAQ,GAAGT,OAAO,CAAE;IACzBM,QAAQ;IACRC;EACD,CAAE,CAAC;EACH,OAAOG,aAAA,CAACT,qBAAqB;IAAA,GAAMQ,QAAQ;IAAA,GAAQD;EAAK,CAAI,CAAC;AAC9D,CAAC;AAED,eAAe,SAASG,gCAAgCA,CAAA,EAAG;EAC1D,MAAMC,gBAAgB,GAAGd,gBAAgB,CAAE,QAAQ,EAAE,GAAI,CAAC;EAE1D,MAAM;IAAEe,OAAO,EAAEC,SAAS;IAAEC,WAAW,EAAEC;EAAU,CAAC,GAAGpB,gBA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,CAEX,CACF;IACDC,MAAM,EACL,CAAE9B,gBAAgB,IACjBF,aAAA,CAACT,qBAAqB;MAACuC,WAAW;MAAA,GAAMf;IAAa,GAClD9B,EAAE,CAAE,sBAAuB,CACP;EAExB,CACD,CAAC;AAEJ"}
@@ -3555,15 +3555,6 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
3555
3555
  fill: #4ab866;
3556
3556
  }
3557
3557
 
3558
- .edit-site-sidebar-navigation-screen-templates__templates-group-title.components-item {
3559
- text-transform: uppercase;
3560
- color: #e0e0e0;
3561
- padding: 24px 16px 16px 6px;
3562
- border-top: 1px solid #2f2f2f;
3563
- font-size: 11px;
3564
- font-weight: 500;
3565
- }
3566
-
3567
3558
  .edit-site-sidebar-navigation-details-screen-panel {
3568
3559
  margin: 24px 0;
3569
3560
  }
@@ -3556,15 +3556,6 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
3556
3556
  fill: #4ab866;
3557
3557
  }
3558
3558
 
3559
- .edit-site-sidebar-navigation-screen-templates__templates-group-title.components-item {
3560
- text-transform: uppercase;
3561
- color: #e0e0e0;
3562
- padding: 24px 6px 16px 16px;
3563
- border-top: 1px solid #2f2f2f;
3564
- font-size: 11px;
3565
- font-weight: 500;
3566
- }
3567
-
3568
3559
  .edit-site-sidebar-navigation-details-screen-panel {
3569
3560
  margin: 24px 0;
3570
3561
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "5.25.1-next.79a6196f.0",
3
+ "version": "5.26.0",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,46 +27,46 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.48.1-next.79a6196f.0",
31
- "@wordpress/api-fetch": "^6.45.1-next.79a6196f.0",
32
- "@wordpress/blob": "^3.48.1-next.79a6196f.0",
33
- "@wordpress/block-editor": "^12.16.1-next.79a6196f.0",
34
- "@wordpress/block-library": "^8.25.1-next.79a6196f.0",
35
- "@wordpress/blocks": "^12.25.1-next.79a6196f.0",
36
- "@wordpress/commands": "^0.19.1-next.79a6196f.0",
37
- "@wordpress/components": "^25.15.1-next.79a6196f.0",
38
- "@wordpress/compose": "^6.25.1-next.79a6196f.0",
39
- "@wordpress/core-commands": "^0.17.1-next.79a6196f.0",
40
- "@wordpress/core-data": "^6.25.1-next.79a6196f.0",
41
- "@wordpress/data": "^9.18.1-next.79a6196f.0",
42
- "@wordpress/dataviews": "^0.2.1-next.79a6196f.0",
43
- "@wordpress/date": "^4.48.1-next.79a6196f.0",
44
- "@wordpress/deprecated": "^3.48.1-next.79a6196f.0",
45
- "@wordpress/dom": "^3.48.1-next.79a6196f.0",
46
- "@wordpress/editor": "^13.26.1-next.79a6196f.0",
47
- "@wordpress/element": "^5.25.1-next.79a6196f.0",
48
- "@wordpress/escape-html": "^2.48.1-next.79a6196f.0",
49
- "@wordpress/hooks": "^3.48.1-next.79a6196f.0",
50
- "@wordpress/html-entities": "^3.48.1-next.79a6196f.0",
51
- "@wordpress/i18n": "^4.48.1-next.79a6196f.0",
52
- "@wordpress/icons": "^9.39.1-next.79a6196f.0",
53
- "@wordpress/interface": "^5.25.1-next.79a6196f.0",
54
- "@wordpress/keyboard-shortcuts": "^4.25.1-next.79a6196f.0",
55
- "@wordpress/keycodes": "^3.48.1-next.79a6196f.0",
56
- "@wordpress/media-utils": "^4.39.1-next.79a6196f.0",
57
- "@wordpress/notices": "^4.16.1-next.79a6196f.0",
58
- "@wordpress/patterns": "^1.9.1-next.79a6196f.0",
59
- "@wordpress/plugins": "^6.16.1-next.79a6196f.0",
60
- "@wordpress/preferences": "^3.25.1-next.79a6196f.0",
61
- "@wordpress/primitives": "^3.46.1-next.79a6196f.0",
62
- "@wordpress/private-apis": "^0.30.1-next.79a6196f.0",
63
- "@wordpress/reusable-blocks": "^4.25.1-next.79a6196f.0",
64
- "@wordpress/router": "^0.17.1-next.79a6196f.0",
65
- "@wordpress/style-engine": "^1.31.1-next.79a6196f.0",
66
- "@wordpress/url": "^3.49.1-next.79a6196f.0",
67
- "@wordpress/viewport": "^5.25.1-next.79a6196f.0",
68
- "@wordpress/widgets": "^3.25.1-next.79a6196f.0",
69
- "@wordpress/wordcount": "^3.48.1-next.79a6196f.0",
30
+ "@wordpress/a11y": "^3.49.0",
31
+ "@wordpress/api-fetch": "^6.46.0",
32
+ "@wordpress/blob": "^3.49.0",
33
+ "@wordpress/block-editor": "^12.17.0",
34
+ "@wordpress/block-library": "^8.26.0",
35
+ "@wordpress/blocks": "^12.26.0",
36
+ "@wordpress/commands": "^0.20.0",
37
+ "@wordpress/components": "^25.15.0",
38
+ "@wordpress/compose": "^6.26.0",
39
+ "@wordpress/core-commands": "^0.18.0",
40
+ "@wordpress/core-data": "^6.26.0",
41
+ "@wordpress/data": "^9.19.0",
42
+ "@wordpress/dataviews": "^0.3.0",
43
+ "@wordpress/date": "^4.49.0",
44
+ "@wordpress/deprecated": "^3.49.0",
45
+ "@wordpress/dom": "^3.49.0",
46
+ "@wordpress/editor": "^13.26.0",
47
+ "@wordpress/element": "^5.26.0",
48
+ "@wordpress/escape-html": "^2.49.0",
49
+ "@wordpress/hooks": "^3.49.0",
50
+ "@wordpress/html-entities": "^3.49.0",
51
+ "@wordpress/i18n": "^4.49.0",
52
+ "@wordpress/icons": "^9.40.0",
53
+ "@wordpress/interface": "^5.26.0",
54
+ "@wordpress/keyboard-shortcuts": "^4.26.0",
55
+ "@wordpress/keycodes": "^3.49.0",
56
+ "@wordpress/media-utils": "^4.40.0",
57
+ "@wordpress/notices": "^4.17.0",
58
+ "@wordpress/patterns": "^1.10.0",
59
+ "@wordpress/plugins": "^6.17.0",
60
+ "@wordpress/preferences": "^3.26.0",
61
+ "@wordpress/primitives": "^3.47.0",
62
+ "@wordpress/private-apis": "^0.31.0",
63
+ "@wordpress/reusable-blocks": "^4.26.0",
64
+ "@wordpress/router": "^0.18.0",
65
+ "@wordpress/style-engine": "^1.32.0",
66
+ "@wordpress/url": "^3.50.0",
67
+ "@wordpress/viewport": "^5.26.0",
68
+ "@wordpress/widgets": "^3.26.0",
69
+ "@wordpress/wordcount": "^3.49.0",
70
70
  "change-case": "^4.1.2",
71
71
  "classnames": "^2.3.1",
72
72
  "colord": "^2.9.2",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "1e74b942ac0119a22ceaaf5c9594263f3ec516ab"
88
+ "gitHead": "5e6f9caa205d3bfdbac131952b7bf9c6ec60569b"
89
89
  }
@@ -4,7 +4,6 @@
4
4
  import {
5
5
  __experimentalItemGroup as ItemGroup,
6
6
  __experimentalItem as Item,
7
- __experimentalVStack as VStack,
8
7
  } from '@wordpress/components';
9
8
  import { __ } from '@wordpress/i18n';
10
9
  import { useEntityRecords } from '@wordpress/core-data';
@@ -31,11 +30,20 @@ const TemplateItem = ( { postType, postId, ...props } ) => {
31
30
 
32
31
  export default function SidebarNavigationScreenTemplates() {
33
32
  const isMobileViewport = useViewportMatch( 'medium', '<' );
33
+
34
34
  const { records: templates, isResolving: isLoading } = useEntityRecords(
35
35
  'postType',
36
36
  TEMPLATE_POST_TYPE,
37
- { per_page: -1 }
37
+ {
38
+ per_page: -1,
39
+ }
40
+ );
41
+
42
+ const sortedTemplates = templates ? [ ...templates ] : [];
43
+ sortedTemplates.sort( ( a, b ) =>
44
+ a.title.rendered.localeCompare( b.title.rendered )
38
45
  );
46
+
39
47
  const browseAllLink = useLink( { path: '/wp_template/all' } );
40
48
  const canCreate = ! isMobileViewport;
41
49
  return (
@@ -58,7 +66,24 @@ export default function SidebarNavigationScreenTemplates() {
58
66
  <>
59
67
  { isLoading && __( 'Loading templates…' ) }
60
68
  { ! isLoading && (
61
- <SidebarTemplatesList templates={ templates } />
69
+ <ItemGroup>
70
+ { ! templates?.length && (
71
+ <Item>{ __( 'No templates found' ) }</Item>
72
+ ) }
73
+ { sortedTemplates.map( ( template ) => (
74
+ <TemplateItem
75
+ postType={ TEMPLATE_POST_TYPE }
76
+ postId={ template.id }
77
+ key={ template.id }
78
+ withChevron
79
+ >
80
+ { decodeEntities(
81
+ template.title?.rendered ||
82
+ template.slug
83
+ ) }
84
+ </TemplateItem>
85
+ ) ) }
86
+ </ItemGroup>
62
87
  ) }
63
88
  </>
64
89
  }
@@ -72,85 +97,3 @@ export default function SidebarNavigationScreenTemplates() {
72
97
  />
73
98
  );
74
99
  }
75
-
76
- function TemplatesGroup( { title, templates } ) {
77
- return (
78
- <ItemGroup>
79
- { !! title && (
80
- <Item className="edit-site-sidebar-navigation-screen-templates__templates-group-title">
81
- { title }
82
- </Item>
83
- ) }
84
- { templates.map( ( template ) => (
85
- <TemplateItem
86
- postType={ TEMPLATE_POST_TYPE }
87
- postId={ template.id }
88
- key={ template.id }
89
- withChevron
90
- >
91
- { decodeEntities(
92
- template.title?.rendered || template.slug
93
- ) }
94
- </TemplateItem>
95
- ) ) }
96
- </ItemGroup>
97
- );
98
- }
99
- function SidebarTemplatesList( { templates } ) {
100
- if ( ! templates?.length ) {
101
- return (
102
- <ItemGroup>
103
- <Item>{ __( 'No templates found' ) }</Item>
104
- </ItemGroup>
105
- );
106
- }
107
- const sortedTemplates = templates ? [ ...templates ] : [];
108
- sortedTemplates.sort( ( a, b ) =>
109
- a.title.rendered.localeCompare( b.title.rendered )
110
- );
111
- const { hierarchyTemplates, customTemplates, ...plugins } =
112
- sortedTemplates.reduce(
113
- ( accumulator, template ) => {
114
- const {
115
- original_source: originalSource,
116
- author_text: authorText,
117
- } = template;
118
- if ( originalSource === 'plugin' ) {
119
- if ( ! accumulator[ authorText ] ) {
120
- accumulator[ authorText ] = [];
121
- }
122
- accumulator[ authorText ].push( template );
123
- } else if ( template.is_custom ) {
124
- accumulator.customTemplates.push( template );
125
- } else {
126
- accumulator.hierarchyTemplates.push( template );
127
- }
128
- return accumulator;
129
- },
130
- { hierarchyTemplates: [], customTemplates: [] }
131
- );
132
- return (
133
- <VStack spacing={ 3 }>
134
- { !! hierarchyTemplates.length && (
135
- <TemplatesGroup templates={ hierarchyTemplates } />
136
- ) }
137
- { !! customTemplates.length && (
138
- <TemplatesGroup
139
- title={ __( 'Custom' ) }
140
- templates={ customTemplates }
141
- />
142
- ) }
143
- { Object.entries( plugins ).map(
144
- ( [ plugin, pluginTemplates ] ) => {
145
- return (
146
- <TemplatesGroup
147
- key={ plugin }
148
- title={ plugin }
149
- templates={ pluginTemplates }
150
- />
151
- );
152
- }
153
- ) }
154
- </VStack>
155
- );
156
- }
package/src/style.scss CHANGED
@@ -34,7 +34,6 @@
34
34
  @import "./components/sidebar-navigation-screen-details-footer/style.scss";
35
35
  @import "./components/sidebar-navigation-screen-navigation-menu/style.scss";
36
36
  @import "./components/sidebar-navigation-screen-page/style.scss";
37
- @import "./components/sidebar-navigation-screen-templates/style.scss";
38
37
  @import "components/sidebar-navigation-screen-details-panel/style.scss";
39
38
  @import "./components/sidebar-navigation-screen-pattern/style.scss";
40
39
  @import "./components/sidebar-navigation-screen-patterns/style.scss";
@@ -1,9 +0,0 @@
1
- .edit-site-sidebar-navigation-screen-templates__templates-group-title.components-item {
2
- text-transform: uppercase;
3
- color: $gray-200;
4
- // 6px right padding to align with + button
5
- padding: $grid-unit-30 6px $grid-unit-20 $grid-unit-20;
6
- border-top: 1px solid $gray-800;
7
- font-size: 11px;
8
- font-weight: 500;
9
- }