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

Site Editor: Add Post Taxonomies panel #57049

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
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
30 changes: 0 additions & 30 deletions packages/edit-post/src/components/sidebar/post-taxonomies/index.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ import { isRTL, __ } from '@wordpress/i18n';
import { drawerLeft, drawerRight } from '@wordpress/icons';
import { store as interfaceStore } from '@wordpress/interface';
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
import { store as editorStore, PostLastRevisionPanel } from '@wordpress/editor';
import {
store as editorStore,
PostLastRevisionPanel,
PostTaxonomiesPanel,
} from '@wordpress/editor';

/**
* Internal dependencies
*/
import SettingsHeader from '../settings-header';
import PostStatus from '../post-status';
import PostTaxonomies from '../post-taxonomies';
import FeaturedImage from '../featured-image';
import PostExcerpt from '../post-excerpt';
import DiscussionPanel from '../discussion-panel';
Expand Down Expand Up @@ -79,7 +82,7 @@ const SidebarContent = ( {
<PostStatus />
<PluginDocumentSettingPanel.Slot />
<PostLastRevisionPanel />
<PostTaxonomies />
<PostTaxonomiesPanel />
<FeaturedImage />
<PostExcerpt />
<DiscussionPanel />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import { humanTimeDiff } from '@wordpress/date';
import { useSelect } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
import { decodeEntities } from '@wordpress/html-entities';
import { PostLastRevisionPanel, store as editorStore } from '@wordpress/editor';
import {
PostLastRevisionPanel,
PostTaxonomiesPanel,
store as editorStore,
} from '@wordpress/editor';

/**
* Internal dependencies
Expand Down Expand Up @@ -95,6 +99,7 @@ export default function PagePanels() {
</PanelBody>
) }
<PostLastRevisionPanel />
<PostTaxonomiesPanel />
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
*/
import { useSelect } from '@wordpress/data';
import { PanelBody } from '@wordpress/components';
import { PostLastRevisionPanel, store as editorStore } from '@wordpress/editor';
import {
PostTaxonomiesPanel,
PostLastRevisionPanel,
store as editorStore,
} from '@wordpress/editor';
import { store as coreStore } from '@wordpress/core-data';
import { decodeEntities } from '@wordpress/html-entities';
import { navigation, symbol } from '@wordpress/icons';
Expand All @@ -15,38 +19,31 @@ import { store as editSiteStore } from '../../../store';
import TemplateActions from './template-actions';
import TemplateAreas from './template-areas';
import SidebarCard from '../sidebar-card';
import PatternCategories from './pattern-categories';
import { PATTERN_TYPES } from '../../../utils/constants';

const CARD_ICONS = {
wp_block: symbol,
wp_navigation: navigation,
};

export default function TemplatePanel() {
const { title, description, icon, record, postType } = useSelect(
( select ) => {
const { getEditedPostType, getEditedPostId } =
select( editSiteStore );
const { getEditedEntityRecord } = select( coreStore );
const { __experimentalGetTemplateInfo: getTemplateInfo } =
select( editorStore );
const { title, description, icon, record } = useSelect( ( select ) => {
const { getEditedPostType, getEditedPostId } = select( editSiteStore );
const { getEditedEntityRecord } = select( coreStore );
const { __experimentalGetTemplateInfo: getTemplateInfo } =
select( editorStore );

const type = getEditedPostType();
const postId = getEditedPostId();
const _record = getEditedEntityRecord( 'postType', type, postId );
const info = getTemplateInfo( _record );
const type = getEditedPostType();
const postId = getEditedPostId();
const _record = getEditedEntityRecord( 'postType', type, postId );
const info = getTemplateInfo( _record );

return {
title: info.title,
description: info.description,
icon: info.icon,
record: _record,
postType: type,
};
},
[]
);
return {
title: info.title,
description: info.description,
icon: info.icon,
record: _record,
};
}, [] );

if ( ! title && ! description ) {
return null;
Expand All @@ -66,11 +63,7 @@ export default function TemplatePanel() {
</SidebarCard>
</PanelBody>
<PostLastRevisionPanel />
<PanelBody>
{ postType === PATTERN_TYPES.user && (
<PatternCategories post={ record } />
) }
</PanelBody>
<PostTaxonomiesPanel />
</>
);
}
Loading
Loading