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,
|
editingURI: ?string,
|
||||||
title: ?string,
|
title: ?string,
|
||||||
thumbnail: ?string,
|
thumbnail: ?string,
|
||||||
uploadStatus: ?string,
|
uploadThumbnailStatus: ?string,
|
||||||
description: ?string,
|
description: ?string,
|
||||||
language: string,
|
language: string,
|
||||||
nsfw: boolean,
|
nsfw: boolean,
|
||||||
|
@ -50,7 +50,8 @@ type Props = {
|
||||||
clearPublish: () => void,
|
clearPublish: () => void,
|
||||||
resolveUri: string => void,
|
resolveUri: string => void,
|
||||||
scrollToTop: () => void,
|
scrollToTop: () => void,
|
||||||
prepareEdit: ({}, string) => void,
|
prepareEdit: ({}) => void,
|
||||||
|
resetThumbnailStatus: () => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
class PublishForm extends React.PureComponent<Props> {
|
class PublishForm extends React.PureComponent<Props> {
|
||||||
|
@ -68,7 +69,10 @@ class PublishForm extends React.PureComponent<Props> {
|
||||||
(this: any).getNewUri = this.getNewUri.bind(this);
|
(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) {
|
getNewUri(name: string, channel: string) {
|
||||||
const { resolveUri } = this.props;
|
const { resolveUri } = this.props;
|
||||||
// If they are midway through a channel creation, treat it as anonymous until it completes
|
// 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,
|
editingURI,
|
||||||
title,
|
title,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
uploadStatus,
|
uploadThumbnailStatus,
|
||||||
description,
|
description,
|
||||||
language,
|
language,
|
||||||
nsfw,
|
nsfw,
|
||||||
|
@ -362,7 +366,7 @@ class PublishForm extends React.PureComponent<Props> {
|
||||||
disabled={formDisabled}
|
disabled={formDisabled}
|
||||||
onChange={e => updatePublishForm({ thumbnail: e.target.value })}
|
onChange={e => updatePublishForm({ thumbnail: e.target.value })}
|
||||||
/>
|
/>
|
||||||
<p>status: {uploadStatus}</p>
|
<p>status: {uploadThumbnailStatus}</p>
|
||||||
</FormRow>
|
</FormRow>
|
||||||
<FormRow padded>
|
<FormRow padded>
|
||||||
<FormField
|
<FormField
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {
|
||||||
import { doNavigate } from 'redux/actions/navigation';
|
import { doNavigate } from 'redux/actions/navigation';
|
||||||
import { selectPublishFormValues } from 'redux/selectors/publish';
|
import { selectPublishFormValues } from 'redux/selectors/publish';
|
||||||
import {
|
import {
|
||||||
|
doResetThumbnailStatus,
|
||||||
doClearPublish,
|
doClearPublish,
|
||||||
doUpdatePublishForm,
|
doUpdatePublishForm,
|
||||||
doPublish,
|
doPublish,
|
||||||
|
@ -55,7 +56,8 @@ const perform = dispatch => ({
|
||||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||||
publish: params => dispatch(doPublish(params)),
|
publish: params => dispatch(doPublish(params)),
|
||||||
navigate: path => dispatch(doNavigate(path)),
|
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);
|
export default connect(select, perform)(PublishPage);
|
||||||
|
|
|
@ -38,13 +38,13 @@ export const doResetThumbnailStatus = () => (dispatch: Dispatch): Action =>
|
||||||
.then(() =>
|
.then(() =>
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.UPDATE_PUBLISH_FORM,
|
type: ACTIONS.UPDATE_PUBLISH_FORM,
|
||||||
data: { thumbnailStatus: STATUSES.READY },
|
data: { uploadThumbnailStatus: STATUSES.READY },
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.catch(() =>
|
.catch(() =>
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.UPDATE_PUBLISH_FORM,
|
type: ACTIONS.UPDATE_PUBLISH_FORM,
|
||||||
data: { thumbnailStatus: STATUSES.DOWN },
|
data: { uploadThumbnailStatus: STATUSES.API_DOWN },
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ type PublishState = {
|
||||||
},
|
},
|
||||||
title: string,
|
title: string,
|
||||||
thumbnail: string,
|
thumbnail: string,
|
||||||
uploadStatus: string,
|
uploadThumbnailStatus: string,
|
||||||
description: string,
|
description: string,
|
||||||
language: string,
|
language: string,
|
||||||
tosAccepted: boolean,
|
tosAccepted: boolean,
|
||||||
|
@ -40,7 +40,7 @@ export type UpdatePublishFormData = {
|
||||||
},
|
},
|
||||||
title?: string,
|
title?: string,
|
||||||
thumbnail?: string,
|
thumbnail?: string,
|
||||||
uploadStatus?: string,
|
uploadThumbnailStatus?: string,
|
||||||
description?: string,
|
description?: string,
|
||||||
language?: string,
|
language?: string,
|
||||||
tosAccepted?: boolean,
|
tosAccepted?: boolean,
|
||||||
|
@ -99,7 +99,7 @@ const defaultState: PublishState = {
|
||||||
},
|
},
|
||||||
title: '',
|
title: '',
|
||||||
thumbnail: '',
|
thumbnail: '',
|
||||||
uploadStatus: STATUSES.API_DOWN,
|
uploadThumbnailStatus: STATUSES.API_DOWN,
|
||||||
description: '',
|
description: '',
|
||||||
language: 'en',
|
language: 'en',
|
||||||
nsfw: false,
|
nsfw: false,
|
||||||
|
|
Loading…
Add table
Reference in a new issue