Add visual-card presentation for featured experiments#417
Add visual-card presentation for featured experiments#417jorgefilipecosta wants to merge 12 commits intodevelopfrom
Conversation
Extend the feature metadata system to support a presentation style and image URL. Features can now declare themselves as 'visual-card' in load_metadata(), following the same pattern as label, description, and category.
Set presentation to 'visual-card' with image URLs in the load_metadata() of both experiments so they render as showcase cards on the settings page.
Include the feature presentation style and image URL in the data sent to the settings page script module so the frontend can render visual-card experiments differently.
Add the image generation screenshot and a placeholder SVG for title generation used by the visual-card presentation on the settings page.
Add presentation and image fields to the FeatureData interface and update parseFeature() to extract them from the server-provided data.
Create a custom DataForm Edit component that renders visual-card experiments as cards with image, title, description, enable/disable button, and a green enabled-state badge. The component reads the global AI toggle from the data to handle the disabled state.
Assign VisualCardToggle as the Edit component for visual-card features and separate them into a showcase section using DataForm row layout to render cards side-by-side (2 per row). Non-visual-card features continue in their regular category sections.
Style the visual-card presentation with image area, content section, action buttons with enabled-state badge, and a disabled state for when AI is globally turned off.
|
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 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. |
Add the new getter methods to the Feature contract so PHPStan recognizes them when iterating features from the registry.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #417 +/- ##
=============================================
+ Coverage 65.75% 65.85% +0.10%
- Complexity 763 766 +3
=============================================
Files 53 53
Lines 3863 3878 +15
=============================================
+ Hits 2540 2554 +14
- Misses 1323 1324 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Apply prettier auto-fixes for import grouping and JSX formatting.
…tation - Remove VISUAL_CARD_SETTING_NAMES Set; use VISUAL_CARD_FEATURES.has() directly since Map.has() is already O(1) - Sanitize image URL with esc_url() in bootstrap metadata for defense-in-depth consistency - Validate presentation value against allowed values in the Abstract_Feature constructor, falling back to 'toggle' for unrecognized values
Use an inline SVG for the check icon to avoid a false positive from the import/no-extraneous-dependencies lint rule in the routes/ directory.
| /** | ||
| * The presentation style for the settings UI. | ||
| * | ||
| * @since x.x.x | ||
| * @var string 'toggle' (default) or 'visual-card'. | ||
| */ | ||
| protected string $presentation; |
There was a problem hiding this comment.
I've not reviewed the rest of the PR yet but I don't think we need to introduce a new argument here to control this. The plan is that any non-experimental Feature should be showcased in this new UI and not in the toggle list below. We haven't "promoted" anything to be non-experimental yet (I have a PR that I'll open soon that does that for Image Generation) but the main thing that controls that is the existing $stability argument. Right now that is set to experimental for all existing Features but for "promoted" Features, that will be set to stable. I'd suggest we use that to determine the UI
There was a problem hiding this comment.
Note I've opened #418 which brings Image Generation from an experimental Feature to a stable Feature. It does not touch any of the UI though as I'm leaving that for this PR. So these two PRs will go hand-in-hand
There was a problem hiding this comment.
Sounds good @dkotter, I will review your PR, and then update this one to use the mechanism we land on yours to specify a feature is stable.
|
Noting we'll want to get a Proposal issue opened for Title Gen if we want to elevate that to a Feature from an Experiment (cc: @Jameswlepage @felixarntz). |
Summary
presentationandimagefields so experiments can declare a visual card layout inload_metadata()visual-cardpresentation with showcase imagesScreenshot
Test plan
options-general.php?page=ai-wp-admin)