Introduce On This Day widget#78248
Conversation
extends tsconfig.base.json and registers the project in root references so widget sources are type-checked.
declares clsx and @wordpress/* deps so the widget sources satisfy import/no-extraneous-dependencies.
Filters /wp/v2/posts by month and day across all years; gated under gutenberg-dashboard-widgets.
Surfaces a published post resolved by a time range preset, with an optional featured image background and a configurable filter effect.
bugs, homepage, keywords, publishConfig, repository fields required by package.json lint rules.
Parametrize WidgetTypeMetadata and WidgetType over the widget's attribute object (Item). Add WidgetRenderProps. Promote the widget-types module to a composite TS project so consumers in other compilation units can reference it cleanly.
Bind WidgetTypeMetadata over the local OnThisDayWidgetType in widget.ts and WidgetRenderProps over OnThisDayAttributes in render.tsx. Add widget-types as a TS project reference so the import resolves cleanly without polluting the source tree.
Hints the surface to render this widget edge-to-edge so the featured image background fills the tile. Fill the tile height via `height: 100%` so the layout follows.
Setting `composite: false` + `noEmit: true` prevents tsc from writing declarations into `widgets/build-types/`, which wp-build was scanning as if it were a widget directory. The widgets root is a leaf consumer: no other project references it, so it does not need to be composite to reference upstream projects.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @Copilot. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: 0 B Total Size: 7.98 MB ℹ️ View Unchanged
|
|
Flaky tests detected in 7a03115. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/26209290004
|
keeps header contrast consistent on any image background
…nberg into update/on-this-day-widget
|
@copilot resolve the merge conflicts in this pull request |
…idget # Conflicts: # routes/dashboard/widget-dashboard/components/widget-chrome/widget-chrome.tsx Co-authored-by: retrofox <77539+retrofox@users.noreply.github.com>
Done. The only conflict was a trivial blank line in |
What?
Adds the "On This Day" dashboard widget: a full-bleed tile showing a published post resolved by a configurable time range (one/five/ten years ago, oldest on this day across years, or a custom date).
The featured image fills the tile and the chrome stays visible only in the accessibility tree.
Also adds an
on_this_day=MM-DDREST parameter on the posts collection that selects posts published on the given month and day regardless of year.Design discussion: #74936. Part of #77616.
Why?
The dashboard needs at least one widget that exercises the framework end-to-end (full-bleed presentation, typed attributes, REST contracts, build pipeline). On This Day touches all of those in a shippable surface.
It also gives the user a small recirculation loop: a post from the archive surfaces on every dashboard load, anchored to the calendar day or a user-chosen offset.
How?
REST.
lib/experimental/on-this-day/on-this-day.phpadvertiseson_this_dayon the posts collection schema and translates the value into aWP_Querydate_queryclause (month + day, ignoring year). Pattern-validated at the schema level (^(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$); the filter is a defensive guard.Widget metadata.
widgets/on-this-day/widget.tsdeclares the attributes (time range preset, custom date, background filter preset) using the typedWidgetTypeMetadata< OnThisDayWidgetType >shape introduced in #78247.Render.
widgets/on-this-day/render.tsxis a thin component that delegates toOnThisDayViewand consumes the typedWidgetRenderProps< OnThisDayAttributes >. The view renders the post on top of the featured image, with a clean empty state and a CTA when no post matches the day.Presentation.
widget.jsondeclares"presentation": "full-bleed"(consumed via #78209); the widget chrome translates that into edge-to-edge rendering.Testing
update/on-this-day-widget, runnpm install && npm run build && npm run wp-env start.Screen.Recording.2026-05-15.at.11.27.28.AM.mov
REST sanity check:
/wp-json/wp/v2/posts?on_this_day=05-13returns posts published on May 13 of any year. Invalid patterns (e.g.,13-99) are rejected by the schema.Dependencies
This PR cannot merge until all of the following land on trunk:
widgets/TypeScript scaffoldingFollow-ups