Repository navigation
Stats v2: Add thumbnails to the video lists - #53011
Conversation
|
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: 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. Videopress 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. Mu Wpcom plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Wpcomsh plugin:
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. |
Codex reviewNo correctness, security, accessibility, or contract issues were identified in the branch changes. |
|
@claude please review this PR. Get the change set with a single |
|
Claude finished @adamwoodnz's task in 1m 13s —— View job Review of PR #53011: video poster thumbnails
Verdict: I found no blocking issues. The change is small and well tested, and the poster markup is accessible. Below are a few things I checked and some optional nits. What I checked
Nits and suggestions (optional)
Not verified
|
Code Coverage SummaryCoverage changed in 2 files.
1 file is newly checked for coverage.
|
|
Responses to Claude's nits:
|
|
Review cycle summary
Status: clean. Ready for human review. |
Nikschavan
left a comment
There was a problem hiding this comment.
I left a few observations inline. None of them block this.
What I checked: I loaded the VideoPress widget and the Videos report from this branch on a site with real VideoPress posters. In the widget, the posters render at 50×28 inside each row link and open the video detail page. In the report, the poster boxes are 57×32 and the poster link stays out of the tab order. In Storybook, the null poster and the broken poster both fall back to the placeholder, and each row stays 36px tall.
| VideoPress widget | Videos report |
|---|---|
![]() |
![]() |
chihsuan
left a comment
There was a problem hiding this comment.
Thanks for adding the posters! @adamwoodnz Left a few inline notes, mainly on the report poster click.
c6a47e8 to
aae49d2
Compare
56fe1e0 to
22177e3
Compare
Add getVideoPosterUrl() to resolve safe video poster URLs resized by Photon. Later tasks call this from the VideoPress widget and the Videos report. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECZA3cSHSTyAFqwR9JXUU7
Video rows show a poster that opens the same detail page as the title. Extract VideoDetailLink so the Videos report can reuse the link. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECZA3cSHSTyAFqwR9JXUU7
Video rows now carry a resized, safety-checked poster as a 16:9 thumbnail inside the row link, with a placeholder when a video has none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECZA3cSHSTyAFqwR9JXUU7
Video posters now render at 16:9 and link to the video detail page. The thumbnail placeholder fills the media box so it stays centred in both square and 16:9 tables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECZA3cSHSTyAFqwR9JXUU7
Gives the mock the poster shapes the real API returns (URL, null for private, a URL that fails to load) and pins the default plays shape in the data layer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECZA3cSHSTyAFqwR9JXUU7
Corrects the leaderboard README, moves the videos fields styles to a plain CSS module so the build passes, and makes the poster tests exercise the real code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECZA3cSHSTyAFqwR9JXUU7
The Stats v2 dashboard ships in both plugins, so their users read about the change there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECZA3cSHSTyAFqwR9JXUU7
…533) The 16:9 thumbnail note made the table row too wide to line up; it now sits in a sentence under the table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECZA3cSHSTyAFqwR9JXUU7
A grey box gave no hint of what was missing, and the Videos report already draws the video icon there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECZA3cSHSTyAFqwR9JXUU7
… from VideoPress The Top videos widget moved to the VideoPress package, so it gets its own entry, the SDK declares the helper, and the Premium Analytics entry keeps only what that package ships. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECZA3cSHSTyAFqwR9JXUU7
The hand-built poster link sat under DataViews' media overlay, so clicking the poster did nothing. DataViews' renderItemLink wraps the poster and the title itself, the same way for every report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECZA3cSHSTyAFqwR9JXUU7
With media 'none' the test never reached the video-only branch, so dropping the videoLink check still passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECZA3cSHSTyAFqwR9JXUU7
CodeQL's dynamic workflow cannot be retried on an existing commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECZA3cSHSTyAFqwR9JXUU7
Trunk now asks each test to name a bug no other test catches. Drop the default-shape poster normalizer test (same parse path as the complete-stats one) and the poster-has-no-link test (no branch can add one). Stop re-testing safeHttpUrl's rejections in getVideoPosterUrl. Move the external-link children check down to VideoTitleLink, covering all three branches, and assert that the Videos page wires DataViews' row link: dropping renderItemLink left every test green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZjr8dPvykFAD46sUK54zL
At 50 × 28 the video poster looked heavy beside the flags and icons in the other leaderboards. Draw it at a flag's 21px height instead, and request the Top Videos poster at the new 2x size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZjr8dPvykFAD46sUK54zL
The header's square box cropped a video poster to its middle, and the leaderboard and Videos report now show the same poster at 16:9. Let SectionHeader widen its visual to 16:9 at the square's height, and use it on the video detail page in every state so the box keeps its shape while the video loads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZjr8dPvykFAD46sUK54zL
The Stats v2 prototype shows video thumbnails as squares, matching the Posts & Pages report, and marks the detail page's poster with a play icon. Drop the 16:9 boxes everywhere, add the icon overlay to the detail header, and request posters at twice the square sizes. A @wordpress/ui Link zeroes its border radius on hover, which squared the report's linked poster; the records table now restores DataViews' radius on its media links. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZjr8dPvykFAD46sUK54zL
9b3bf8e to
7d7526d
Compare


Fixes https://linear.app/a8c/issue/STATS-513
Why
In classic Stats, each video row starts with its thumbnail, so site owners can spot a video at a glance. Stats v2 showed no thumbnail in the VideoPress widget, and an unlinked one in the Videos report. Both lists now show the video's poster as a square, as the Stats v2 prototype does, and clicking it opens the video's detail page, like the title does. The detail page marks its poster with a play icon, also from the prototype.
Proposed changes
Builds on #52909 (merged), which moved the widget to the VideoPress package.
packages/videopress): each row shows the video's poster as a 28 × 28px square before its title, inside the same link. A video with no poster, or whose poster fails to load, shows a bordered placeholder with the video icon, so titles stay aligned. The prototype's widget shows no thumbnails; we keep them on purpose.isItemClickableandrenderItemLink, so DataViews links the poster and the title itself. Rows without a video ID are not clickable, and their title keeps the external page link.ReportRecordsTable: a@wordpress/uiLinkzeroesborder-radiuson hover, which squared the report's linked poster. The table restores DataViews' radius on media links, for every report that usesrenderItemLink.getVideoPosterUrlhelper (widgets-toolkit): checks the URL withsafeHttpUrland asks Photon for the poster at twice its drawn size. The report uses it in place of its local copy, and the SDK exports it for the widget.VideoTitleLinkgains achildrenslot, and the toolkit exportsInternalLink(from Premium Analytics: add shared internal and external link components to the widgets toolkit #53043) for the report's row link. Video leaderboard rows (videoLink) now render their media inside that link; before this change they dropped it.thumbnailmedia accepts afallbackIcon, drawn in place of the grey placeholder when there is no image or it fails to load. Thumbnails are held at 1:1, because the dashboard shell'simg { height: auto }overrides a fixed height and would draw a landscape poster short.nullposter (a private video) and one that fails to load.Private videos: the stats API returns
poster: nullfor them (STATS-412), so they show the placeholder without a failed request.Screenshots
Local site with two videos: "Osaka at night" has a poster; the other's poster does not load, so it shows the placeholder.
Top videos widget (VideoPress package)
Videos report
Video detail header
What a reviewer should check
rgba(0, 0, 0, 0.28), white), not WPDS tokens: they sit on a photo, not a themed surface, and WPDS has no scrim token.--wpds-color-stroke-surface-neutral; DataViews' report placeholder hard-codesrgba(0, 0, 0, 0.1), a shade lighter.isVideoRowClickable,VideoTitleLink, and the widget row builder. Merging them is left for a follow-up.picsum.photos. They are story-only and show placeholders when offline.Verification
widgets/top-videos). Typecheck, ESLint and stylelint pass, and both packages build./video/<id>.Related product discussion/links
posteronstats/video-plays)Does this pull request change what data or activity we track or use?
No.
Testing instructions
/reports/videos): posters are 32 × 32px squares and keep their rounded corners on hover. Clicking a poster opens the detail page with the same date range as the title. The poster and the title are separate tab stops, and the poster link is named after the title.🤖 Generated with Claude Code
https://claude.ai/code/session_01UZjr8dPvykFAD46sUK54zL