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

Use DataViews component to render Billing History list #97625

Open
wants to merge 45 commits into
base: trunk
Choose a base branch
from

Conversation

billrobbins
Copy link
Contributor

@billrobbins billrobbins commented Dec 18, 2024

Proposed Changes

  • This PR replaces the current Billing History List with one that utilizes WordPress's DataViews component. By doing this we can achieve a greater style consistency with the Sites management screen as well as incorporate features such as sorting by various columns and reorganizing them.
  • This began by duplicating the existing Billing History List into a new folder and then using a feature flag to set which component would load in which environment.
  • WPCOM design requested we keep the header/navigation for the purchases section but they wanted us to implement a full-width layout.
  • The "actions" kabob menu contains the view receipt and email receipt actions from the original version.
  • Pagination, filtering, sorting, searching, and column reorganization are supported.

Before
before

After
after

Why are these changes being made?

When customers have large numbers of receipts, it can be difficult to find a receipt. We wanted to offer the ability to sort the columns, and filter by more props as well. Switching to the DataViews component makes this easier because it has so much functionality built-in.

This PR is being developed in parallel with changes in the Purchases list to allow similar sorting, searching, and filtering options. It's in response to a long-standing feature request in #86616.

Testing Instructions

  1. Check out this branch and load Calypso locally.
  2. Visit http://calypso.localhost:3000/me/purchases/billing and you should see your purchases from WPCOM.
  3. Use the search input to search for domain names, products purchased, and order amounts to see if the search works.
  4. Next to the search box is an icon that opens up the filters. Try clicking on it and applying different filters. You can combine them as well.
  5. The date, app, type, and amount columns are all sortable. Try sorting them ascending/descending.
  6. At the bottom of the list of products, you'll see the pagination. Use it to move through the pages and go to specific pages too.
  7. Lastly, click on the gear icon and use the options there to customize the layout (like moving columns).

TODOs

  • add/modify tests
  • error handling
  • accessbility check

Follow-ups

  • Update receipt view with slide-in panel
  • Update VAT layout to use slide-in panel as well

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 UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • 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)?

@billrobbins billrobbins self-assigned this Dec 18, 2024
@matticbot
Copy link
Contributor

matticbot commented Dec 18, 2024

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

App Entrypoints (~226 bytes removed 📉 [gzipped])

name                 parsed_size           gzip_size
entry-stepper            +1378 B  (+0.1%)     -191 B  (-0.0%)
entry-main               +1378 B  (+0.1%)     -183 B  (-0.0%)
entry-subscriptions        -56 B  (-0.0%)     -118 B  (-0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~20289 bytes added 📈 [gzipped])

name                               parsed_size            gzip_size
site-purchases                       +690988 B  (+42.9%)  +171363 B  (+38.5%)
purchases                            +688386 B  (+32.1%)  +171820 B  (+29.0%)
checkout                                -407 B   (-0.0%)    -1126 B   (-0.2%)
email                                   -276 B   (-0.0%)     +190 B   (+0.1%)
security                                +232 B   (+0.0%)     +128 B   (+0.0%)
site-blocks                             +170 B   (+0.0%)     +507 B   (+0.2%)
help                                    +170 B   (+0.0%)     +387 B   (+0.2%)
theme                                   -159 B   (-0.0%)      -45 B   (-0.0%)
staging-site                            -159 B   (-0.0%)      -50 B   (-0.0%)
sites-dashboard                         -159 B   (-0.0%)      -50 B   (-0.0%)
site-tools                              -159 B   (-0.0%)      -50 B   (-0.0%)
site-settings                           -159 B   (-0.0%)      -50 B   (-0.0%)
site-performance                        -159 B   (-0.0%)      -50 B   (-0.0%)
site-overview                           -159 B   (-0.0%)      -50 B   (-0.0%)
site-monitoring                         -159 B   (-0.0%)      -50 B   (-0.0%)
site-marketing                          -159 B   (-0.0%)      -50 B   (-0.0%)
site-logs                               -159 B   (-0.0%)      -50 B   (-0.0%)
settings-reading                        -159 B   (-0.0%)      -48 B   (-0.0%)
settings-performance                    -159 B   (-0.0%)      -50 B   (-0.0%)
settings-discussion                     -159 B   (-0.0%)      -38 B   (-0.0%)
settings                                -159 B   (-0.0%)      -49 B   (-0.0%)
scan                                    -159 B   (-0.0%)      -52 B   (-0.0%)
reader                                  -159 B   (-0.0%)      -52 B   (-0.0%)
promote-post-i2                         -159 B   (-0.0%)      -49 B   (-0.0%)
plugins                                 -159 B   (-0.0%)      -50 B   (-0.0%)
link-in-bio-tld-flow                    -159 B   (-0.0%)      -73 B   (-0.0%)
jetpack-search                          -159 B   (-0.0%)      -52 B   (-0.0%)
jetpack-cloud-settings                  -159 B   (-0.0%)      -49 B   (-0.0%)
jetpack-cloud-plugin-management         -159 B   (-0.0%)     -100 B   (-0.0%)
jetpack-cloud-partner-portal            -159 B   (-0.0%)      -88 B   (-0.0%)
jetpack-cloud-overview                  -159 B   (-0.0%)      -50 B   (-0.0%)
jetpack-cloud-agency-sites-v2           -159 B   (-0.0%)      -56 B   (-0.0%)
jetpack-cloud                           -159 B   (-0.0%)      -49 B   (-0.0%)
hosting-features                        -159 B   (-0.0%)      -50 B   (-0.0%)
hosting                                 -159 B   (-0.0%)      -50 B   (-0.0%)
google-my-business                      -159 B   (-0.0%)      -51 B   (-0.0%)
github-deployments                      -159 B   (-0.0%)      -50 B   (-0.0%)
backup                                  -159 B   (-0.0%)      -49 B   (-0.0%)
a8c-for-agencies-sites                  -159 B   (-0.0%)      -52 B   (-0.0%)
account                                 -129 B   (-0.0%)      +95 B   (+0.0%)
gutenberg-editor                        -116 B   (-0.0%)      +16 B   (+0.0%)
write-flow                              -103 B   (-0.0%)      -15 B   (-0.0%)
woocommerce-installation                -103 B   (-0.0%)      -14 B   (-0.0%)
woocommerce                             -103 B   (-0.0%)      -14 B   (-0.0%)
themes                                  -103 B   (-0.0%)      -13 B   (-0.0%)
subscribers                             -103 B   (-0.0%)      -13 B   (-0.0%)
stats                                   -103 B   (-0.0%)      -13 B   (-0.0%)
settings-writing                        -103 B   (-0.0%)      -14 B   (-0.0%)
settings-security                       -103 B   (-0.0%)      -14 B   (-0.0%)
settings-podcast                        -103 B   (-0.0%)      -14 B   (-0.0%)
settings-newsletter                     -103 B   (-0.0%)      -14 B   (-0.0%)
settings-jetpack                        -103 B   (-0.0%)      -14 B   (-0.0%)
preview                                 -103 B   (-0.0%)      -14 B   (-0.0%)
posts-custom                            -103 B   (-0.0%)      -13 B   (-0.0%)
posts                                   -103 B   (-0.0%)      -13 B   (-0.0%)
people                                  -103 B   (-0.0%)      -14 B   (-0.0%)
pages                                   -103 B   (-0.0%)      -14 B   (-0.0%)
migrate                                 -103 B   (-0.0%)      -14 B   (-0.0%)
media                                   -103 B   (-0.0%)      -13 B   (-0.0%)
marketing                               -103 B   (-0.0%)      -14 B   (-0.0%)
jetpack-social                          -103 B   (-0.0%)      -14 B   (-0.0%)
jetpack-connect                         -103 B   (-0.0%)     -124 B   (-0.0%)
jetpack-cloud-pricing                   -103 B   (-0.0%)     -124 B   (-0.1%)
jetpack-cloud-features-comparison       -103 B   (-0.0%)     -124 B   (-0.1%)
import                                  -103 B   (-0.0%)      -18 B   (-0.0%)
home                                    -103 B   (-0.0%)     +185 B   (+0.0%)
export                                  -103 B   (-0.0%)      -14 B   (-0.0%)
earn                                    -103 B   (-0.0%)      -13 B   (-0.0%)
customize                               -103 B   (-0.0%)      -14 B   (-0.0%)
concierge                               -103 B   (-0.0%)      -14 B   (-0.0%)
comments                                -103 B   (-0.0%)      -15 B   (-0.0%)
build-flow                              -103 B   (-0.0%)      -15 B   (-0.0%)
add-ons                                 -103 B   (-0.0%)      -14 B   (-0.0%)
activity                                -103 B   (-0.0%)      -14 B   (-0.0%)
notification-settings                    +77 B   (+0.0%)      +80 B   (+0.0%)
marketplace                              -77 B   (-0.0%)      +47 B   (+0.0%)
update-design-flow                       -56 B   (-0.0%)      -68 B   (-0.0%)
transferring-hosted-site-flow            -56 B   (-0.1%)      -40 B   (-0.1%)
start-writing-flow                       -56 B   (-0.2%)      -31 B   (-0.5%)
site-setup-wg                            -56 B   (-0.0%)      -36 B   (-0.1%)
site-setup-flow                          -56 B   (-0.0%)      -36 B   (-0.2%)
site-migration-flow                      -56 B   (-0.1%)      -40 B   (-0.2%)
readymade-template-flow                  -56 B   (-0.0%)      -38 B   (-0.1%)
performance-profiler                     -56 B   (-0.0%)      -32 B   (-0.0%)
newsletter-post-setup-flow               -56 B   (-0.0%)      -27 B   (-0.1%)
newsletter-flow                          -56 B   (-0.3%)      -30 B   (-0.5%)
migration-signup                         -56 B   (-0.1%)      -35 B   (-0.4%)
migration-flow                           -56 B   (-0.1%)      -40 B   (-0.3%)
link-in-bio-post-setup-flow              -56 B   (-0.0%)      -27 B   (-0.1%)
jetpack-cloud-manage-pricing             -56 B   (-0.0%)     -156 B   (-0.1%)
import-hosted-site-flow                  -56 B   (-0.0%)      -39 B   (-0.0%)
import-flow                              -56 B   (-0.1%)      -36 B   (-0.4%)
hundred-year-plan                        -56 B   (-0.2%)      -33 B   (-0.3%)
hundred-year-domain                      -56 B   (-0.1%)      -30 B   (-0.2%)
hosted-site-migration-flow               -56 B   (-0.1%)      -40 B   (-0.2%)
entrepreneur-flow                        -56 B   (-0.0%)      -44 B   (-0.2%)
domains                                  -56 B   (-0.0%)     +546 B   (+0.1%)
design-first-flow                        -56 B   (-0.2%)      -29 B   (-0.5%)
copy-site-flow                           -56 B   (-0.0%)      -36 B   (-0.0%)
assembler-first-flow                     -56 B   (-0.1%)      -36 B   (-0.2%)
ai-assembler-flow                        -56 B   (-0.1%)      -35 B   (-0.2%)
a8c-for-agencies-team                    -56 B   (-0.0%)      -37 B   (-0.0%)
a8c-for-agencies-referrals               -56 B   (-0.0%)      -37 B   (-0.0%)
a8c-for-agencies-purchases               -56 B   (-0.0%)      -55 B   (-0.0%)
a8c-for-agencies-overview                -56 B   (-0.0%)      -37 B   (-0.0%)
a8c-for-agencies-migrations              -56 B   (-0.0%)      -37 B   (-0.0%)
a8c-for-agencies-marketplace             -56 B   (-0.0%)      -35 B   (-0.0%)
a8c-for-agencies-client                  -56 B   (-0.0%)      -57 B   (-0.0%)
privacy                                  -26 B   (-0.0%)     +225 B   (+0.1%)
me                                       -26 B   (-0.0%)     +323 B   (+0.2%)
developer                                -26 B   (-0.0%)     +225 B   (+0.1%)
account-close                            -26 B   (-0.0%)     +171 B   (+0.1%)

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

Async-loaded Components (~1546 bytes added 📈 [gzipped])

name                                                                              parsed_size           gzip_size
async-load-design-blocks                                                               -159 B  (-0.0%)      -51 B  (-0.0%)
async-load-signup-steps-site-picker                                                    -103 B  (-0.1%)      -15 B  (-0.0%)
async-load-signup-steps-difm-site-picker                                               -103 B  (-0.1%)      -15 B  (-0.0%)
async-load-design-playground                                                           -103 B  (-0.0%)      -15 B  (-0.0%)
async-load-design                                                                      -103 B  (-0.0%)      -15 B  (-0.0%)
async-load-calypso-components-sites-popover                                            -103 B  (-0.1%)      -15 B  (-0.0%)
async-load-signup-steps-page-picker                                                     -56 B  (-0.0%)      -21 B  (-0.0%)
async-load-signup-steps-initial-intent                                                  -56 B  (-0.1%)      -36 B  (-0.1%)
async-load-signup-steps-courses                                                         -56 B  (-0.2%)      -17 B  (-0.2%)
async-load-purchase-modal-wrapper                                                       -56 B  (-0.0%)      -23 B  (-0.0%)
async-load-my-sites-checkout-purchase-modal-is-eligible-for-one-click-checkou...        -56 B  (-0.0%)      -22 B  (-0.0%)
async-load-masterbar-launchpad-navigator                                                -56 B  (-0.1%)      -38 B  (-0.2%)
async-load-calypso-layout-command-palette                                               -56 B  (-0.0%)      -24 B  (-0.0%)
async-load-calypso-jetpack-cloud-sections-sidebar-navigation-manage-selected-...        -56 B  (-0.0%)      -35 B  (-0.1%)
async-load-calypso-blocks-jitm-templates-home-task                                      -56 B  (-0.1%)      -30 B  (-0.2%)
async-load-automattic-whats-new                                                         -56 B  (-0.2%)      -38 B  (-0.3%)
async-load-calypso-my-sites-checkout-modal                                              -52 B  (-0.0%)     -221 B  (-0.1%)
async-load-calypso-blocks-editor-checkout-modal                                         -52 B  (-0.0%)     -342 B  (-0.1%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

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.

@matticbot
Copy link
Contributor

matticbot commented Dec 19, 2024

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

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

  • blaze-dashboard
  • odyssey-stats

To test WordPress.com changes, run install-plugin.sh $pluginSlug purchases-billing-history-dataview on your sandbox.

@billrobbins billrobbins changed the title WIP: Use DataViews component to render Billing History list Use DataViews component to render Billing History list Jan 3, 2025
@@ -29,7 +31,7 @@ export default function PurchasesNavigation( { section } ) {
</NavItem>
</NavTabs>

{ section === 'billingHistory' && (
{ section === 'billingHistory' && ! useDataViewBillingHistoryList && (
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 supplies its own search field so we need to exclude the one from the current purchase navigation screen.

@billrobbins billrobbins marked this pull request as ready for review January 9, 2025 20:41
@billrobbins billrobbins requested a review from a team as a code owner January 9, 2025 20:41
@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 Jan 9, 2025
Copy link
Member

@sirbrillig sirbrillig left a comment

Choose a reason for hiding this comment

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

This looks good! Nice work figuring this out. I have some more review to do but I figured I'd give you some things to start with.

Copy link
Member

@sirbrillig sirbrillig left a comment

Choose a reason for hiding this comment

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

Nice changes! I am especially impressed by the use of native date formatting! 👏 Just a couple more things I saw.

Copy link
Member

@sirbrillig sirbrillig left a comment

Choose a reason for hiding this comment

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

Everything works as described!

The code looks good to me and I appreciate the tests for the pagination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants