Site editor sidebar: abstracting footer so it can be used across details screens#54082
Site editor sidebar: abstracting footer so it can be used across details screens#54082
Conversation
|
Size Change: -119 B (0%) Total Size: 1.51 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
This is still in progress, but before I go further do you see anything dodgy about what I'm doing here @andrewserong 😄
Things look the same, but I'm concerned I'm locking the global styles screen into the generic footer.
There was a problem hiding this comment.
Thanks for the ping! From a quick glance, I think this looks like a good direction! From my understanding the goal is for us to achieve consistency between a bunch of these screens, and the purpose of the footer area last modified section is much the same between updating a page or updating styles, it's just that we're pulling data from a different place and the onClick will take us somewhere different, but what's communicated to a user will be much the same 👍
|
Flaky tests detected in 9222c9221c7065e8288c834402b5269cf60a8049. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6033306320
|
Oh good spotting. Should be trivial to correct. Will do. |
|
The padding was off. Should be fixed now: 2023-09-03.07.04.03.mp4 |
8c87dc6 to
5d61f1f
Compare
There was a problem hiding this comment.
This is looking pretty close to me!
I noticed that the alignment is still slightly off for the text at the left, and appears to be different based on whether or not it's rendered as a button:
| Not a button (Pattern detail — too far to the left) | Is a button (Styles footer — slightly too far to the right) |
|---|---|
![]() |
![]() |
Something that's potentially contributing to it is that it looks like when it's rendered as a button, the children of button default to text-align: center as part of user agent styles, which means the button text appears slightly further to the right than when not rendered as a button:
Would it work to set text-align: left on .edit-site-sidebar-navigation-screen-details-footer__button for consistency? Then after that, the padding overrides would likely need to be adjusted again a little so that they line up correctly in both the button and non-button states.
Update: alternately, instead of using a Button we might be able to re-use SidebarNavigationItem? Just added another comment. 🙂
packages/edit-site/src/components/sidebar-navigation-screen-details-footer/index.js
Outdated
Show resolved
Hide resolved
Oh! I'll also fix that too. Thank you! |
…ages including global styles.
5d61f1f to
ced200c
Compare
|
Seems to work okay now 👍🏻 2023-09-04.20.28.15.mp4 |
jameskoster
left a comment
There was a problem hiding this comment.
Looks good now, thank you!
|
Thanks @andrewserong and @jameskoster for testing this one. I was a bit pixally-challenged. |
andrewserong
left a comment
There was a problem hiding this comment.
Everything's lining up nicely now! Left a question about the gutenberg param in the addQueryArgs call.
Just spotted one issue, which is that the empty state now results in an extra line being rendered:
| Trunk | This PR |
|---|---|
![]() |
![]() |
I think it might be because footer is now never empty?
Otherwise this is so close now!
| if ( record?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ) { | ||
| hrefProps.href = addQueryArgs( 'revision.php', { | ||
| revision: record?._links[ 'predecessor-version' ][ 0 ].id, | ||
| gutenberg: true, |
There was a problem hiding this comment.
What does the gutenberg: true query arg do? I assume this is part of the follow-up work for revisions. What will we need to change prior to this making it in for 6.4?
There was a problem hiding this comment.
Great question. I think folks keep copying it over. I left it in there, but I wasn't sure and because there are a couple of other examples.
I guessed it's technically there to support very old version of Gutenberg in order to discern between backlinks: https://github.com/WordPress/gutenberg/pull/3511/files#diff-e50f9b4c9183a86d62e4277f4746bb7738dd45c8f6ac50dc563ef7028681832bR493, but that code doesn't exist anymore in the plugin at least. I can't find it in Core either.
So I suppose it's safe to remove it from this PR. I can get another one up to remove it completely.
There was a problem hiding this comment.
Having said that, we might need some Core-safe queries in the future to make sure the "Go to editor" works from revisions.php, that is, that is returns to the site editor and not the edited post
There was a problem hiding this comment.
Ah, gotcha, thanks for the explanation!
Oh yes, that old chestnut. I forgot that a component that returns Good catch (again)! |
…ate is present. remove 'gutenberg' query value from revisions.php
5b4a92d to
8d410c1
Compare
andrewserong
left a comment
There was a problem hiding this comment.
This is working perfectly for me now, thanks for all the follow-ups!
LGTM ✨





Maybe resolves #51343
What?
revision.phpdiff where apredecessor-versionexists in the entity record (pages, templates)Why?
The great unification! Seriously, less stuff to maintain.
How?
Don't you mean, Wow?!
Where a
predecessor-versionexists, we'll build the link torevision.phpunless anonClickhandler is pass, which is the case with global styles.If none of these exist, and there's a last modified entry, just show that info.
Testing Instructions
Save some changes to a page, a template, a pattern and global styles. Enough so you have a few revisions under your belt.
Open the site editor and browse the relevant items in the sidebar.
Check that the "Last modified" footer item looks and works fine for each one.
Click on the links and ensure they either go to
revision.phpor to some other thing, like the Style panel does.Screenshots or screencast
2023-09-04.20.28.15.mp4