Skip to content

Premium Analytics: add the shared report-page framework components#50170

Draft
Nikschavan wants to merge 1 commit into
trunkfrom
add/wooa7s-1620-traffic-module-report-pages
Draft

Premium Analytics: add the shared report-page framework components#50170
Nikschavan wants to merge 1 commit into
trunkfrom
add/wooa7s-1620-traffic-module-report-pages

Conversation

@Nikschavan

@Nikschavan Nikschavan commented Jul 2, 2026

Copy link
Copy Markdown
Member

Part of WOOA7S-1614 / WOOA7S-1620

Proposed changes

Add the widgets-toolkit primitives that every second-level "view all" report page composes. A module report page is assembled by passing its data hook results and DataViews field config — composition, not a bespoke page per module (see the folder README for the usage sketch).

  • ReportPageLayout + ReportPageSection — the page scaffold: breadcrumbs/description/actions slots, an optional internal-tabs slot, a filters row, and bordered section cards.
  • ReportPerformanceChart — the performance chart section: metrics drawn via ComparativeLineChart, a metric show/hide menu, the day/week/month interval selector (owned by the page — it changes the query), a collapse toggle, and a dashed previous-period overlay when a single metric is visible (buildReportMetricSeries, unit-tested). It imports @automattic/charts/style.css itself: widgets get those styles through WidgetRoot, report pages render charts without one — without the stylesheet the chart's layout constraints are missing and the svg grows unbounded.
  • ReportRecordsTable — a Core DataViews table (first real DataViews use in the package) over the module's rows: search, sortable + configurable columns, and pagination run client-side via filterSortAndPaginate. Seeds view.fields (DataViews renders no columns otherwise) and includes the CSS to embed DataViews in an auto-height card (its layout container is a zero-basis flex child built for fixed-height parents).

Components receive data as props — pages own the hooks and the reportParams derived from the URL. Also exports IntervalType from the data package root.

The first consumer (the Posts & Pages report page, WOOA7S-1620) is stacked on this PR: #50171

Related product discussion/links

Out of scope, tracked separately: the Download/CSV action (no Stats export path exists yet) and additional per-post metrics columns (needs new WPCOM data).

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  • Build Storybook (cd projects/js-packages/storybook && pnpm run storybook:dev) and open Packages/Premium Analytics/Widgets Toolkit/Components/ReportPage.
  • The composed story mirrors the report-page design: breadcrumb header, filters row, the performance chart (toggle metrics via the ⋮ menu, switch By days/weeks/months, Hide chart), and the DataViews table (search, column config via the gear, sort by views, pagination).
  • pnpm run typecheck, pnpm run test (includes the buildReportMetricSeries suite), eslint/stylelint on the changed files — all clean.
  • For an end-to-end check in wp-admin, use the stacked Posts & Pages page PR.

Add the widgets-toolkit primitives every second-level module report page
composes (WOOA7S-1614 / WOOA7S-1620):

- ReportPageLayout + ReportPageSection: breadcrumb header with actions
  slot, optional internal tabs, filters row, and bordered section cards.
- ReportPerformanceChart: the multi-metric visits chart (Views, Visitors,
  Comments, Likes) with a metric show/hide menu, the page-owned
  day/week/month interval selector, a collapse toggle, and a dashed
  previous-period overlay when a single metric is visible.
- ReportRecordsTable: a Core DataViews table over the module's summarized
  rows; search, sorting, column config, and pagination run client-side
  via filterSortAndPaginate.

Components receive data as props; pages own the hooks and reportParams.
Also exports IntervalType from the data package root.
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jul 2, 2026
@jp-launch-control

Copy link
Copy Markdown

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs [Package] Premium Analytics [Status] In Progress [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant