Premium Analytics: trim the period menu to the periods the design lists - #52124
Conversation
The menu carried three windows the date-selection design does not: Last 90 days, Last 365 days and Last year. #51835 called them out as the mirror of Month to date and Year to date — shipped without a design saying so — and left them "until that is settled". Settling them. Only the menu narrows. Each stays a selectable preset with its range and its chart interval, so a saved dashboard layout or a bookmark carrying one still resolves to the window it always did; the trigger reads past the menu to keep naming it, rather than falling back to bare dates. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015eDqAWndvFNBrBRdKcsYus
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
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! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Premium Analytics plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
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. 🤷 |
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015eDqAWndvFNBrBRdKcsYus
Follow-up to UNI-754 (#52087, #52088).
Proposed changes
The period menu carries three windows the date-selection design does not list: Last 90 days, Last 365 days and Last year. This drops them, leaving the menu exactly as designed:
(All time keeps its own group, offered only where a surface can anchor it — the post and video detail pages. The dashboard, which the design frame shows, never offered it.)
#51835 named these three as the mirror image of Month to date and Year to date: "Last 90 days and Last 365 days are the other way round: we ship them and the design does not list them, so they sit with the other rolling windows until that is settled." This settles them.
Only the menu narrows
Preset IDs are persisted — in the URL, and in saved dashboard widget layouts as
reportParams.preset. So each of the three stays a real preset: it keeps its entry inSELECTABLE_PRESETS, its range inPRESET_DEFINITIONS, and its chart-interval mapping ininterval.ts. OnlyMENU_SURFACE_PRESET_GROUPSloses them, which is what the menu renders from.That leaves one gap worth closing in the same change: the trigger looked its label up in the offered groups, so a bookmark carrying
preset=last-90-dayswould have started reading "Jun 11 – Sep 8" instead of "Last 90 days". It now reads past the menu viagetPresetLabel(), so a saved period still names itself even though it can no longer be picked. Covered by a test that fails without the fallback.Screenshots
A post detail page, opened on a URL whose
preset=last-90-days. The trigger still reads"Last 90 days" on both sides — that period is simply no longer in the list to pick.
Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Build the dashboard:
jetpack build --deps packages/premium-analytics, then open Premium Analytics (wp-admin/admin.php?page=jetpack-premium-analytics-wp-admin).pparam still carriespreset=last-90-days(orlast-365-days,last-year). The range resolves as before, the chart buckets as before, and the trigger still reads "Last 90 days" — it just isn't offered in the menu any more.pnpm run testinprojects/packages/premium-analyticspasses (3194 tests), as doespnpm run test-tz.🤖 Generated with Claude Code
https://claude.ai/code/session_015eDqAWndvFNBrBRdKcsYus