-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add template actions in site editor navigation sidebar #51054
Add template actions in site editor navigation sidebar #51054
Conversation
packages/edit-site/src/components/template-actions/rename-menu-item.js
Outdated
Show resolved
Hide resolved
Size Change: -990 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
8ccef0d
to
23392f4
Compare
In this commit I'm addressing the snackbar positioning right now by changing it to absolute position. Any feedback is welcome. Also the change is contained in site editor. |
@@ -180,12 +180,7 @@ export default function Editor( { isLoading } ) { | |||
'is-loading': isLoading, | |||
} | |||
) } | |||
notices={ | |||
( isEditMode || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe there was a recent PR that did that but was reverted due to some side effects. We might want to check whether this change doesn't introduce these side effects back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know about the other PR and I think the issues there were due to some scale
changes. This doesn't seem to affect anything for now.
import RenameMenuItem from './rename-menu-item'; | ||
|
||
export default function Actions( { template } ) { | ||
export default function TemplateActions( { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is great that you were able to reuse this. Personally I always prefer reusable components that receive "ids" instead of objects like this as it's more reusable and also more performant in general (can add extra selectors but this won't force the parent to re-render if it's only this component that cares about the object)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated to fetch the data in this component. Also used getEntityRecord
and reverted the checks for title.rendered
existence.
packages/edit-site/src/components/template-actions/rename-menu-item.js
Outdated
Show resolved
Hide resolved
@@ -144,7 +145,7 @@ export const removeTemplate = | |||
sprintf( | |||
/* translators: The template/part's name. */ | |||
__( '"%s" deleted.' ), | |||
template.title.rendered |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not related to this PR, but I believe we'll land it soon and it's a small change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working great, I felt that we need a confirmation for the "delete" action but it's an aside and not strictly the responsibility of this PR.
* Add template actions in site editor navigation sidebar * add snackbars in site editor and change position to `absolute` * temp title fix for template revert * fetch data in TemplateActions
What?
Part of: #50379
This PR adds the template and template part actions regarding:
Notes
There is a problem we need to solve regarding the
snackbar
notices. Currently we show them only in edit mode. This is also related to my initial redirection on deletion to the list of templates/template types, as they show them.What this means is the notices handling here is incomplete because the renaming actions and the rest that will be needed(delete page, etc..) are not shown in view mode. So it needs this issue solved, which had an exploration but got reverted.
Testing Instructions in site editor
Actions
drop down menu and try the actionsActions
drop down menu and try the actionsScreenshots or screencast
Screen.Recording.2023-05-30.at.12.44.54.PM.mov