Add visual-card presentation for featured experiments#417
Add visual-card presentation for featured experiments#417jorgefilipecosta merged 22 commits intodevelopfrom
Conversation
|
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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #417 +/- ##
=============================================
+ Coverage 68.31% 68.36% +0.04%
- Complexity 812 813 +1
=============================================
Files 53 53
Lines 3939 3945 +6
=============================================
+ Hits 2691 2697 +6
Misses 1248 1248
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:
|
|
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). |
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.
Add the new getter methods to the Feature contract so PHPStan recognizes them when iterating features from the registry.
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.
c6b19b3 to
2e4308d
Compare
dkotter
left a comment
There was a problem hiding this comment.
Few things flagged here plus it looks like failing E2E and unit tests that need looked at
|
All feedback was applied and the CI is green |
Perhaps better then if I created a short GIF for that space instead? |
The assets/ directory was missing from the 'files' list in package.json, so wp-scripts plugin-zip was excluding assets/images/ from ai.zip. This broke the showcase image reference used by the visual-card presentation in Playground and installed-zip environments.
Not sure honestly. Whether a slightly different cropped image or maybe a gif (that can be annoying, though people aren't likely to spend much time on this screen). Or just leave as-is for now and see what feedback we get. It may just be me that thinks those buttons look clickable. |
|
Regarding the image, @annezazu also passed some feedback to me that the cropping on the image may not be ideal. I guess we may get some design help in the future to polish the visual assets. Happy to do apply any changes we could meanwhile, but I think we could merge the PR and then improve assets, changing assets is really simple is just replacing a file. |


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)