Skip to content
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

A4A Referrals: convert the actions field into proper actions #94250

Merged
merged 9 commits into from
Sep 11, 2024

Conversation

oandregal
Copy link
Contributor

@oandregal oandregal commented Sep 5, 2024

Follow-up to #93503
Related to #94198

Proposed Changes

This PR converts the existing actions field into proper DataViews actions.

Why are these changes being made?

Part of clean-up of DataViews in A4A to use core-first APIs.

Testing Instructions

yarn && yarn start-a8c-for-agencies

Visit agencies.localhost:3000 and navigate to the "Referrals" section.

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@oandregal oandregal requested review from vitozev and cleacos September 5, 2024 16:23
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Sep 5, 2024
@matticbot
Copy link
Contributor

matticbot commented Sep 5, 2024

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~12 bytes added 📈 [gzipped])

name                        parsed_size           gzip_size
a8c-for-agencies-referrals        -28 B  (-0.0%)      +12 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@rcanepa rcanepa requested a review from a team September 6, 2024 02:13
@yashwin
Copy link
Contributor

yashwin commented Sep 6, 2024

Thanks for working on this!

I was asked to take a look at this here based on this pfYzsZ-g9-p2#comment-141

I tested the PR and found a few issues:

  • The chevron right icon is missing for the actions along with the ACTIONS column

Screenshot from this PR:

Screenshot 2024-09-06 at 9 01 54 AM

Screenshot from production:

Large screen:

Screenshot 2024-09-06 at 8 57 31 AM

Small screen:

Screenshot 2024-09-06 at 8 58 12 AM
  • I'm not sure if we are aware or reported already. I found this a bit confusing and feels redundant (View details action)
Screenshot 2024-09-06 at 9 00 07 AM Screenshot 2024-09-06 at 9 31 21 AM

Please let me know your thoughts!

@rcanepa rcanepa added the A4A label Sep 6, 2024
@oandregal
Copy link
Contributor Author

The chevron right icon is missing for the actions along with the ACTIONS column

Thanks for taking a look! Yes, that's a known issue I mentioned in the PR description (TODO). Didn't get to work on this PR today but I will next week.

@@ -49,10 +49,6 @@
padding: 0;
}
}
th[data-field-id="actions"] {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DataViews no longer includes data-field-id since 4.0.0 (see)

const [ dataViewsState, setDataViewsState ] = useState< DataViewsState >( {
...initialDataViewsState,
layout: {
primaryField: 'client',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This provides some styles (bolder, etc.), renders the field in a special place for list layout (comparing before/after, the field is rendered vertical aligned while before it was ). It also makes it not hidable in list layout and soon in table as well (see).

>
{ item.client.email }
</Button>
<span className="a4a-referrals-client">{ item.client.email }</span>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to make it look the same as before, so added this class to target it. Is this the proper naming structure?

@matticbot
Copy link
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug update/a4a-referrals-actions on your sandbox.

@@ -21,10 +21,6 @@
color: var(--color-jetpack-50);
}

.dataviews-view-table__actions-column {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this style (and the other two in a8c-for-agencies & components/dataviews) is affecting any other screen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not as far as I've reviewed: A4A Sites, A4A Sites Import Modal, A4A Referrals Details, A4A Team, Dotcom Sites.

Also, DataViews doesn't render the actions column if no actions are declared. Not sure why this rule was necessary.

}

.dataviews-view-list li {
cursor: pointer;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already taken care of in dataviews.

cursor: pointer;
}

.dataviews-view-list li .components-h-stack {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this was for, but it was creating some issues with vertical alignment and spacing in the list view when actions were visible.

@oandregal
Copy link
Contributor Author

oandregal commented Sep 9, 2024

@Automattic/a4a-genesis This is now ready in terms of behavior/styling.

I need to review that there are not side-effects to other screens (Actions column is not unintentionally shown in other screens that are not ready for it, for example).

@oandregal oandregal marked this pull request as ready for review September 9, 2024 08:51
@youknowriad
Copy link
Contributor

In my testing, the main behavior change I see is the fact that clicking the row (outside of the chevron) navigates to details in trunk but not in this branch.

Also in both this branch and trunk, when hovering a row (but not an action), there's an inconsistency between desktop and mobile: on mobile the cursor is a pointer but not in desktop.

@youknowriad
Copy link
Contributor

I like the code cleanup a lot :)

@oandregal
Copy link
Contributor Author

In my testing, the main behavior change I see is the fact that clicking the row (outside of the chevron) navigates to details in trunk but not in this branch.

👍

Also in both this branch and trunk, when hovering a row (but not an action), there's an inconsistency between desktop and mobile: on mobile the cursor is a pointer but not in desktop.

In production, I see the pointer both is desktop & mobile, but only when you hover over the client field, which was a button. In this branch, I don't see it in any breakpoint.

@oandregal
Copy link
Contributor Author

One thing I've noticed is that the actions column is sticky but its background is transparent, hence the action buttons overlaps other columns when manually reducing the viewport. This also happens in trunk so it should be addressed separately.

@oandregal
Copy link
Contributor Author

One thing I've noticed is that the actions column is sticky but its background is transparent, hence the action buttons overlaps other columns when manually reducing the viewport. This also happens in trunk so it should be addressed separately.

I've prepared a fix for this at #94323

@yashwin
Copy link
Contributor

yashwin commented Sep 9, 2024

I tested the Referrals page.

  • The Actions menu with the View Details option on Referrals seems a bit repetitive. Maybe we could simplify it to enhance the user experience.
Screenshot 2024-09-09 at 4 08 08 PM

Is it possible to always show the chevron right icon and hide the action menu (... icon)? Something like below as in production:

Screenshot 2024-09-09 at 4 12 57 PM
  • In my testing, the main behavior change I see is the fact that clicking the row (outside of the chevron) navigates to details in trunk but not in this branch.

I also noticed this, are we going to fix this in another PR?

@youknowriad
Copy link
Contributor

The Actions menu with the View Details option on Referrals seems a bit repetitive. Maybe we could simplify it to enhance the user experience.

@oandregal Can we hide the dropdown, if we only have primary actions?

@oandregal
Copy link
Contributor Author

oandregal commented Sep 9, 2024

The Actions menu with the View Details option on Referrals seems a bit repetitive. Maybe we could simplify it to enhance the user experience.
...
Is it possible to always show the chevron right icon and hide the action menu (... icon)? Something like below as in production:
...
Can we hide the dropdown, if we only have primary actions?

No, that's how DataViews actions work.

Note that displaying only the primary actions if there are no secondary ones comes with some details to figure out: for example, only the dropdown is visible until an item is hovered to avoid visual weight. If we wanted to investigate this, it should be an upstream (core dataviews) follow-up PR.

I also noticed this, are we going to fix this in another PR?

This is intentional. The "click row" behavior should not be overriden (it's used for item selection with "bulk actions") and we should prefer primary actions for the "overview-to-details" interaction. See design feedback at pfYzsZ-g9-p2

@youknowriad
Copy link
Contributor

Note that displaying only the primary actions if there are no secondary ones comes with some details to figure out: for example, only the dropdown is visible until an item is hovered to avoid visual weight. If we wanted to investigate this, it should be an upstream (core dataviews) follow-up PR.

Yes, that was actually my suggestion (upstream PR), maybe only when there's a single primary action and make it visible.

@oandregal oandregal self-assigned this Sep 9, 2024
@oandregal
Copy link
Contributor Author

Yes, that was actually my suggestion (upstream PR), maybe only when there's a single primary action and make it visible.

I don't think I can get to this this week, but created an issue in case anyone wants to tackle it (and also to gather design feedback): WordPress/gutenberg#65165

Copy link
Contributor

@yashwin yashwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this!

I don't have any more feedback apart from the one I have mentioned already.

So, I'm approving the PR.

CC: @madebynoam @jeffgolenski FYI 🙂

@oandregal
Copy link
Contributor Author

I'd like to wait until tomorrow to merge this PR, in case there's some late design feedback at pfYzsZ-g9-p2.

@cleacos
Copy link
Contributor

cleacos commented Sep 11, 2024

I saw this issue:

image

image

In theory, it will be fixed by this PR: #94323

@oandregal
Copy link
Contributor Author

I saw this issue:

That also happens in trunk:

Captura de ecrã 2024-09-11, às 12 01 34

In theory, it will be fixed by this PR: #94323

I can confirm it does. I've cherry-picked that branch into this one for local testing and this is the result:

Captura de ecrã 2024-09-11, às 13 05 19

@oandregal oandregal merged commit fdb975c into trunk Sep 11, 2024
15 of 18 checks passed
@oandregal oandregal deleted the update/a4a-referrals-actions branch September 11, 2024 11:30
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants