React/Redux - publish component #323
|
@ -152,6 +152,7 @@ const mapDispatchToProps = dispatch => {
|
|||
return {
|
||||
onFileSelect: (file) => {
|
||||
dispatch(selectFile(file));
|
||||
dispatch(updateError('publishSubmit', null));
|
||||
},
|
||||
onFileError: (value) => {
|
||||
dispatch(updateError('file', value));
|
||||
|
|
|
@ -125,13 +125,13 @@ class PublishForm extends React.Component {
|
|||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
.then(() => {
|
||||
const metadata = that.createMetadata();
|
||||
// publish the claim
|
||||
return that.makePublishRequest(this.props.file, metadata);
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
return that.makePublishRequest(that.props.file, metadata);
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
})
|
||||
.then(() => {
|
||||
that.props.onPublishStatusChange('publish request made');
|
||||
})
|
||||
.catch((error) => {
|
||||
that.props.onPublishRequestError(error.message);
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
that.props.onPublishSubmitError(error.message);
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
});
|
||||
}
|
||||
render () {
|
||||
|
@ -174,8 +174,8 @@ class PublishForm extends React.Component {
|
|||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
<PublishMetadataInputs />
|
||||
</div>
|
||||
|
||||
<div className="row row--padded row--wide align-content-center">
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
<p className="info-message-placeholder info-message--failure">{this.props.publishRequestError}</p>
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
<div className="row row--padded row--no-top row--wide align-content-center">
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
<p className="info-message-placeholder info-message--failure">{this.props.publishSubmitError}</p>
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
<button id="publish-submit" className="button--primary button--large" onClick={this.publish}>Publish</button>
|
||||
</div>
|
||||
|
||||
|
@ -207,7 +207,7 @@ const mapStateToProps = state => {
|
|||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
publishInChannel : state.publishInChannel,
|
||||
fileError : state.error.file,
|
||||
urlError : state.error.url,
|
||||
publishRequestError: state.error.publishRequest,
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
publishSubmitError: state.error.publishSubmit,
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -225,8 +225,8 @@ const mapDispatchToProps = dispatch => {
|
|||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
onPublishStatusChange: (status, message) => {
|
||||
dispatch(updatePublishStatus(status, message));
|
||||
},
|
||||
onPublishRequestError: (value) => {
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
dispatch(updateError('publishRequest', value));
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
onPublishSubmitError: (value) => {
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
dispatch(updateError('publishSubmit', value));
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -243,12 +243,12 @@ PublishForm.propTypes = {
|
|||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
publishInChannel : PropTypes.bool.isRequired,
|
||||
fileError : PropTypes.string,
|
||||
urlError : PropTypes.string,
|
||||
publishRequestError : PropTypes.string,
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
publishSubmitError : PropTypes.string,
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
onFileSelect : PropTypes.func.isRequired,
|
||||
onFileClear : PropTypes.func.isRequired,
|
||||
onChannelLogin : PropTypes.func.isRequired,
|
||||
onPublishStatusChange: PropTypes.func.isRequired,
|
||||
onPublishRequestError: PropTypes.func.isRequired,
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
onPublishSubmitError: PropTypes.func.isRequired,
|
||||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(PublishForm);
|
||||
|
|
|||
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
These consts need to be shared across files These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux I suspect this shouldn't be necessary with addition of Redux
|
|
@ -45,13 +45,10 @@ class MetadataInputs extends React.Component {
|
|||
}
|
||||
render () {
|
||||
return (
|
||||
<div>
|
||||
<div className="column column--10">
|
||||
<div id="publish-details" className="row row--padded row--no-top row--wide">
|
||||
<a className="label link--primary" id="publish-details-toggle" href="#" onClick={this.toggleShowInputs}>{this.state.showInputs ? '[less]' : '[more]'}</a>
|
||||
</div>
|
||||
{this.state.showInputs && (
|
||||
<div id="publish-details" className="row row--padded row--wide">
|
||||
|
||||
<div>
|
||||
<div className="row row--no-top">
|
||||
<div className="column column--3 column--med-10 align-content-top">
|
||||
<label htmlFor="publish-license" className="label">Description:</label>
|
||||
|
|
|
@ -53,13 +53,13 @@ class UrlChooser extends React.Component {
|
|||
You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements). You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements). You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
|
||||
makeGetRequest(`/api/claim-is-available/${claim}`)
|
||||
.then(response => {
|
||||
if (response) {
|
||||
this.props.onUrlError(null);
|
||||
You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements). You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
|
||||
that.props.onUrlError(null);
|
||||
You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements). You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
|
||||
} else {
|
||||
this.props.onUrlError('That url has already been claimed');
|
||||
You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements). You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
|
||||
that.props.onUrlError('That url has already been claimed');
|
||||
You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements). You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.props.onUrlError(error.message);
|
||||
You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements). You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
|
||||
that.props.onUrlError(error.message);
|
||||
You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements). You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
|
||||
});
|
||||
}
|
||||
render () {
|
||||
|
@ -97,6 +97,7 @@ const mapDispatchToProps = dispatch => {
|
|||
You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements). You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements). You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
|
||||
return {
|
||||
onClaimChange: (value) => {
|
||||
dispatch(updateClaim(value));
|
||||
dispatch(updateError('publishSubmit', null));
|
||||
You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements). You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
|
||||
},
|
||||
onUrlError: (value) => {
|
||||
dispatch(updateError('url', value));
|
||||
|
|
|||
You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements). You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements). You should look at some of the linting additions @IGassman has added to app, could help keep these imports consistent in path specification (among other improvements).
|
|
@ -17,7 +17,7 @@ const initialState = {
|
|||
`import * as`
Some of these should possibly be renamed or refactored into separate files (or possibly can wait until next refactor/revision). Some of these should possibly be renamed or refactored into separate files (or possibly can wait until next refactor/revision).
`import * as`
Some of these should possibly be renamed or refactored into separate files (or possibly can wait until next refactor/revision). Some of these should possibly be renamed or refactored into separate files (or possibly can wait until next refactor/revision).
|
||||
error: {
|
||||
file : null,
|
||||
url : null,
|
||||
publishRequest: null,
|
||||
`import * as`
Some of these should possibly be renamed or refactored into separate files (or possibly can wait until next refactor/revision). Some of these should possibly be renamed or refactored into separate files (or possibly can wait until next refactor/revision).
|
||||
publishSubmit: null,
|
||||
`import * as`
Some of these should possibly be renamed or refactored into separate files (or possibly can wait until next refactor/revision). Some of these should possibly be renamed or refactored into separate files (or possibly can wait until next refactor/revision).
|
||||
},
|
||||
file : null,
|
||||
claim : '',
|
||||
|
|
|||
`import * as`
Some of these should possibly be renamed or refactored into separate files (or possibly can wait until next refactor/revision). Some of these should possibly be renamed or refactored into separate files (or possibly can wait until next refactor/revision).
`import * as`
Some of these should possibly be renamed or refactored into separate files (or possibly can wait until next refactor/revision). Some of these should possibly be renamed or refactored into separate files (or possibly can wait until next refactor/revision).
|
These consts need to be shared across files
I suspect this shouldn't be necessary with addition of Redux