WOOA7S-1506: Port Stats Annual highlights widget#50155
Draft
kangzj wants to merge 2 commits into
Draft
Conversation
Add the Annual highlights Premium Analytics widget: a grid of metric tiles showing the most recent year's totals (posts, words, likes, comments, images), sourced from the useStatsInsights hook. The insights module is not period-scoped and has no comparison period, so tiles render bare counts. Includes the three-story Storybook template with a story-scoped apiFetch middleware mocking the stats/insights endpoint (not covered by the shared report mocks).
Contributor
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryThis 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. 🤷 |
…ts mock Rename the widget CSS module to the post-#50112 style.module.css convention and update the import. Replace the story-scoped apiFetch middleware with a central stats/insights handler in routeStatsReport() backed by a data/insights.ts fixture, matching the search-terms reference. Drop the now-unused api-fetch devDependency.
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes WOOA7S-1506
Proposed changes
jpa/annual-highlights).useStatsInsightsdata hook. Each tile is a<Text>label plusMetricWithComparison(value only,useMultipliers/decimals: 0).WidgetRootstill receives hostattributesso injectedreportParamsare preserved.Default,WithComparison,WidgetDashboardWithWidget) withregisterReportMocks()plus a story-scopedapiFetchmiddleware mockingstats/insights(not covered by the shared report mocks).WithComparisonrenders identically toDefaultby design, and the story docs note this.packages/data,packages/widgets-toolkit,@automattic/charts, orprojects.js(the widgets root was already registered).Related product discussion/links
Does this pull request change what data or activity we track or use?
No. It surfaces existing Jetpack Stats insights data already fetched through the
useStatsInsightshook; no new tracking.Testing instructions
Default,WithComparison, andWidgetDashboardWithWidgetall render a populated grid of year totals./widget-audit annual-highlights(clean),eslint(clean),stylelint(clean),tsc --noEmit(0 errors),jetpack build packages/premium-analytics --deps(success).