rename uploadStatus -> uploadThumbnailStatus; call doResetThumbnailStatus on componentWillMount
This commit is contained in:
parent
9a658d41a8
commit
75b540635b
4 changed files with 17 additions and 11 deletions
|
@ -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<Props> {
|
||||
|
@ -68,7 +69,10 @@ class PublishForm extends React.PureComponent<Props> {
|
|||
(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<Props> {
|
|||
editingURI,
|
||||
title,
|
||||
thumbnail,
|
||||
uploadStatus,
|
||||
uploadThumbnailStatus,
|
||||
description,
|
||||
language,
|
||||
nsfw,
|
||||
|
@ -362,7 +366,7 @@ class PublishForm extends React.PureComponent<Props> {
|
|||
disabled={formDisabled}
|
||||
onChange={e => updatePublishForm({ thumbnail: e.target.value })}
|
||||
/>
|
||||
<p>status: {uploadStatus}</p>
|
||||
<p>status: {uploadThumbnailStatus}</p>
|
||||
</FormRow>
|
||||
<FormRow padded>
|
||||
<FormField
|
||||
|
|
|
@ -10,6 +10,7 @@ import {
|
|||
import { doNavigate } from 'redux/actions/navigation';
|
||||
import { selectPublishFormValues } from 'redux/selectors/publish';
|
||||
import {
|
||||
doResetThumbnailStatus,
|
||||
doClearPublish,
|
||||
doUpdatePublishForm,
|
||||
doPublish,
|
||||
|
@ -55,7 +56,8 @@ const perform = dispatch => ({
|
|||
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);
|
||||
|
|
|
@ -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 },
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue