VideoPress: restructure upgrade notice as Title + Description + ActionButton#49400
Conversation
…y Button The ContextualUpgradeTrigger migration to a @wordpress/ui Notice (#48909) rendered its CTA via Notice.ActionButton, which base-ui styles as a dark/high-contrast button that looks out of place on the VideoPress admin page. Swap it for the standard primary Button already imported from @automattic/jetpack-components, restoring the primary CTA the legacy trigger rendered. The click handler is unchanged, so the jetpack_videopress_upgrade_trigger_link_click Tracks event and the checkout 'run' workflow both still fire. The Notice container and the always-rendered Notice.Description (VIDP-245 base-ui ref-merge invariant) are preserved.
|
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! |
Code Coverage SummaryCoverage changed in 1 file.
|
|
@keoshi any preference between the ActionLink and ActionButton options? (see PR description screenshots) |
|
Thanks for the ping, @CGastrell ! In this scenario the button clearly indicates a path forward IMHO. The action seems very clear when compared to the long link, so that would be my preference. |
|
Recommend using title + description for the two lines separately to keep it more balanced visually: <Notice>
<Title>
Notice Title
</Title>
<Description>
Description text.
</Description>
<Actions>
<ActionButton>
CTA
</ActionButton>
</Actions>
</Notice>Meanwhile this looks to be another case needing WordPress/gutenberg#77098 instead of workarounds. :-) |
…nButton Per PR #49400 review (keoshi, simison): replace the long text-link CTA with a concise "Upgrade" Notice.ActionButton, and split the notice copy into two balanced lines — a Notice.Title contextual heads-up and a Notice.Description upsell pitch — following simison's structure example. ActionButton takes onClick directly, so the prior ActionLink href="#" + preventDefault workaround (gutenberg#77098) is dropped entirely. VIDP-245 invariant preserved: Title, Description and Actions are all rendered unconditionally; only the title text varies on hasUsedVideo, keeping the Notice.Root subtree shape stable so base-ui's ref-merge hook does not misalign and crash on the next video upload/delete.

Fixes the upgrade-notice CTA styling regression reported by @obenland on #48909 (comment).
Proposed changes
ContextualUpgradeTriggeron the VideoPress admin page to a@wordpress/uiNotice, rendering the CTA via<Notice.ActionButton>. base-ui styles that as a dark/high-contrast (black) button, which "looks quite out of place" on the page.Notice.Titleplus aNotice.Description— followed byNotice.Actions>Notice.ActionButton. This PR adopts exactly that structure.<Notice.Title>— a contextual heads-up line. Before the first upload it reads "The free plan includes one video upload."; after a video has been uploaded it reads "You have used your free video upload". It is always non-empty.<Notice.Description>— the constant upsell pitch: "Unlock unlimited videos, 1TB of storage, and more!".<Notice.Actions>><Notice.ActionButton>— a concise "Upgrade" button.Notice.ActionButtontakesonClickdirectly, the previousNotice.ActionLinkhref="#"+event.preventDefault()workaround (the gutenberg#77098 anchor-navigation hack) is dropped entirely.Noticecontainer migration from Componentry: migrate ContextualUpgradeTrigger to @wordpress/ui Notice #48909 is not reverted — only the action element and copy structure change.<Notice.Root intent="info" className={ styles[ 'upgrade-trigger' ] }> - <Notice.Description> - { hasUsedVideo && ( <>{ UPGRADE_TRIGGER_USED_VIDEO_TEXT }<br /></> ) } - { UPGRADE_TRIGGER_UNLOCK_TEXT } - </Notice.Description> - <Notice.Actions> - <Notice.ActionLink href="#" onClick={ e => { e.preventDefault(); onButtonClickHandler(); } }> - { cta } - </Notice.ActionLink> - </Notice.Actions> + <Notice.Title>{ title }</Notice.Title> + <Notice.Description>{ UPGRADE_TRIGGER_UNLOCK_TEXT }</Notice.Description> + <Notice.Actions> + <Notice.ActionButton onClick={ onButtonClickHandler }>{ cta }</Notice.ActionButton> + </Notice.Actions> </Notice.Root>VIDP-245 invariant
base-ui@1.4.1's
useRenderElementswaps ref-merge hooks based on theNotice.Rootsubtree shape; conditionally mounting/unmounting aNoticesubcomponent across thehasUsedVideoflip misaligns a stored fork-ref and crashes on the next video upload/delete. SoNotice.Title,Notice.DescriptionandNotice.Actionsare all rendered unconditionally — only thetitletext varies via a ternary, keeping the subtree shape stable.Related product discussion/links
Does this pull request change what data or activity we track or use?
No. The click handler still records the
jetpack_videopress_upgrade_trigger_link_clickTracks event and still invokes the checkoutrunworkflow. The wiringrecordEventHandler( 'jetpack_videopress_upgrade_trigger_link_click', run )is unchanged;Notice.ActionButtonnow receives that handler directly asonClick(no anchor, nopreventDefault). Verified in the compiledbuild/admin/index.jsbundle:Notice.ActionButtonis rendered withonClick: onButtonClickHandler, andonButtonClickHandler = recordEventHandler('jetpack_videopress_upgrade_trigger_link_click', run)is intact.Testing instructions
The upgrade notice only renders when there is no VideoPress purchase (
hasVideoPressPurchase === false). On a site with a VideoPress subscription, remove/cancel it first so the free-tier upgrade notice appears./wp-admin/admin.php?page=jetpack-videopress).Notice.Titleheads-up ("The free plan includes one video upload." before any upload) and aNotice.Descriptionpitch ("Unlock unlimited videos, 1TB of storage, and more!") — followed by a concise "Upgrade" button (not a black button and not a filled primary button).jetpack_videopress_upgrade_trigger_link_clickTracks event still fires.Notice.Title/Notice.Description/Notice.Actionsinvariant is intact).