From 3a64e2dccf1c879db0aee29c563ed8ffae901e99 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Sun, 25 Feb 2018 17:38:14 -0800 Subject: [PATCH 1/2] added clearFile action to file selection error --- react/containers/Dropzone/index.js | 3 +- react/containers/Dropzone/view.jsx | 56 +++++++++++++-------------- react/containers/PublishForm/view.jsx | 32 +++++++-------- 3 files changed, 46 insertions(+), 45 deletions(-) diff --git a/react/containers/Dropzone/index.js b/react/containers/Dropzone/index.js index 07cc66e0..c66d30a1 100644 --- a/react/containers/Dropzone/index.js +++ b/react/containers/Dropzone/index.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import { selectFile, updateError } from 'actions/publish'; +import { selectFile, updateError, clearFile } from 'actions/publish'; import View from './view'; const mapStateToProps = ({ publish }) => { @@ -17,6 +17,7 @@ const mapDispatchToProps = dispatch => { dispatch(updateError('publishSubmit', null)); }, onFileError: (value) => { + dispatch(clearFile()); dispatch(updateError('file', value)); }, }; diff --git a/react/containers/Dropzone/view.jsx b/react/containers/Dropzone/view.jsx index 90b7c2a4..7c9a0dd7 100644 --- a/react/containers/Dropzone/view.jsx +++ b/react/containers/Dropzone/view.jsx @@ -83,11 +83,11 @@ class Dropzone extends React.Component { } render () { return ( -
+
- +
-
+
{this.props.file ? (
-
- { this.state.dragOver ? ( -
-

Drop it.

-
- ) : ( - null - )} - { this.state.mouseOver ? ( -
-

{this.props.fileError}

-

Drag & drop image or video here to publish

-

OR

-

CHOOSE FILE

-
- ) : ( - null - )} +
+ { this.state.dragOver ? ( +
+

Drop it.

+
+ ) : ( + null + )} + { this.state.mouseOver ? ( +
+

{this.props.fileError}

+

Drag & drop image or video here to publish

+

OR

+

CHOOSE FILE

+
+ ) : ( + null + )}
) : ( -
+
{ this.state.dragOver ? ( -
-

Drop it.

+
+

Drop it.

) : ( -
-

{this.props.fileError}

+
+

{this.props.fileError}

Drag & drop image or video here to publish

-

OR

-

CHOOSE FILE

+

OR

+

CHOOSE FILE

)}
diff --git a/react/containers/PublishForm/view.jsx b/react/containers/PublishForm/view.jsx index 366e86ba..45cf367d 100644 --- a/react/containers/PublishForm/view.jsx +++ b/react/containers/PublishForm/view.jsx @@ -128,39 +128,39 @@ class PublishForm extends React.Component { } render () { return ( -
-
+
+
-
-
+
+
-
-
-
+
+
+
-
+
{ (this.props.file.type === 'video/mp4') && ( -
+
)} -
+
-
- +
+
-
- +
+
-
-

By clicking 'Publish', you affirm that you have the rights to publish this content to the LBRY network, and that you understand the properties of publishing it to a decentralized, user-controlled network. Read more.

+
+

By clicking 'Publish', you affirm that you have the rights to publish this content to the LBRY network, and that you understand the properties of publishing it to a decentralized, user-controlled network. Read more.

From d4fabe347313b8046d1b94fdead84334696ff0fe Mon Sep 17 00:00:00 2001 From: bill bittner Date: Sun, 25 Feb 2018 17:47:22 -0800 Subject: [PATCH 2/2] removed unneeded actions from publish form --- react/containers/Dropzone/index.js | 7 +++++-- react/containers/Dropzone/view.jsx | 6 +++--- react/containers/PublishForm/index.js | 9 +-------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/react/containers/Dropzone/index.js b/react/containers/Dropzone/index.js index c66d30a1..1faeb20c 100644 --- a/react/containers/Dropzone/index.js +++ b/react/containers/Dropzone/index.js @@ -12,14 +12,17 @@ const mapStateToProps = ({ publish }) => { const mapDispatchToProps = dispatch => { return { - onFileSelect: (file) => { + selectFile: (file) => { dispatch(selectFile(file)); dispatch(updateError('publishSubmit', null)); }, - onFileError: (value) => { + setFileError: (value) => { dispatch(clearFile()); dispatch(updateError('file', value)); }, + clearFileError: () => { + dispatch(updateError('file', null)); + }, }; }; diff --git a/react/containers/Dropzone/view.jsx b/react/containers/Dropzone/view.jsx index 7c9a0dd7..be5a9af1 100644 --- a/react/containers/Dropzone/view.jsx +++ b/react/containers/Dropzone/view.jsx @@ -74,11 +74,11 @@ class Dropzone extends React.Component { try { validateFile(file); // validate the file's name, type, and size } catch (error) { - return this.props.onFileError(error.message); + return this.props.setFileError(error.message); } // stage it so it will be ready when the publish button is clicked - this.props.onFileError(null); - this.props.onFileSelect(file); + this.props.clearFileError(null); + this.props.selectFile(file); } } render () { diff --git a/react/containers/PublishForm/index.js b/react/containers/PublishForm/index.js index df1614b6..e0bc4473 100644 --- a/react/containers/PublishForm/index.js +++ b/react/containers/PublishForm/index.js @@ -1,6 +1,5 @@ import {connect} from 'react-redux'; -import {clearFile, selectFile, updateError, updatePublishStatus} from 'actions/publish'; -import {updateLoggedInChannel} from 'actions/channel'; +import {clearFile, updateError, updatePublishStatus} from 'actions/publish'; import View from './view'; const mapStateToProps = ({ channel, publish }) => { @@ -23,15 +22,9 @@ const mapStateToProps = ({ channel, publish }) => { const mapDispatchToProps = dispatch => { return { - onFileSelect: (file) => { - dispatch(selectFile(file)); - }, onFileClear: () => { dispatch(clearFile()); }, - onChannelLogin: (name, shortId, longId) => { - dispatch(updateLoggedInChannel(name, shortId, longId)); - }, onPublishStatusChange: (status, message) => { dispatch(updatePublishStatus(status, message)); },