-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement the required metadata fields check in the editor #58
Conversation
…ustom status modal
…ew icon for the plugin
…es shown in the dropdown
It's looking great! Can we also double-check the spacings to make sure the gaps between our fields are the same as between the core status fields in the upper part of the summary panel? I also feel that the space before and after the line separator is too great and people would appreciate a bit denser UI. Not sure what it is right now, but it's 16 px in the design. |
… to fix the alignment problems
I tried to do the best I could, but it's still slightly off. We will keep working on that in follow up PRs so it looks more native. A big change that I did make in this PR now is: I switched the extended post status to be a button, that triggers a popover similar to the existing status option and how we show the editorial metadata. I haven't shown the description in here for now. |
modules/shared/img/workflow-icon.svg
Outdated
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.
@ingeniumed @jarekmorawski The first change I'm noticing in this PR is the icon. It looks too dark and off-center:
Notice the icon is a pure black here:
Also, when selected, the icon remains dark and the off-centerness is more obvious:
Compare this to regular menu icons, which have a few changes related to state:
- The icon is a gray (
rgba(240, 246, 252, 0.6)
) color when inactive. - In a hover state, the icon turns blue (
#72aee6
) to match the surrounding text. - When a menu section is clicked and the page loads, the icon is white.
Our icon currently stands out due to the positioning and color. We may need something more complex than a single SVG for this icon to better match the WordPress UI. I'd be happy to circle back here and figure out how we might be able to do that.
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.
All valid points - I should have waited a bit more but I was excited to add in an icon for the plugin 😟
How about I remove this icon for now? Let's add back in once we have those three sorted rather than leaving it in, in a state that's not ideal.
@ingeniumed Not sure if this slipped through in another PR, but I'm seeing that EM field changes in configuration don't persist on-page: The field is properly saved after a page refresh, but without a full page refresh EM fields on a status are forgotten. Users seem to persist correctly though. |
@@ -78,7 +79,7 @@ const CustomSaveButtonSidebar = ( { | |||
|
|||
const buttonText = getCustomSaveButtonText( nextStatusTerm, isRestrictedStatus, isWideViewport ); | |||
const tooltipText = isRestrictedStatus | |||
? __( 'Awaiting review from a privileged user', 'vip-workflow' ) | |||
? __( 'Requirements for advancing have not been met.', 'vip-workflow' ) |
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.
Would it be possible to have two messages here? One for when a status requires action (e.g. check a box), and one for when another user needs to make the change. I found myself looking through EM fields for a red asterisk whenever a status had a required user. This could be a frustrating experience for a user if it's unclear what is blocking movement when it's out of their control.
@jarekmorawski any thoughts or suggested copy here?
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 was part of what's not included in this PR yet - the UI inconsistencies, the red asterisk taking some time to show and missing backend checks for EM fields being required.
Def agreed on this though that it needs to be improved further so it's not frustrating or unknown as to why it's blocked.
if ( [] !== $status->meta[ self::METADATA_REQ_EDITORIAL_IDS_KEY ] ) { | ||
$meta_fields = array_values( array_filter( array_map( function ( $metadata_id ) use ( $editorial_metadatas ) { | ||
// look up the metadata_id in the editorial_metadatas array, to match by term_id | ||
$terms = array_values( array_filter( $editorial_metadatas, function ( $editorial_metadata ) use ( $metadata_id ) { |
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.
Minor: this feels a bit awkward to search through all of $editorial_metadatas
for each term. I also found this a bit hard to follow and needed a debugger to ensure I understood it.
One way to handle something like this would be precomputing the mapping of metadata IDs to terms in something like $metadata_id_to_term
computed once, and then just check the mapping in constant-time when needed instead of a second array_filter()
. This isn't really an optimization issue as it wouldn't be a problem until there are thousands (or more) of both metadata terms and custom status associations, but I do think it could help the readability.
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.
Same thing as below really - this can be optimized a lot more once the refactor + bottom optimization is in. This way causes the least amount of conflicts or problems with the current code.
* | ||
* @return array $custom_statuses The custom statuses with editorial metadatas | ||
*/ | ||
private function get_custom_statuses_with_editorial_metadata() { |
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.
Any thoughts about making this default get_custom_statuses()
behavior? One thing that trips me up is we set meta[ self::METADATA_REQ_EDITORIAL_IDS_KEY ]
by default but meta[ self::METADATA_REQ_EDITORIALS_KEY ]
is computed only when this function is called. I don't like that we need to remember which of these are provided by the base function and which are computed by other functions that need to be called later.
I think these keys ideally represent all available data on custom statuses, and have helper functions to provide computed results (e.g. get_required_editorial_metadata($term_id)
) and not store the result in meta
, since it's derived data. It's just handling both actual metadata and computed results in the same place that's confusing, I think.
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.
So, that is something I want to do but we need to finish the custom status migration before we can do that due to the init conflicts that arise. The priorities hacks worked sometimes, but they also caused issues sometimes. The problem is that EM's taxonomy gets used in CS and vice versa.
I did some experimentation with #59 and it worked a lot better. So I've been waiting to get that in and then I'll tweak this.
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.
Overall, this is great! I love the new EM field UI in the editor and it's working almost exactly like I'd hoped. Fantastic job!
We had a conversation about the outstanding issues. From my understanding, we can merge this PR after:
- Fixing the EM field configuration not staying on the page when saved.
- Removing the current icon as it has some issues in the sidebar.
We'll return in future work to finish the remaining UI polish issues noted:
- Having a separate message for missing EM fields vs missing user.
- Refactoring how we handle computed EM metadata, which can be done after the major refactor in Refactor the remaining modules #59 is merged.
- Minor optimizations in how we gather EM metadata.
Thank you!
…ditorial metadatas
…big refactor enough
Yip, that's correct. What I've done:
I've filed the following as follow ups: |
Description
Problems in this PR that still have to be fixed in follow up PRs