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>
|
||||
|
||||
|
@ -196,18 +196,18 @@ 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
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
file : state.file,
|
||||
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
|
||||
claim : state.claim,
|
||||
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
|
||||
title : state.metadata.title,
|
||||
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
|
||||
thumbnail : state.metadata.thumbnail,
|
||||
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
|
||||
description : state.metadata.description,
|
||||
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
|
||||
license : state.metadata.license,
|
||||
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
|
||||
nsfw : state.metadata.nsfw,
|
||||
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
|
||||
loggedInChannel : state.loggedInChannel,
|
||||
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,
|
||||
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
|
||||
fileError : state.error.file,
|
||||
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
|
||||
urlError : state.error.url,
|
||||
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
|
||||
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
|
||||
file : state.file,
|
||||
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
|
||||
claim : state.claim,
|
||||
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
|
||||
title : state.metadata.title,
|
||||
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
|
||||
thumbnail : state.metadata.thumbnail,
|
||||
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
|
||||
description : state.metadata.description,
|
||||
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
|
||||
license : state.metadata.license,
|
||||
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
|
||||
nsfw : state.metadata.nsfw,
|
||||
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
|
||||
loggedInChannel : state.loggedInChannel,
|
||||
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,
|
||||
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
|
||||
fileError : state.error.file,
|
||||
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
|
||||
urlError : state.error.url,
|
||||
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,42 +45,39 @@ class MetadataInputs extends React.Component {
|
|||
}
|
||||
render () {
|
||||
return (
|
||||
<div>
|
||||
<div className="column column--10">
|
||||
<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 className="row row--no-top">
|
||||
<div className="column column--3 column--med-10 align-content-top">
|
||||
<label htmlFor="publish-license" className="label">Description:</label>
|
||||
</div><div className="column column--7 column--sml-10">
|
||||
<textarea rows="1" id="publish-description" className="textarea textarea--primary textarea--full-width" name="description" placeholder="Optional description" value={this.props.description} onChange={this.handleInput} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="row row--no-top">
|
||||
<div className="column column--3 column--med-10">
|
||||
<label htmlFor="publish-license" className="label">License:</label>
|
||||
</div><div className="column column--7 column--sml-10">
|
||||
<select type="text" name="license" id="publish-license" className="select select--primary" onChange={this.handleSelection}>
|
||||
<option value=" ">Unspecified</option>
|
||||
<option value="Public Domain">Public Domain</option>
|
||||
<option value="Creative Commons">Creative Commons</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="row row--no-top">
|
||||
<div className="column column--3">
|
||||
<label htmlFor="publish-nsfw" className="label">Mature:</label>
|
||||
</div><div className="column column--7">
|
||||
<input className="input-checkbox" type="checkbox" id="publish-nsfw" name="nsfw" checked={this.props.nsfw} onChange={this.handleCheck} />
|
||||
</div>
|
||||
<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>
|
||||
{this.state.showInputs && (
|
||||
<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>
|
||||
</div><div className="column column--7 column--sml-10">
|
||||
<textarea rows="1" id="publish-description" className="textarea textarea--primary textarea--full-width" name="description" placeholder="Optional description" value={this.props.description} onChange={this.handleInput} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="row row--no-top">
|
||||
<div className="column column--3 column--med-10">
|
||||
<label htmlFor="publish-license" className="label">License:</label>
|
||||
</div><div className="column column--7 column--sml-10">
|
||||
<select type="text" name="license" id="publish-license" className="select select--primary" onChange={this.handleSelection}>
|
||||
<option value=" ">Unspecified</option>
|
||||
<option value="Public Domain">Public Domain</option>
|
||||
<option value="Creative Commons">Creative Commons</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="row row--no-top">
|
||||
<div className="column column--3">
|
||||
<label htmlFor="publish-nsfw" className="label">Mature:</label>
|
||||
</div><div className="column column--7">
|
||||
<input className="input-checkbox" type="checkbox" id="publish-nsfw" name="nsfw" checked={this.props.nsfw} onChange={this.handleCheck} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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).
|
|
@ -15,9 +15,9 @@ 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).
|
||||
message: null,
|
||||
},
|
||||
error: {
|
||||
file : 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).
|
||||
url : 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).
|
||||
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).
|
||||
file : 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).
|
||||
url : 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