Skip to content

Commit

Permalink
Fix: Site Editor Template part is missing an icon in the sidebar (#68653
Browse files Browse the repository at this point in the history
)


Co-authored-by: dhananjaykuber <dhananjaykuber@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
  • Loading branch information
4 people authored Jan 15, 2025
1 parent 1623711 commit 7b6e775
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions packages/editor/src/store/private-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
getEntityFields as _getEntityFields,
isEntityReady as _isEntityReady,
} from '../dataviews/store/private-selectors';
import { getTemplatePartIcon } from '../utils';

const EMPTY_INSERTION_POINT = {
rootClientId: undefined,
Expand Down Expand Up @@ -97,15 +98,21 @@ export const getPostIcon = createRegistrySelector(
postType === 'wp_template_part' ||
postType === 'wp_template'
) {
return (
(
select( coreStore ).getEntityRecord(
'root',
'__unstableBase'
)?.default_template_part_areas || []
).find( ( item ) => options.area === item.area )?.icon ||
layout
const templateAreas =
select( coreStore ).getEntityRecord(
'root',
'__unstableBase'
)?.default_template_part_areas || [];

const areaData = templateAreas.find(
( item ) => options.area === item.area
);

if ( areaData?.icon ) {
return getTemplatePartIcon( areaData.icon );
}

return layout;
}
if ( CARD_ICONS[ postType ] ) {
return CARD_ICONS[ postType ];
Expand Down

0 comments on commit 7b6e775

Please sign in to comment.