Replace "Add new post" link text with more meaningful Label#59743
Replace "Add new post" link text with more meaningful Label#59743carstingaxion wants to merge 265 commits intoWordPress:trunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @gutenbergplugin. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @carstingaxion! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
|
Thanks for taking a look @torounit! Please let me know if I can do, provide or change anything. |
t-hamano
left a comment
There was a problem hiding this comment.
Thanks for the PR!
I think the approach itself makes sense, but I think it's recommended to use useSelect hook instead of using select() directly in React components.
const CreateNewPostLink = () => {
// ...
const addNewItemLabel = useSelect(
( select ) => {
const { getPostType } = select( coreStore );
return getPostType( postType )?.labels?.add_new_item;
},
[ postType ]
);
// ...
};Furthermore, in this case, it is assumed that postType is not null, so I think the following line should be removed:
Instead, I think it's better to avoid rendering the CreateNewPostLink component itself if postType is falsy:
{ !! postType && (
<BlockInfo>
<CreateNewPostLink postType={ postType } />
</BlockInfo>
) }Also notice that the prop has been changed to only postType. CreateNewPostLink component only handles postType as a prop, but this should eliminate nested destructuring of props.
If you have any questions, please feel free to comment 👍
|
Wow. Thank you @t-hamano ! Thank you very much for your detailed review and your explicit suggestions on what to improve AND why. For sure I'll update my PR. |
Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org> Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org> Co-authored-by: andrewhayward <andrewhayward@git.wordpress.org>
…ress#59635) * PoC * Fix cmd + K with click * Adding mutually exclusive states * Sync internal state with format active state * Fix broken anchors for Links * Improve variable naming * Normalize more variable names * Fix sub formats breaking click to edit * Force constrainedTabbing for link ui * Handle nested formats * Revert change to hasLink var * Locate const at top of file * Improve comment * Add test for editing text * Improve var naming * Correct comments * Make new prop unstable * Revert useAnchor API --------- Co-authored-by: getdave <get_dave@git.wordpress.org> Co-authored-by: jeryj <jeryj@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: scruffian <scruffian@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: bacoords <bacoords@git.wordpress.org> Co-authored-by: joedolson <joedolson@git.wordpress.org> Co-authored-by: annezazu <annezazu@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org> Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org>
* don't set creating menu flag on menu switch * return Promises from the navigation menu ref changing functions to be able to clean state after ref is updated * update tests * await the menu creation * stub test updates * revert test changes and remove decorative promises * do not disable the UI when changing the navigation, disable the UI based on resolving menus * block the UI for menu switching too, update tests with some comments, undo the focus update * properly disable menu choices via their choices prop Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: scruffian <scruffian@git.wordpress.org> Co-authored-by: jeryj <jeryj@git.wordpress.org> Co-authored-by: getdave <get_dave@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org>
* Change callout to an alert. * Update intro, remove TOC, and change headings * Update Installation and Quick Start Guide sections. Co-authored-by: ndiego <ndiego@git.wordpress.org> Co-authored-by: justintadlock <greenshady@git.wordpress.org>
…ress#59750) Co-authored-by: scruffian <scruffian@git.wordpress.org> Co-authored-by: ajlende <ajlende@git.wordpress.org>
…dPress#59397) * Block Editor: Don't memoize callbacks in 'BlockSettingsDropdown' * Don't pass argument to 'updateSelectionAfterRemove' Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: peterwilsoncc <peterwilsoncc@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
…ordPress#59769) Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@outlook.com>
Co-authored-by: getdave <get_dave@git.wordpress.org> Co-authored-by: swissspidy <swissspidy@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: ockham <bernhard-reiter@git.wordpress.org>
Unlinked contributors: Sam-Xronn, AnukratiMehta. Co-authored-by: colinduwe <colind@git.wordpress.org> Co-authored-by: hanneslsm <hanneslsm@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org>
WordPress#60215) Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
…dPress#60182) Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
* Add tests (failing) * CustomSelectControlV2: Fix hint behavior in legacy * Add changelog Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
…ess#60223) * Add new template variable called namespacePascalCase and fix namespaceSnakeCase that was incorrecly using the slug instead of the namespace. * Use new namespacePascalCase template variable and remove some extraneous whitespace * Update changelog Co-authored-by: ryanwelcher <welcher@git.wordpress.org> Co-authored-by: justintadlock <greenshady@git.wordpress.org>
…60106) Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org> Co-authored-by: MaggieCabrera <onemaggie@git.wordpress.org> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org>
* Refactor global styles and refactor existing background components * Porting over existing hook code to shared, global styles component. * Move tests, move styles, remove duplicate code from block support hook * Pull over changes to background.js from WordPress#59557 * Add default control values for block supports. The default backgroundSize value for block backgrounds is 'cover' * Resetting position if it's center and size is not contain. * Add background-image to INDIRECT_PROPERTIES_METADATA because the value is "indirectly" stored in an array, at least determined by multiple values in an array. --------- Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
…an the focused item (WordPress#59978) * List View: Add keyboard shortcut to collapse list view items other than the focused item * Remove keyboard shortcut info from customize-widgets as there is no list view in that context * Add e2e test coverage * Try adding some state to get it working from the editor canvas * Skip keyboard shortcut in the editor canvas if the event is fired from a text field * Add a few tests Unlinked contributors: jarekmorawski. Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org>
…ess#60229) * Adding "background" top-level styles to the possible change list values. Updates tests. Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
…ess#60068) Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org> Co-authored-by: noisysocks <noisysocks@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
* Block Editor: Expose inserter search term normalization utils * Edit Site: Use search term normalization utils from block editor * Edit Site: Remove remove-accents dependency Co-authored-by: tyxla <tyxla@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org> Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org>
…ss/compose` (WordPress#60168) * Use useReducedMotion() from @wordpress/compose * CHANGELOG Co-authored-by: tyxla <tyxla@git.wordpress.org> Co-authored-by: mirka <0mirka00@git.wordpress.org>
…#60235) Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
…ess#60225) * Move useZoomout check up to PatternCategeryPreviewsPanel wrapper Previously, the useZoomOut check was within the category previews rather than the panel. This meant when the category changed, the zoom out check ran again. We only want the zoom out mode check to happen when the panel itself is mounted. * Simplify useZoomOut logic The useRef wasn't necessary, as it was running before the other useEffect that could set it to true.
* CustomSelectControlV2: Rename for consistency * Add changelog * Improve naming consistency in tests * Simply subcomponent composition and exports * Apply suggestions to readme Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
…s#60190) * NavigatorProvider: move all state management to one reducer * Changelog update * Move types together Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
* Image: Use the new 'useUploadMediaFromBlobURL' hook * Leverage temporaryURL initial state Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org>
* Add test * Test an additional variation
Co-authored-by: jameskoster <jameskoster@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org>
|
OH no. |
|
Hi @carstingaxion, Don't worry about a lot of commit history being added to this PR or a lot of people being notified 😄 If you are concerned about making new changes to this PR, you can close this PR, check out the latest trunk branch again, and submit a new PR with your changes. |
Thank you for your empathic comment @t-hamano , yes I was a little thrilled.
That is, what I'll do now. |
What?
This PR replaces the static "Add new post" link text inside the the query block, with a more meaningful label from the currently selected post type.
Why?
This PR is polishing the existing UI with data, that is already available, without introducing any new elements.
How?
Removes a static text string, with the
add_new_itemlabel from the currently selected post type.Testing Instructions
CreateNewPostLinkelement.Testing Instructions for Keyboard
Test can be done by keyboard as well, without any additions to my Testing Instruction.
Screenshots or screencast
Before
Bildschirmaufzeichnung.vom.11.03.2024.03.51.53.mp4
After
Bildschirmaufzeichnung.vom.11.03.2024.03.56.18.mp4