Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patterns data view: Remove icons in favor of dedicated sync status field #60833

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Changes from all commits
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
33 changes: 2 additions & 31 deletions packages/edit-site/src/components/page-patterns/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,7 @@ import {
privateApis as blockEditorPrivateApis,
} from '@wordpress/block-editor';
import { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';
import {
Icon,
header,
footer,
symbolFilled as uncategorized,
symbol,
lockSmall,
} from '@wordpress/icons';
import { Icon, lockSmall } from '@wordpress/icons';
import { usePrevious } from '@wordpress/compose';
import { useEntityRecords } from '@wordpress/core-data';
import { privateApis as editorPrivateApis } from '@wordpress/editor';
Expand Down Expand Up @@ -76,7 +69,6 @@ const { ExperimentalBlockEditorProvider, useGlobalStyle } = unlock(
const { usePostActions } = unlock( editorPrivateApis );
const { useHistory } = unlock( routerPrivateApis );

const templatePartIcons = { header, footer, uncategorized };
const EMPTY_ARRAY = [];
const defaultConfigPerViewType = {
[ LAYOUT_TABLE ]: {
Expand All @@ -93,7 +85,7 @@ const DEFAULT_VIEW = {
search: '',
page: 1,
perPage: 20,
hiddenFields: [ 'sync-status' ],
hiddenFields: [],
layout: {
...defaultConfigPerViewType[ LAYOUT_GRID ],
},
Expand Down Expand Up @@ -242,22 +234,14 @@ function Author( { item, viewType } ) {

function Title( { item, categoryId } ) {
const isUserPattern = item.type === PATTERN_TYPES.user;
const isNonUserPattern = item.type === PATTERN_TYPES.theme;
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
let itemIcon;
const { onClick } = useLink( {
postType: item.type,
postId: isUserPattern ? item.id : item.name,
categoryId,
categoryType: isTemplatePart ? item.type : PATTERN_TYPES.theme,
canvas: 'edit',
} );
if ( ! isUserPattern && templatePartIcons[ categoryId ] ) {
itemIcon = templatePartIcons[ categoryId ];
} else {
itemIcon =
item.syncStatus === PATTERN_SYNC_TYPES.full ? symbol : undefined;
}
return (
<HStack alignment="center" justify="flex-start" spacing={ 2 }>
<Flex
Expand All @@ -280,19 +264,6 @@ function Title( { item, categoryId } ) {
</Button>
) }
</Flex>
{ itemIcon && ! isNonUserPattern && (
<Tooltip
placement="top"
text={ __(
'Editing this pattern will also update anywhere it is used'
) }
>
<Icon
className="edit-site-patterns__pattern-icon"
icon={ itemIcon }
/>
</Tooltip>
) }
{ item.type === PATTERN_TYPES.theme && (
<Tooltip
placement="top"
Expand Down
Loading