Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
address feedback
  • Loading branch information
ntsekouras committed Jan 11, 2024
commit 5c320b20f9165501d9faf21badd5930505f933e3
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function SidebarTemplatesList( { templates } ) {
sortedTemplates.sort( ( a, b ) =>
a.title.rendered.localeCompare( b.title.rendered )
);
const { themeTemplates, customTemplates, ...pluginTemplates } =
const { hierarchyTemplates, customTemplates, ...plugins } =
sortedTemplates.reduce(
( accumulator, template ) => {
const {
Expand All @@ -123,35 +123,34 @@ function SidebarTemplatesList( { templates } ) {
} else if ( template.is_custom ) {
accumulator.customTemplates.push( template );
} else {
accumulator.themeTemplates.push( template );
accumulator.hierarchyTemplates.push( template );
}
return accumulator;
},
{ themeTemplates: [], customTemplates: [] }
{ hierarchyTemplates: [], customTemplates: [] }
);
return (
<VStack spacing={ 3 }>
{ !! themeTemplates.length && (
<TemplatesGroup templates={ themeTemplates } />
{ !! hierarchyTemplates.length && (
<TemplatesGroup templates={ hierarchyTemplates } />
) }
{ !! customTemplates.length && (
<TemplatesGroup
title={ __( 'Custom' ) }
templates={ customTemplates }
/>
) }
{ !! Object.keys( pluginTemplates ).length &&
Object.entries( pluginTemplates ).map(
( [ plugin, _pluginTemplates ] ) => {
return (
<TemplatesGroup
key={ plugin }
title={ plugin }
templates={ _pluginTemplates }
/>
);
}
) }
{ Object.entries( plugins ).map(
( [ plugin, pluginTemplates ] ) => {
return (
<TemplatesGroup
key={ plugin }
title={ plugin }
templates={ pluginTemplates }
/>
);
}
) }
</VStack>
);
}