Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
83ea11f
Footnotes: inscrease selector specificity for anchor (#52179)
ellatrix Jun 30, 2023
2e8830c
Patterns: Include template parts for custom areas in Uncategorized ca…
aaronrobertshaw Jul 3, 2023
db15884
Fix custom patterns console error (#51947)
glendaviesnz Jun 28, 2023
6aaf269
i18n: Add context to the word "Filters" (#52198)
t-hamano Jul 1, 2023
5b1f580
Update home template icon (#52075)
jameskoster Jun 28, 2023
14c54c5
Centralise all permissions lookup in Link UI and enable (#52166)
getdave Jun 30, 2023
0528766
BlockRemovalWarningModal: Fix incorrect '_n' usage (#52164)
Mamaduka Jun 30, 2023
b8229fe
Fix fetching Nav fallback ID flushing Navigation entity cache (#52069)
getdave Jun 29, 2023
ac9cd11
Block Editor: Unify texts for Create pattern modal (#52151)
t-hamano Jun 30, 2023
b0a5943
Fix history back after entering edit mode from Patterns (#52112)
kevin940726 Jun 30, 2023
b64bc8a
Add template part icons to the library grid items (#51963)
carolinan Jun 28, 2023
0702768
Patterns: Fix sidebar tab label (#51953)
aaronrobertshaw Jun 28, 2023
70fda06
Patterns: Fix setting of sync status for fully synced patterns (#51952)
aaronrobertshaw Jun 28, 2023
b59ce7c
Library: Reinstate manage all template parts page (#51961)
aaronrobertshaw Jun 28, 2023
d739511
Command Palette: fix incorrect path and snackbar message when templat…
t-hamano Jun 30, 2023
d4d0106
Drop-indicator: remove white border. (#52122)
jasmussen Jun 29, 2023
7b8db97
Make Navigation fallback selector private (#51413)
getdave Jun 29, 2023
ea6e8c5
Focus Mode: Use the symbol icon if a pattern is being edited (#52031)
carolinan Jun 29, 2023
8064587
Footnotes: register meta field for pages (#52024)
ellatrix Jun 29, 2023
7dbdc17
Fix unintentional toggling on of distraction free (#52090)
draganescu Jun 29, 2023
97e3acf
Revert "Updating social link attributes (#51997)" (#52019)
ramonjd Jun 29, 2023
53c86fc
Update home template name (#52048)
jameskoster Jun 28, 2023
aba35cb
Removes unused call (#51988)
getdave Jun 28, 2023
0ea227a
Remove ability for user to toggle sync status after pattern creation …
glendaviesnz Jun 29, 2023
9d456e4
Fix disable DFM when opening styles command (#52165)
ntsekouras Jun 30, 2023
d45c58c
Update custom patterns label to 'My patterns' (#51949)
SaxonF Jun 28, 2023
28789fc
Library: Add sync status to pattern details screen (#51954)
aaronrobertshaw Jun 28, 2023
b40ea4a
Patterns: Rename Library to Patterns (#52102)
aaronrobertshaw Jun 30, 2023
e29a7c2
[Library] Add lock icon for theme patterns (#51990)
kevin940726 Jun 30, 2023
be810dd
Patterns: Use "detached" copy consistently (#51993)
richtabor Jun 28, 2023
ce47b98
Editor initrial appender: Zero out margins in constrained layouts. (#…
jasmussen Jun 28, 2023
61f8821
Update pattern creation modal in library (#51946)
SaxonF Jun 28, 2023
6271aae
Fix missing snackbars in Library (#52021)
kevin940726 Jun 28, 2023
ad1865a
Make the entire preview clickable in order to enter "edit" mode in fo…
getdave Jun 28, 2023
3efbff4
Page Content Focus: Add welcome guides (#52014)
noisysocks Jul 3, 2023
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
Update custom patterns label to 'My patterns' (#51949)
* rename custom patterns to my patterns

* Add my patterns label to inserter and show at the top

---------

Co-authored-by: Daniel Richards <[email protected]>
  • Loading branch information
2 people authored and tellthemachines committed Jul 3, 2023
commit d45c58c7f360c5c76bebef466e25d777cf188c37
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const noop = () => {};
// Preferred order of pattern categories. Any other categories should
// be at the bottom without any re-ordering.
const patternCategoriesOrder = [
'custom',
'featured',
'posts',
'text',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { store as blockEditorStore } from '../../../store';

const CUSTOM_CATEGORY = {
name: 'custom',
label: __( 'Custom patterns' ),
label: __( 'My patterns' ),
description: __( 'Custom patterns add by site users' ),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function ReusableBlocksTab( { rootClientId, onInsert, onHover } ) {
post_type: 'wp_block',
} ) }
>
{ __( 'Manage custom patterns' ) }
{ __( 'Manage my patterns' ) }
</Button>
</div>
</>
Expand Down
2 changes: 1 addition & 1 deletion packages/core-commands/src/admin-navigation-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function useAdminNavigationCommands() {
} );
useCommand( {
name: 'core/manage-reusable-blocks',
label: __( 'Manage all custom patterns' ),
label: __( 'Manage all of my patterns' ),
callback: () => {
document.location.href = 'edit.php?post_type=wp_block';
},
Expand Down
6 changes: 3 additions & 3 deletions packages/edit-site/src/components/page-library/utils.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const DEFAULT_CATEGORY = 'header';
export const DEFAULT_TYPE = 'wp_template_part';
export const DEFAULT_CATEGORY = 'my-patterns';
export const DEFAULT_TYPE = 'wp_block';
export const PATTERNS = 'pattern';
export const TEMPLATE_PARTS = 'wp_template_part';
export const USER_PATTERNS = 'wp_block';
export const USER_PATTERN_CATEGORY = 'custom-patterns';
export const USER_PATTERN_CATEGORY = 'my-patterns';

export const CORE_PATTERN_SOURCES = [
'core',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useSelect } from '@wordpress/data';
import { getTemplatePartIcon } from '@wordpress/editor';
import { __ } from '@wordpress/i18n';
import { getQueryArgs } from '@wordpress/url';
import { file } from '@wordpress/icons';
import { file, starFilled } from '@wordpress/icons';

/**
* Internal dependencies
Expand All @@ -23,6 +23,7 @@ import { DEFAULT_CATEGORY, DEFAULT_TYPE } from '../page-library/utils';
import { store as editSiteStore } from '../../store';
import { useLink } from '../routes/link';
import usePatternCategories from './use-pattern-categories';
import useMyPatterns from './use-my-patterns';
import useTemplatePartAreas from './use-template-part-areas';

const templatePartAreaLabels = {
Expand All @@ -41,6 +42,7 @@ export default function SidebarNavigationScreenLibrary() {
const { templatePartAreas, hasTemplateParts, isLoading } =
useTemplatePartAreas();
const { patternCategories, hasPatterns } = usePatternCategories();
const { myPatterns, hasPatterns: hasMyPatterns } = useMyPatterns();

const isTemplatePartsMode = useSelect( ( select ) => {
const settings = select( editSiteStore ).getSettings();
Expand All @@ -58,7 +60,7 @@ export default function SidebarNavigationScreenLibrary() {
href="edit.php?post_type=wp_block"
withChevron
>
{ __( 'Manage all custom patterns' ) }
{ __( 'Manage all of my patterns' ) }
</SidebarNavigationItem>
</ItemGroup>
) : undefined;
Expand Down Expand Up @@ -86,6 +88,23 @@ export default function SidebarNavigationScreenLibrary() {
</Item>
</ItemGroup>
) }
{ hasMyPatterns && (
<ItemGroup className="edit-site-sidebar-navigation-screen-library__group">
<CategoryItem
key={ myPatterns.name }
count={ myPatterns.count }
label={ myPatterns.label }
icon={ starFilled }
id={ myPatterns.name }
type="wp_block"
isActive={
currentCategory ===
`${ myPatterns.name }` &&
currentType === 'wp_block'
}
/>
</ItemGroup>
) }
{ hasTemplateParts && (
<ItemGroup className="edit-site-sidebar-navigation-screen-library__group">
{ Object.entries( templatePartAreas ).map(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* WordPress dependencies
*/
import { store as coreStore } from '@wordpress/core-data';
import { useSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';

export default function useMyPatterns() {
const myPatterns = useSelect( ( select ) =>
select( coreStore ).getEntityRecords( 'postType', 'wp_block', {
per_page: -1,
} )
);

return {
myPatterns: {
count: myPatterns?.length || 0,
name: 'my-patterns',
label: __( 'My patterns' ),
},
hasPatterns: !! myPatterns?.length,
};
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
/**
* WordPress dependencies
*/
import { store as coreStore } from '@wordpress/core-data';
import { useSelect } from '@wordpress/data';
import { useMemo } from '@wordpress/element';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -15,11 +12,6 @@ import useThemePatterns from './use-theme-patterns';
export default function usePatternCategories() {
const defaultCategories = useDefaultPatternCategories();
const themePatterns = useThemePatterns();
const userPatterns = useSelect( ( select ) =>
select( coreStore ).getEntityRecords( 'postType', 'wp_block', {
per_page: -1,
} )
);

const patternCategories = useMemo( () => {
const categoryMap = {};
Expand Down Expand Up @@ -48,17 +40,8 @@ export default function usePatternCategories() {
}
} );

// Add "Your Patterns" category for user patterns if there are any.
if ( userPatterns?.length ) {
categoriesWithCounts.push( {
count: userPatterns.length || 0,
name: 'custom-patterns',
label: __( 'Custom patterns' ),
} );
}

return categoriesWithCounts;
}, [ defaultCategories, themePatterns, userPatterns ] );
}, [ defaultCategories, themePatterns ] );

return { patternCategories, hasPatterns: !! patternCategories.length };
}