From 75b540635bd6d14695141fdf7f49f8127dc21b78 Mon Sep 17 00:00:00 2001 From: Travis Eden Date: Mon, 2 Apr 2018 09:53:29 -0400 Subject: [PATCH] rename uploadStatus -> uploadThumbnailStatus; call doResetThumbnailStatus on componentWillMount --- src/renderer/component/publishForm/view.jsx | 14 +++++++++----- src/renderer/page/publish/index.js | 4 +++- src/renderer/redux/actions/publish.js | 4 ++-- src/renderer/redux/reducers/publish.js | 6 +++--- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/renderer/component/publishForm/view.jsx b/src/renderer/component/publishForm/view.jsx index bbe322e96..b15e70d59 100644 --- a/src/renderer/component/publishForm/view.jsx +++ b/src/renderer/component/publishForm/view.jsx @@ -21,7 +21,7 @@ type Props = { editingURI: ?string, title: ?string, thumbnail: ?string, - uploadStatus: ?string, + uploadThumbnailStatus: ?string, description: ?string, language: string, nsfw: boolean, @@ -50,7 +50,8 @@ type Props = { clearPublish: () => void, resolveUri: string => void, scrollToTop: () => void, - prepareEdit: ({}, string) => void, + prepareEdit: ({}) => void, + resetThumbnailStatus: () => void, }; class PublishForm extends React.PureComponent { @@ -68,7 +69,10 @@ class PublishForm extends React.PureComponent { (this: any).getNewUri = this.getNewUri.bind(this); } - // Returns a new uri to be used in the form and begins to resolve that uri for bid help text + componentWillMount() { + this.props.resetThumbnailStatus(); + } + getNewUri(name: string, channel: string) { const { resolveUri } = this.props; // If they are midway through a channel creation, treat it as anonymous until it completes @@ -268,7 +272,7 @@ class PublishForm extends React.PureComponent { editingURI, title, thumbnail, - uploadStatus, + uploadThumbnailStatus, description, language, nsfw, @@ -362,7 +366,7 @@ class PublishForm extends React.PureComponent { disabled={formDisabled} onChange={e => updatePublishForm({ thumbnail: e.target.value })} /> -

status: {uploadStatus}

+

status: {uploadThumbnailStatus}

({ resolveUri: uri => dispatch(doResolveUri(uri)), publish: params => dispatch(doPublish(params)), navigate: path => dispatch(doNavigate(path)), - prepareEdit: (claim, uri) => dispatch(doPrepareEdit(claim, uri)), + prepareEdit: claim => dispatch(doPrepareEdit(claim)), + resetThumbnail: () => dispatch(doResetThumbnailStatus()), }); export default connect(select, perform)(PublishPage); diff --git a/src/renderer/redux/actions/publish.js b/src/renderer/redux/actions/publish.js index 37c364e5d..b733717e8 100644 --- a/src/renderer/redux/actions/publish.js +++ b/src/renderer/redux/actions/publish.js @@ -38,13 +38,13 @@ export const doResetThumbnailStatus = () => (dispatch: Dispatch): Action => .then(() => dispatch({ type: ACTIONS.UPDATE_PUBLISH_FORM, - data: { thumbnailStatus: STATUSES.READY }, + data: { uploadThumbnailStatus: STATUSES.READY }, }) ) .catch(() => dispatch({ type: ACTIONS.UPDATE_PUBLISH_FORM, - data: { thumbnailStatus: STATUSES.DOWN }, + data: { uploadThumbnailStatus: STATUSES.API_DOWN }, }) ); diff --git a/src/renderer/redux/reducers/publish.js b/src/renderer/redux/reducers/publish.js index c185fdd8e..d6e7c7757 100644 --- a/src/renderer/redux/reducers/publish.js +++ b/src/renderer/redux/reducers/publish.js @@ -15,7 +15,7 @@ type PublishState = { }, title: string, thumbnail: string, - uploadStatus: string, + uploadThumbnailStatus: string, description: string, language: string, tosAccepted: boolean, @@ -40,7 +40,7 @@ export type UpdatePublishFormData = { }, title?: string, thumbnail?: string, - uploadStatus?: string, + uploadThumbnailStatus?: string, description?: string, language?: string, tosAccepted?: boolean, @@ -99,7 +99,7 @@ const defaultState: PublishState = { }, title: '', thumbnail: '', - uploadStatus: STATUSES.API_DOWN, + uploadThumbnailStatus: STATUSES.API_DOWN, description: '', language: 'en', nsfw: false,