Commit 07988cb
Stats: modernize the VideoPress video details page (Automattic#112499)
* Stats: split video details into a dedicated page modeled on post details
Move the videodetails module out of the summary switch into its own
stats-video-detail page component, keeping the existing URL. Adds a
video details header card (title, published date, thumbnail linking to
the media library) and the shared stats breadcrumb trail.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: add period navigation to the video details chart
Replace the old single-metric StatsVideoSummary with a VideoSummary
section modeled on stats-post-summary: a date label with previous/next
arrows and a Days/Weeks/Months/Years segmented control driving the
statsVideo query. Daily data is paged 30 bars at a time like the post
chart. Removes the now-unused stats-video-summary component.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: add metric highlight tabs to the video details chart
Fetch all four statsVideo series (views, impressions, watch time,
retention rate) and render them as selectable cards below the chart,
matching the post details layout from the JA designs. Card totals are
computed over the dates visible in the chart; retention rate uses a
views-weighted average. The chart's statType now lives in page state,
seeded from the statType query param so existing links keep working.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: modernize the video details Embedded pages module
Replace the legacy StatModuleVideoDetails list with an Embedded pages
card matching the rest of the redesigned video details page. Pages
still display as URLs since the stats/video endpoint only returns embed
URLs; showing post titles needs the API to return post IDs/titles.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: zero-fill the video details chart series
The stats/video endpoint only returns buckets from the video's first
activity onwards, so a young video yields one or two bars, which the
is-chart-tabs layout (max-width bars + space-between) then scatters
away from the axis labels. Fill gaps between buckets, extend the day
view backwards to a full 30-bar window per the designs, and add the
has-less-than-three-bars fallback class used by the traffic chart.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: align the video details chart with the real stats/video semantics
A backend investigation confirmed stats/video/:id treats period as a
fixed trailing-window selector (day yields only 2 daily buckets, year
yields ~13 monthly buckets) rather than a bucket granularity, and that
its statType only recognizes watch_time and impressions — views falls
back to the plays column and there is no retention series at all.
Rework the summary accordingly: fetch the 30-day daily window for the
Days/Weeks views and the 365-day monthly window for Months/Years, and
aggregate buckets client-side. Views now covers the same 30-day window
and plays metric as the Traffic Videos module and the All videos page.
Retention rate is derived per bucket and in total with the canonical
complete_stats formula, (watch time / plays) / video duration, using
the media item duration — replacing the bogus fourth query whose
response was silently the plays series. Also harden the statsVideo
normalizer against the endpoint's empty-window response shape, and drop
the now-unneeded zero-fill and paging logic.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: trim the video details daily window to the trailing 30 days
The stats/video endpoint's month window spans 31 days inclusive, one
more than the 30-day window the Videos module and All videos page show,
so the Views total was off by the oldest day's plays.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: keep video chart month labels on one line
The chart's x-axis labels have a fixed 42px width, so 'MMM YYYY' wraps
and collides with the metric cards below. Show 'MMM' like the legacy
year view did — the full month and year remain in the bar tooltip and
the date heading — and key bar selection by startDate since bare month
labels can repeat within a 13-month window.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: bucket video weekly stats Monday-based to match the date heading
The date heading (stats-date-label) renders weeks Monday-Sunday, while
the weekly aggregation grouped by the locale's week start (Sunday in
en), so a selected bar's tooltip range was one day off from the
heading. Group by isoWeek, which matches the heading's convention on
every Monday key regardless of locale. Also center capped chart bars in
their slots (space-around) so bars line up with the mathematically
positioned x-axis labels when there are only a few buckets.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: show full month-year video chart labels like post details
Restore the 'MMM YYYY' month labels — the post details chart uses the
same format and its second wrapped line is absorbed by the spacing
below the chart, so match that spacing above the metric cards instead
of shortening the label.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: stretch the video details header and embeds cards to full width
The Card base carries margin: 0 auto; inside the page's flex column the
auto inline margins shrink-to-fit and center the card instead of
letting align-items: stretch apply, so the header and embeds cards
rendered narrower than the chart section between them.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: track the video details screen in the stats navigation history
recordCurrentScreen silently ignores screens missing from
possibleBackLinks, and videodetails was never registered (a gap dating
back to the summary-page implementation), so the breadcrumb trail
treated the previous screen as current and dropped the Videos crumb —
or showed only the Stats root on direct entry. Register videodetails
like postDetails (tracked, never rendered as a crumb) and record it in
a layout effect so it lands in the history before the breadcrumb-trail
hook's passive effect reads it.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: address review feedback on the video details page
Include watch-time bucket keys in the chart bucket union, treat missing
embeds data as loading so the empty state doesn't flash before the
deferred request starts, and cover the statsVideo normalizer's
empty-window response shapes with unit tests.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: degrade the video details page gracefully in Odyssey Stats
The Odyssey stats-app proxy (Jetpack stats-admin REST controller) has
no media or settings routes, so those requests 404 in wp-admin. Gate
the shared stats shell's QuerySiteSettings the same way as
QuerySiteFeatures (the request 404s on every Odyssey stats page today),
and hide the video details header card in Odyssey while its media item
is unavailable instead of showing a loading state forever. The media
request is still made, so the card and the derived retention rate light
up automatically once the proxy learns the media route.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: drop the video details page's hard dependency on the media API
The header card and the retention rate metric both required the media
item (title, date, thumbnail, and duration), but the Odyssey stats-app
proxy has no media route, leaving the page degraded in wp-admin until a
Jetpack release ships one. Remove the header card and the retention
card/series so the page works identically everywhere, and keep the
media request only as a best-effort enhancement for the breadcrumb
title (matching the legacy page), falling back to a static label.
Revert this commit to restore both once Automattic/jetpack#50412 (or
the retention series from STATS-312) is available.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: render video details media-derived UI only when the data exists
Restore the header card and the Retention rate card, but field-adaptive
instead of hard-required: the header card renders once the media item
loads (never in Odyssey until its proxy has a media route), the date
and thumbnail only when present, and the Retention rate card and series
only when the video duration is available — the metric row divides
evenly whether three or four cards render. The breadcrumb keeps the
media title with a static fallback.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: drop the thumbnail from the video details header card
The VideoPress poster comes in arbitrary aspect ratios and sizes, which
the card layout handled poorly; keep the card to the title and
published date.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: source the video title and upload date from the statsVideo post
The stats/video/:id response includes the video's attachment post, so
the breadcrumb and header card can take the title and published date
from data the page already fetches — and since the Odyssey stats-app
proxy forwards stats routes, both now work in wp-admin too. The media
item is only consulted as a fallback and for the video duration
(retention rate), which remains adaptive.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: polish the video details layout
Pin the period switcher to the right edge when the period header wraps
on narrow widths, add breathing room between the header and the chart,
and stretch the metric cards to the row height so they stay uniform
when a label or value wraps inside one of them.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: remove the video details retention rate card
The retention rate needs the video duration, which only exists on the
media item — unavailable in Odyssey Stats where the stats-app proxy has
no media route. Drop the card and its derived series for now; it can
return once the backend provides a retention series (STATS-312) or the
proxy learns a media route (Automattic/jetpack#50412).
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: avoid flashing the video chart empty state when switching windows
QuerySiteStats defers its initial request, so on the first render after
switching to the Months/Years window the requesting flag is still false
while the data is missing, and the chart briefly rendered its empty
state — resizing the layout — before the fetch started. Treat a
missing selected series as loading, matching the embeds card.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: stop the video chart and metric cards from shifting layout
Nothing hides the chart while StatsModulePlaceholder shows inside
.is-summary-chart (the .is-chart-tabs.is-loading rule targets the outer
wrapper), so during loading the placeholder and the empty chart stacked
to double height and the page jumped when data arrived — pin the
section height and hide the chart while loading. Also lay the metric
cards out with a fixed-column grid: the 50%-minus-gap flex basis could
round past 100% and wrap cards one per row.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: stack video metric cards one per row on small screens
The single-column rule still targeted the old flex layout
(flex-basis has no effect on grid items), so narrow viewports kept two
columns.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: pad the video metric cards off the viewport edges on narrow screens
The page container only adds side padding above the medium breakpoint,
so the cards sat flush against the browser edge below it.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: truncate long breadcrumb labels with an ellipsis
The ellipsis rules on the current-crumb label never applied: each crumb
wraps in an unclassed span that is the actual flex item, so nothing let
the label shrink, and the label also lacked white-space: nowrap. Give
the wrapper a class with min-width: 0 and complete the truncation
rules — long video/post titles now ellipsize instead of overflowing.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: keep the header Jetpack logo from shrinking with long titles
The logo sits in JetpackTitle's HStack as a flex item with the default
flex-shrink: 1, so it compressed alongside a truncating breadcrumb
title; the previous pin targeted a logo inside the breadcrumbs nav,
where none renders.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: show exact zero and exact one hours watched on the video cards
'value > 1' rendered both 0 and exactly 1 as '< 1.0' — zero hours
reading as 'less than one' is misleading.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: zero out the video details heading margin for wp-admin
wp-admin core styles give h4 a 1.33em vertical margin in Odyssey Stats.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: restore the video details card loading placeholder
The card lost its shimmer when the title source moved to the statsVideo
response and started rendering nothing until data arrived, pushing the
chart down when it appeared. Reserve the card with shimmering
title/date lines while neither source has responded, and keep hiding it
only when the response confirms there is no title.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Stats: pin the embeds card heading margin for wp-admin
Same as the details card heading: wp-admin core styles give h4 a
1.33em vertical margin in Odyssey Stats.
Part of STATS-299.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 44095c7 commit 07988cb
16 files changed
Lines changed: 984 additions & 203 deletions
File tree
- client
- my-sites/stats
- components/stats-main
- hooks
- stats-summary
- stats-video-details
- stats-video-detail
- stats-video-summary
- summary
- state/stats/lists
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
| 142 | + | |
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
| |||
335 | 339 | | |
336 | 340 | | |
337 | 341 | | |
338 | | - | |
339 | | - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
340 | 357 | | |
341 | 358 | | |
342 | 359 | | |
| |||
356 | 373 | | |
357 | 374 | | |
358 | 375 | | |
359 | | - | |
360 | 376 | | |
361 | 377 | | |
362 | 378 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
| 162 | + | |
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
| |||
288 | 290 | | |
289 | 291 | | |
290 | 292 | | |
| 293 | + | |
291 | 294 | | |
292 | 295 | | |
293 | 296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
| 102 | + | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
0 commit comments