import * as React from 'react' ; import { IExtension , IExtensionActivationResult , ISuperdesk , IArticle } from 'superdesk-api' ; import { getVideoEditModal } from './get-video-editor-modal' ; function getEditVideoAction ( superdesk ) { const { gettext } = superdesk . localization ; const { showModal } = superdesk . ui ; return class EditVideoAction extends React . PureComponent < { article : IArticle ; } > { render ( ) { if ( this . props . article . type === 'video' && this . props . article ?. renditions ?. original ?. video_editor_id != null ) { return ( < button className = "btn btn--hollow btn--small" onClick = { ( ) => { showModal ( getVideoEditModal ( superdesk , this . props . article ) ) ; } } > { gettext ( 'Edit video' ) } < /button>); } else { return null ; } } } ; } const extension = { activate : ( superdesk ) => { const result = { contributions : { mediaActions : [ getEditVideoAction ( superdesk ) ] , } , } ; return Promise . resolve ( result ) ; } , } ; export default extension ;