Skip to content

Conversation

@gmjuhasz
Copy link
Contributor

@gmjuhasz gmjuhasz commented Nov 25, 2025

Fixes https://linear.app/a8c/issue/SOCIAL-237/image-ui-create-the-image-view-ui-along-with-the-buttons

Sits on top of #46100

Proposed changes:

Adds a new unified media selection UI for social posts with the following features:

New NewMediaSection component

  • Media source detection: Automatically detects and displays the current media source with priority order:
    1. Attached media (uploaded images/videos)
    2. Social Image Generator (SIG)
    3. Featured Image
  • Dropdown menu: Allows switching between media sources (Featured Image, SIG template, Media Library)
  • Media preview: Shows image/video preview with loading states for SIG
  • Replace/Remove actions: Buttons to replace media via the dropdown or remove media entirely
  • Analytics tracking: Records events when media source changes

Supporting components

  • MediaSourceMenu: Dropdown component for selecting media sources
  • MediaPreview: Preview component with action buttons for images and videos

Hook improvements

  • Enhanced updateJetpackSocialOptions in usePostMeta to support batch updates, preventing race conditions when updating multiple options simultaneously (e.g., clearing attached media while toggling SIG)

Testing instructions:

Quickly check that with this PR and without the feature flag, you still see the old UI and it works as before.

Add the feature flag to your site: Run wpsh > add_blog_sticker( 'jetpack-social-unified-ui-v1', null, null, <your-blog-id> );

NOTE: Video upload is not hooked up currently

  1. Go to a post editor with Jetpack Social enabled
  2. Look for the new "Media" section in the Social sidebar
  3. Test switching between:
    • Featured Image (should show post's featured image)
    • Social Image Generator (should show SIG preview with loading state)
    • Media Library (should open media picker)
  4. Test the "Replace" button opens the source dropdown
  5. Test the "Remove" button clears the media selection
  6. Verify switching between sources works without glitches (no race conditions)

Source types

No image Featured image SIG Custom image
CleanShot 2025-11-27 at 17 32 47@2x CleanShot 2025-11-27 at 17 32 52@2x CleanShot 2025-11-27 at 17 32 58@2x CleanShot 2025-11-27 at 17 33 10@2x

Dropdown

CleanShot 2025-11-27 at 17 34 39@2x

Overlay menu

CleanShot 2025-11-27 at 17 36 28@2x

Edit template button

CleanShot 2025-12-01 at 11 26 43@2x

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Does this pull request change what data or activity we track or use?

Yes - adds analytics events:

  • jetpack_social_media_source_changed - when user switches media source
  • jetpack_social_media_removed - when user removes media

@gmjuhasz gmjuhasz self-assigned this Nov 25, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the add/social/new-media-selector-ui branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/social/new-media-selector-ui

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Feature] Publicize Now Jetpack Social, auto-sharing [JS Package] Publicize Components [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Social Issues about the Jetpack Social plugin [Status] In Progress RNA labels Nov 25, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Social plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Nov 25, 2025
@jp-launch-control
Copy link

jp-launch-control bot commented Nov 25, 2025

Code Coverage Summary

Coverage changed in 2 files.

File Coverage Δ% Δ Uncovered
projects/js-packages/publicize-components/src/hooks/use-post-meta/index.js 23/24 (95.83%) 0.38% 0 💚
projects/packages/publicize/src/class-publicize-base.php 210/609 (34.48%) 0.43% 0 💚

5 files are newly checked for coverage.

File Coverage
projects/js-packages/publicize-components/src/components/media-section-v2/index.tsx 46/61 (75.41%) 💚
projects/js-packages/publicize-components/src/components/media-section-v2/media-source-menu.tsx 23/24 (95.83%) 💚
projects/js-packages/publicize-components/src/components/media-section-v2/custom-media-toggle.tsx 4/4 (100.00%) 💚
projects/js-packages/publicize-components/src/components/media-section-v2/media-preview.tsx 3/3 (100.00%) 💚
projects/js-packages/publicize-components/src/components/media-section-v2/types.ts 0/0 (—%) 🤷

Full summary · PHP report · JS report

@gmjuhasz gmjuhasz added the [Type] Feature Development of a new feature label Nov 25, 2025
@gmjuhasz gmjuhasz force-pushed the add/social/new-media-selector-ui branch from bfa083a to 6df34c2 Compare November 26, 2025 10:01
@gmjuhasz gmjuhasz changed the base branch from trunk to add/social/sig-preview-hook November 26, 2025 10:01
Base automatically changed from add/social/sig-preview-hook to trunk November 26, 2025 14:47
@gmjuhasz gmjuhasz changed the title [DRAFT] Social: Add the new media selection UI Social: Add the new media selection UI Nov 27, 2025
@gmjuhasz gmjuhasz requested a review from a team November 27, 2025 16:35
@gmjuhasz gmjuhasz marked this pull request as ready for review November 27, 2025 16:40
@gmjuhasz gmjuhasz removed the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Nov 28, 2025
grzegorz-cp
grzegorz-cp previously approved these changes Dec 1, 2025
Copy link
Contributor

@grzegorz-cp grzegorz-cp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well and the feature flag is respected.

To improve the PR, we could extract the colour hex to a variable in the SCSS file or use defined colours. We can also reconsider the file name from "new" to a version number e.g. - media-selection-v2, but it's not a big deal.

Thank you for breaking the work up into smaller PRs.

@grzegorz-cp
Copy link
Contributor

I noticed that when a post doesn't have a featured image and you click "Featured image" in the dropdown nothing happens. We can improve this by adding a warning message or by disabling the option.

I would be great if at some point in the future, we could add a help popover that would explain all options available in the whole "Share to social media" sidebar. Currently using SIG is like a trial and error if you don't know what it does.

@gmjuhasz
Copy link
Contributor Author

gmjuhasz commented Dec 1, 2025

@grzegorz-cp I refactored the change a bit I found a better way to handle the logic. I also added the extra toggles here, as with this approach it made more sense rather than creating a new PR just for that.

I also fixed what happens when tehre is no featured image:
CleanShot 2025-12-01 at 11 33 17@2x

@gmjuhasz gmjuhasz requested a review from grzegorz-cp December 1, 2025 10:34
grzegorz-cp
grzegorz-cp previously approved these changes Dec 2, 2025
Copy link
Contributor

@grzegorz-cp grzegorz-cp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for making the changes.

@gmjuhasz gmjuhasz merged commit 62fe637 into trunk Dec 2, 2025
71 checks passed
@gmjuhasz gmjuhasz deleted the add/social/new-media-selector-ui branch December 2, 2025 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Publicize Now Jetpack Social, auto-sharing [JS Package] Publicize Components [Package] Publicize [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Social Issues about the Jetpack Social plugin RNA [Tests] Includes Tests [Type] Feature Development of a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants