Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: patch
Type: changed

Remove upload video option from media dropdown and rename Media Library to From Media Library
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default function MediaSectionV2( {
if ( currentSource === 'featured-image' ) {
Copy link
Member

Choose a reason for hiding this comment

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

In some follow-up, I think we can break this file into smaller components with an improved API for the pieces. I may do so in the coming days.

return featuredImageId;
}
if ( currentSource === 'media-library' || currentSource === 'upload-video' ) {
if ( currentSource === 'media-library' ) {
return attachedMedia?.[ 0 ]?.id;
}
return null;
Expand Down Expand Up @@ -313,7 +313,7 @@ export default function MediaSectionV2( {
) }
</>
) }
{ ( currentSource === 'media-library' || currentSource === 'upload-video' ) && (
{ currentSource === 'media-library' && (
<ExternalLink
href={ getRedirectUrl( 'jetpack-social-media-support-information' ) }
className={ styles[ 'learn-more' ] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ describe( 'getMediaSourceDescription', () => {
it( 'should return media library description', () => {
expect( getMediaSourceDescription( 'media-library' ) ).toBe( 'You are using a custom image.' );
} );

it( 'should return upload video description', () => {
expect( getMediaSourceDescription( 'upload-video' ) ).toBe( 'Upload a video file.' );
} );
} );

describe( 'MediaSourceMenu', () => {
Expand Down Expand Up @@ -80,8 +76,7 @@ describe( 'MediaSourceMenu', () => {
// Check that menu items are rendered
expect( screen.getByRole( 'menuitem', { name: 'Featured Image' } ) ).toBeInTheDocument();
expect( screen.getByRole( 'menuitem', { name: 'Social Image Template' } ) ).toBeInTheDocument();
expect( screen.getByRole( 'menuitem', { name: 'Media Library' } ) ).toBeInTheDocument();
expect( screen.getByRole( 'menuitem', { name: 'Upload video' } ) ).toBeInTheDocument();
expect( screen.getByRole( 'menuitem', { name: 'From Media Library' } ) ).toBeInTheDocument();
} );

it( 'should call onSelect when Featured Image is clicked', async () => {
Expand Down Expand Up @@ -130,7 +125,7 @@ describe( 'MediaSourceMenu', () => {
);

await user.click( screen.getByRole( 'button', { name: 'Select' } ) );
await user.click( screen.getByRole( 'menuitem', { name: 'Media Library' } ) );
await user.click( screen.getByRole( 'menuitem', { name: 'From Media Library' } ) );

expect( mockOnMediaLibraryClick ).toHaveBeenCalledTimes( 1 );
expect( mockOnSelect ).not.toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Media source types
*/
export type MediaSourceType = 'featured-image' | 'media-library' | 'upload-video' | 'sig' | null;
export type MediaSourceType = 'featured-image' | 'media-library' | 'sig' | null;

/**
* Menu option IDs - includes all menu items including 'ai-image' which is handled specially
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function detectMediaSource(
if ( sigEnabled && attachedMedia[ 0 ].id === 0 ) {
return 'sig';
}
return attachedMedia[ 0 ].type?.startsWith( 'video/' ) ? 'upload-video' : 'media-library';
return 'media-library';
}

// Priority 2: Social Image Generator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { AiSVG } from '@automattic/jetpack-ai-client';
import { __ } from '@wordpress/i18n';
import { image, video, starEmpty, media as mediaIcon } from '@wordpress/icons';
import { image, starEmpty, media as mediaIcon } from '@wordpress/icons';
import { MediaSourceOption, MediaSourceType } from '../types';

/**
Expand Down Expand Up @@ -39,18 +39,11 @@ export function getMediaSourceOptions(): MediaSourceOption[] {
},
{
id: 'media-library',
label: __( 'Media Library', 'jetpack-publicize-components' ),
label: __( 'From Media Library', 'jetpack-publicize-components' ),
description: __( 'You are using a custom image.', 'jetpack-publicize-components' ),
icon: mediaIcon,
group: 'attachment',
},
{
id: 'upload-video',
label: __( 'Upload video', 'jetpack-publicize-components' ),
description: __( 'Upload a video file.', 'jetpack-publicize-components' ),
icon: video,
group: 'attachment',
},
{
id: 'ai-image',
label: __( 'Generate image', 'jetpack-publicize-components' ),
Expand Down
Loading