Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
377755c
Create a hook for getting the SIG preview properly
gmjuhasz Nov 25, 2025
288f746
Move utils from GeneratedImagePreview to the newly created hook
gmjuhasz Nov 25, 2025
a3349ae
Add tests for SIG hook
gmjuhasz Nov 26, 2025
3556045
changelog
gmjuhasz Nov 26, 2025
cce8eca
Refactor GeneratedImagePreview to use the useSigPreview hook
gmjuhasz Nov 26, 2025
b1f4d19
Add new media section and preview + dropdown components
gmjuhasz Nov 25, 2025
2f4d636
changelog
gmjuhasz Nov 25, 2025
60686c9
Hook up components + connect with new feature flag
gmjuhasz Nov 25, 2025
fd4c016
Hook up SIG preview hook with the new component
gmjuhasz Nov 25, 2025
6df34c2
Move utils from GeneratedImagePreview to the newly created hook
gmjuhasz Nov 25, 2025
dc44786
Update styling
gmjuhasz Nov 26, 2025
a8a9871
Alignment changes
gmjuhasz Nov 26, 2025
1c772d3
Merge branch 'trunk' into add/social/new-media-selector-ui
gmjuhasz Nov 26, 2025
54e8787
Merge branch 'trunk' into add/social/new-media-selector-ui
gmjuhasz Nov 27, 2025
ea204e0
Fix race conditions with changes
gmjuhasz Nov 27, 2025
814bcf4
Add tests
gmjuhasz Nov 27, 2025
dd1b671
Merge branch 'trunk' into add/social/new-media-selector-ui
gmjuhasz Nov 28, 2025
a00ce2a
Refactor logic + add extra toggle
gmjuhasz Dec 1, 2025
3df3acd
changelog
gmjuhasz Dec 1, 2025
3db835c
Handle empty featured image
gmjuhasz Dec 1, 2025
2fd68b0
Fix test
gmjuhasz Dec 1, 2025
d631ef2
Merge branch 'trunk' into add/social/new-media-selector-ui
gmjuhasz Dec 1, 2025
20bdaae
Merge branch 'trunk' into add/social/new-media-selector-ui
gmjuhasz Dec 2, 2025
c504db2
Rename path
gmjuhasz Dec 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Add the new media selection UI for Social
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import useSocialMediaMessage from '../../hooks/use-social-media-message';
import { features } from '../../utils/constants';
import { useIsSocialNote } from '../../utils/use-is-social-note';
import MediaSection from '../media-section';
import MediaSectionV2 from '../media-section-v2';
import MessageBoxControl from '../message-box-control';
import SocialImageGeneratorPanel from '../social-image-generator/panel';
import styles from './styles.module.scss';
Expand Down Expand Up @@ -41,15 +42,20 @@ export const SharePostForm: FC< SharePostFormProps > = ( { analyticsData = null
/>
) }
{ siteHasFeature( features.UNIFIED_UI_V1 ) ? (
<div>HERE GOES THE NEW MEDIA SECTION</div>
) : null }
{ siteHasFeature( features.ENHANCED_PUBLISHING ) && (
<div className={ styles[ 'share-post-form__media-section' ] }>
<MediaSection analyticsData={ analyticsData } />
<MediaSectionV2 analyticsData={ analyticsData } />
</div>
) : (
<>
{ siteHasFeature( features.ENHANCED_PUBLISHING ) && (
<div className={ styles[ 'share-post-form__media-section' ] }>
<MediaSection analyticsData={ analyticsData } />
</div>
) }
{ /* Social Image Generator panel - only shown when not using unified UI */ }
{ postCanUseSig && <SocialImageGeneratorPanel /> }
</>
) }
{ /* Social Image Generator panel */ }
{ postCanUseSig && <SocialImageGeneratorPanel /> }
</>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* CustomMediaToggle component
* Toggle for sharing image as attachment instead of link preview
*/

import { ToggleControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { getAttachmentDescription } from './media-source-menu';
import styles from './styles.module.scss';
import { MediaSourceType } from './types';

interface CustomMediaToggleProps {
/**
* Current media source type
*/
source: MediaSourceType;

/**
* Whether the toggle is checked (attached media is set)
*/
checked: boolean;

/**
* Callback when toggle changes
*/
onChange: ( checked: boolean ) => void;

/**
* Whether the toggle is disabled
*/
disabled?: boolean;
}

/**
* Toggle for sharing image as attachment
*
* @param {CustomMediaToggleProps} props - Component props
* @return {JSX.Element|null} CustomMediaToggle component
*/
export default function CustomMediaToggle( {
source,
checked,
onChange,
disabled = false,
}: CustomMediaToggleProps ) {
const description = getAttachmentDescription( source );

// Only show for sources that have an attachment description (featured-image, sig)
if ( ! description ) {
return null;
}

return (
<div className={ styles[ 'custom-media-toggle' ] }>
<ToggleControl
label={ __( 'Share as attachment', 'jetpack-publicize-components' ) }
checked={ checked }
onChange={ onChange }
disabled={ disabled }
help={ description }
__nextHasNoMarginBottom={ true }
/>
</div>
);
}
Loading
Loading