From 4afdac6b520b3bf7d373b4c45c4ca96cee04fde0 Mon Sep 17 00:00:00 2001 From: James Koster Date: Mon, 4 Mar 2024 12:57:28 +0000 Subject: [PATCH 1/7] Swap edit/trash as primary/secondary actions --- packages/edit-site/src/components/actions/index.js | 6 ++++-- packages/edit-site/src/components/page-pages/index.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/edit-site/src/components/actions/index.js b/packages/edit-site/src/components/actions/index.js index 910f5c22724a37..28ca59938cf992 100644 --- a/packages/edit-site/src/components/actions/index.js +++ b/packages/edit-site/src/components/actions/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { external, trash, backup } from '@wordpress/icons'; +import { external, trash, edit, backup } from '@wordpress/icons'; import { addQueryArgs } from '@wordpress/url'; import { useDispatch } from '@wordpress/data'; import { decodeEntities } from '@wordpress/html-entities'; @@ -27,7 +27,7 @@ const { useHistory } = unlock( routerPrivateApis ); export const trashPostAction = { id: 'move-to-trash', label: __( 'Move to Trash' ), - isPrimary: true, + isPrimary: false, icon: trash, isEligible( { status } ) { return status !== 'trash'; @@ -372,6 +372,8 @@ export function useEditPostAction() { () => ( { id: 'edit-post', label: __( 'Edit' ), + isPrimary: true, + icon: edit, isEligible( { status } ) { return status !== 'trash'; }, diff --git a/packages/edit-site/src/components/page-pages/index.js b/packages/edit-site/src/components/page-pages/index.js index 73dd87eeab5a53..505498ef63e35c 100644 --- a/packages/edit-site/src/components/page-pages/index.js +++ b/packages/edit-site/src/components/page-pages/index.js @@ -355,11 +355,11 @@ export default function PagePages() { const editPostAction = useEditPostAction(); const actions = useMemo( () => [ + editPostAction, viewPostAction, trashPostAction, restorePostAction, permanentlyDeletePostAction, - editPostAction, postRevisionsAction, ], [ permanentlyDeletePostAction, restorePostAction, editPostAction ] From 65f073b0735ff44d2fb3d76a5809c9ec53c111ec Mon Sep 17 00:00:00 2001 From: James Koster Date: Mon, 4 Mar 2024 15:59:33 +0000 Subject: [PATCH 2/7] Move trash action --- packages/edit-site/src/components/page-pages/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/page-pages/index.js b/packages/edit-site/src/components/page-pages/index.js index 505498ef63e35c..8638ebb80f901d 100644 --- a/packages/edit-site/src/components/page-pages/index.js +++ b/packages/edit-site/src/components/page-pages/index.js @@ -357,10 +357,10 @@ export default function PagePages() { () => [ editPostAction, viewPostAction, - trashPostAction, restorePostAction, permanentlyDeletePostAction, postRevisionsAction, + trashPostAction, ], [ permanentlyDeletePostAction, restorePostAction, editPostAction ] ); From 907e48b11f4f8501fcd2eaab2bd27a854ae2a7c1 Mon Sep 17 00:00:00 2001 From: James Koster Date: Mon, 4 Mar 2024 16:14:04 +0000 Subject: [PATCH 3/7] Simplify --- packages/edit-site/src/components/actions/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/edit-site/src/components/actions/index.js b/packages/edit-site/src/components/actions/index.js index 28ca59938cf992..f45e1d9230e3df 100644 --- a/packages/edit-site/src/components/actions/index.js +++ b/packages/edit-site/src/components/actions/index.js @@ -27,8 +27,6 @@ const { useHistory } = unlock( routerPrivateApis ); export const trashPostAction = { id: 'move-to-trash', label: __( 'Move to Trash' ), - isPrimary: false, - icon: trash, isEligible( { status } ) { return status !== 'trash'; }, From e79172e5a40aede200b898497210fa68c4e32fed Mon Sep 17 00:00:00 2001 From: James Koster Date: Wed, 6 Mar 2024 10:34:34 +0000 Subject: [PATCH 4/7] Restore trashing as a primary action --- packages/edit-site/src/components/actions/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/edit-site/src/components/actions/index.js b/packages/edit-site/src/components/actions/index.js index f45e1d9230e3df..5fd5164a18e92e 100644 --- a/packages/edit-site/src/components/actions/index.js +++ b/packages/edit-site/src/components/actions/index.js @@ -27,6 +27,8 @@ const { useHistory } = unlock( routerPrivateApis ); export const trashPostAction = { id: 'move-to-trash', label: __( 'Move to Trash' ), + isPrimary: true, + icon: trash, isEligible( { status } ) { return status !== 'trash'; }, From d7237d7505e60e0f93d1dd92779915f222a7af5e Mon Sep 17 00:00:00 2001 From: James Koster Date: Thu, 14 Mar 2024 14:56:13 +0000 Subject: [PATCH 5/7] Remove Trash as primary action --- packages/edit-site/src/components/actions/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/edit-site/src/components/actions/index.js b/packages/edit-site/src/components/actions/index.js index 5fd5164a18e92e..f45e1d9230e3df 100644 --- a/packages/edit-site/src/components/actions/index.js +++ b/packages/edit-site/src/components/actions/index.js @@ -27,8 +27,6 @@ const { useHistory } = unlock( routerPrivateApis ); export const trashPostAction = { id: 'move-to-trash', label: __( 'Move to Trash' ), - isPrimary: true, - icon: trash, isEligible( { status } ) { return status !== 'trash'; }, From ca7bda106e8289a4516cf96e506c0f4198d21b12 Mon Sep 17 00:00:00 2001 From: James Koster Date: Thu, 14 Mar 2024 14:57:32 +0000 Subject: [PATCH 6/7] Remove Permanent deletion as primary action --- packages/edit-site/src/components/actions/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/edit-site/src/components/actions/index.js b/packages/edit-site/src/components/actions/index.js index f45e1d9230e3df..760ed557e70963 100644 --- a/packages/edit-site/src/components/actions/index.js +++ b/packages/edit-site/src/components/actions/index.js @@ -170,8 +170,6 @@ export function usePermanentlyDeletePostAction() { () => ( { id: 'permanently-delete', label: __( 'Permanently delete' ), - isPrimary: true, - icon: trash, supportsBulk: true, isEligible( { status } ) { return status === 'trash'; From 8269d032f5202b6cfc8d21dc59cdbb76ed1a4367 Mon Sep 17 00:00:00 2001 From: James Koster Date: Thu, 21 Mar 2024 12:45:13 +0000 Subject: [PATCH 7/7] Remove unused trash icon --- packages/edit-site/src/components/actions/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/actions/index.js b/packages/edit-site/src/components/actions/index.js index 760ed557e70963..8a2764c05de12c 100644 --- a/packages/edit-site/src/components/actions/index.js +++ b/packages/edit-site/src/components/actions/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { external, trash, edit, backup } from '@wordpress/icons'; +import { external, edit, backup } from '@wordpress/icons'; import { addQueryArgs } from '@wordpress/url'; import { useDispatch } from '@wordpress/data'; import { decodeEntities } from '@wordpress/html-entities';