// @flow import { STATUSES } from 'lbry-redux'; import * as MODALS from 'constants/modal_types'; import React from 'react'; import { FormField } from 'component/common/form'; import FileSelector from 'component/common/file-selector'; type Props = { thumbnail: ?string, formDisabled: boolean, uploadThumbnailStatus: string, openModal: (string, {}) => void, updatePublishForm: ({}) => void, }; class SelectThumbnail extends React.PureComponent { render() { const { thumbnail, formDisabled, uploadThumbnailStatus: status, openModal, updatePublishForm, } = this.props; return (
{(status === STATUSES.READY || status === STATUSES.IN_PROGRESS) && (
{__('Thumbnail')} openModal(MODALS.CONFIRM_THUMBNAIL_UPLOAD, { path })} />
)} {(status === STATUSES.API_DOWN || status === STATUSES.MANUAL) && ( updatePublishForm({ thumbnail: e.target.value })} /> )} {status === STATUSES.READY && (

updatePublishForm({ uploadThumbnailStatus: STATUSES.MANUAL })} > Enter URL Manually

)} {status === STATUSES.MANUAL && (

updatePublishForm({ uploadThumbnailStatus: STATUSES.READY })} > Upload Thumbnail

)} {status === STATUSES.IN_PROGRESS &&

uploading...

} {status === STATUSES.COMPLETE && (

{__('Thumbnail')}

Upload Complete
URL: {thumbnail}

)}
); } } export default SelectThumbnail;