diff --git a/src/renderer/component/publishForm/view.jsx b/src/renderer/component/publishForm/view.jsx index b15e70d59..694dbda5e 100644 --- a/src/renderer/component/publishForm/view.jsx +++ b/src/renderer/component/publishForm/view.jsx @@ -7,6 +7,7 @@ import ChannelSection from 'component/selectChannel'; import classnames from 'classnames'; import type { PublishParams, UpdatePublishFormData } from 'redux/reducers/publish'; import FileSelector from 'component/common/file-selector'; +import SelectThumbnail from 'component/selectThumbnail'; import { COPYRIGHT, OTHER } from 'constants/licenses'; import { CHANNEL_NEW, CHANNEL_ANONYMOUS, MINIMUM_PUBLISH_BID } from 'constants/claim'; import * as icons from 'constants/icons'; @@ -356,17 +357,12 @@ class PublishForm extends React.PureComponent { /> - updatePublishForm({ thumbnail: e.target.value })} + -

status: {uploadThumbnailStatus}

({ + openModal: (modal, props) => dispatch(doOpenModal(modal, props)), +}); + +export default connect(null, perform)(SelectThumbnail); diff --git a/src/renderer/component/selectThumbnail/view.jsx b/src/renderer/component/selectThumbnail/view.jsx new file mode 100644 index 000000000..1d75306e0 --- /dev/null +++ b/src/renderer/component/selectThumbnail/view.jsx @@ -0,0 +1,88 @@ +// @flow +import * as modals from 'constants/modal_types'; +import * as statuses from 'constants/thumbnail_upload_statuses'; +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, any) => 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 && ( + + )} + + {status === statuses.MANUAL && ( + + )} + + {status === statuses.IN_PROGRESS &&
uploading...
} + + {status === statuses.COMPLETE && ( +
+

{__('Thumbnail')}

+

+ Upload Complete
URL: {thumbnail} +

+
+ )} +
+ ); + } +} + +export default SelectThumbnail;