React/Redux - publish component #323
|
@ -1,5 +1,4 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import ChannelLoginForm from '../containers/ChannelLoginForm.jsx';
|
import ChannelLoginForm from '../containers/ChannelLoginForm.jsx';
|
||||||
import ChannelCreateForm from '../containers/ChannelCreateForm.jsx';
|
import ChannelCreateForm from '../containers/ChannelCreateForm.jsx';
|
||||||
|
@ -68,9 +67,4 @@ const mapStateToProps = state => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ChannelSelector.propTypes = {
|
|
||||||
loggedInChannelName: PropTypes.string,
|
|
||||||
publishInChannel : PropTypes.bool,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, null)(ChannelSelector);
|
export default connect(mapStateToProps, null)(ChannelSelector);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
Generally you should avoid doing dom stuff/setting state in
Generally you should avoid doing dom stuff/setting state in `componentWillMount`. Especially since it seems that they will be removing it in a future React version.
`componentDidMount` is preferred
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
Generally you should avoid doing dom stuff/setting state in
Generally you should avoid doing dom stuff/setting state in `componentWillMount`. Especially since it seems that they will be removing it in a future React version.
`componentDidMount` is preferred
|
|||||||
|
|
||||||
class Preview extends React.Component {
|
class Preview extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
|
@ -40,10 +39,4 @@ class Preview extends React.Component {
|
||||||
Generally you should avoid doing dom stuff/setting state in
Generally you should avoid doing dom stuff/setting state in `componentWillMount`. Especially since it seems that they will be removing it in a future React version.
`componentDidMount` is preferred
Generally you should avoid doing dom stuff/setting state in
Generally you should avoid doing dom stuff/setting state in `componentWillMount`. Especially since it seems that they will be removing it in a future React version.
`componentDidMount` is preferred
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Preview.propTypes = {
|
|
||||||
Generally you should avoid doing dom stuff/setting state in
Generally you should avoid doing dom stuff/setting state in `componentWillMount`. Especially since it seems that they will be removing it in a future React version.
`componentDidMount` is preferred
|
|||||||
file : PropTypes.object.isRequired,
|
|
||||||
Generally you should avoid doing dom stuff/setting state in
Generally you should avoid doing dom stuff/setting state in `componentWillMount`. Especially since it seems that they will be removing it in a future React version.
`componentDidMount` is preferred
|
|||||||
thumbnail : PropTypes.string.isRequired,
|
|
||||||
Generally you should avoid doing dom stuff/setting state in
Generally you should avoid doing dom stuff/setting state in `componentWillMount`. Especially since it seems that they will be removing it in a future React version.
`componentDidMount` is preferred
|
|||||||
dimPreview: PropTypes.bool.isRequired,
|
|
||||||
Generally you should avoid doing dom stuff/setting state in
Generally you should avoid doing dom stuff/setting state in `componentWillMount`. Especially since it seems that they will be removing it in a future React version.
`componentDidMount` is preferred
|
|||||||
};
|
|
||||||
Generally you should avoid doing dom stuff/setting state in
Generally you should avoid doing dom stuff/setting state in `componentWillMount`. Especially since it seems that they will be removing it in a future React version.
`componentDidMount` is preferred
|
|||||||
|
|
||||||
Generally you should avoid doing dom stuff/setting state in
Generally you should avoid doing dom stuff/setting state in `componentWillMount`. Especially since it seems that they will be removing it in a future React version.
`componentDidMount` is preferred
|
|||||||
export default Preview;
|
export default Preview;
|
||||||
|
|
||||||
Generally you should avoid doing dom stuff/setting state in
Generally you should avoid doing dom stuff/setting state in `componentWillMount`. Especially since it seems that they will be removing it in a future React version.
`componentDidMount` is preferred
Generally you should avoid doing dom stuff/setting state in
Generally you should avoid doing dom stuff/setting state in `componentWillMount`. Especially since it seems that they will be removing it in a future React version.
`componentDidMount` is preferred
|
|
@ -1,22 +1,17 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ProgressBar from '../components/ProgressBar.jsx';
|
import ProgressBar from '../components/ProgressBar.jsx';
|
||||||
|
import * as publishStates from '../constants/publishing_states';
|
||||||
const LOAD_START = 'LOAD_START';
|
|
||||||
const LOADING = 'LOADING';
|
|
||||||
const PUBLISHING = 'PUBLISHING';
|
|
||||||
const SUCCESS = 'SUCCESS';
|
|
||||||
const FAILED = 'FAILED';
|
|
||||||
|
|
||||||
function PublishStatus ({ status, message }) {
|
function PublishStatus ({ status, message }) {
|
||||||
return (
|
return (
|
||||||
<div className="row row--tall flex-container--column flex-container--center-center">
|
<div className="row row--tall flex-container--column flex-container--center-center">
|
||||||
{(status === LOAD_START) &&
|
{(status === publishStates.LOAD_START) &&
|
||||||
<div className="row align-content-center">
|
<div className="row align-content-center">
|
||||||
<p>File is loading to server</p>
|
<p>File is loading to server</p>
|
||||||
<p className="blue">{message}</p>
|
<p className="blue">{message}</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{(status === LOADING) &&
|
{(status === publishStates.LOADING) &&
|
||||||
<div>
|
<div>
|
||||||
<div className="row align-content-center">
|
<div className="row align-content-center">
|
||||||
<p>File is loading to server</p>
|
<p>File is loading to server</p>
|
||||||
|
@ -24,20 +19,20 @@ function PublishStatus ({ status, message }) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{(status === PUBLISHING) &&
|
{(status === publishStates.PUBLISHING) &&
|
||||||
<div className="row align-content-center">
|
<div className="row align-content-center">
|
||||||
<p>Upload complete. Your file is now being published on the blockchain...</p>
|
<p>Upload complete. Your file is now being published on the blockchain...</p>
|
||||||
<ProgressBar/>
|
<ProgressBar/>
|
||||||
<p>Curious what magic is happening here? <a className="link--primary" target="blank" href="https://lbry.io/faq/what-is-lbry">Learn more.</a></p>
|
<p>Curious what magic is happening here? <a className="link--primary" target="blank" href="https://lbry.io/faq/what-is-lbry">Learn more.</a></p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{(status === SUCCESS) &&
|
{(status === publishStates.SUCCESS) &&
|
||||||
<div className="row align-content-center">
|
<div className="row align-content-center">
|
||||||
<p>Your publish is complete! You are being redirected to it now.</p>
|
<p>Your publish is complete! You are being redirected to it now.</p>
|
||||||
<p>If you are not automatically redirected, <a class="link--primary" target="_blank" href={message}>click here.</a></p>
|
<p>If you are not automatically redirected, <a class="link--primary" target="_blank" href={message}>click here.</a></p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{(status === FAILED) &&
|
{(status === publishStates.FAILED) &&
|
||||||
<div className="row align-content-center">
|
<div className="row align-content-center">
|
||||||
<p>Something went wrong...</p>
|
<p>Something went wrong...</p>
|
||||||
<p><strong>{message}</strong></p>
|
<p><strong>{message}</strong></p>
|
||||||
|
|
|
@ -4,7 +4,6 @@ import {updateLoggedInChannel} from '../actions/index';
|
||||||
import { makeGetRequest, makePostRequest } from '../utils/xhr.js';
|
import { makeGetRequest, makePostRequest } from '../utils/xhr.js';
|
||||||
import { setUserCookies } from '../utils/cookies.js';
|
import { setUserCookies } from '../utils/cookies.js';
|
||||||
import { replaceChannelSelectionInNavBar } from '../utils/page.js';
|
import { replaceChannelSelectionInNavBar } from '../utils/page.js';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
class ChannelCreateForm extends React.Component {
|
class ChannelCreateForm extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
|
@ -171,8 +170,4 @@ const mapDispatchToProps = dispatch => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ChannelCreateForm.propTypes = {
|
|
||||||
onChannelLogin: PropTypes.func.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(null, mapDispatchToProps)(ChannelCreateForm);
|
export default connect(null, mapDispatchToProps)(ChannelCreateForm);
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { connect } from 'react-redux';
|
||||||
import { updateLoggedInChannel } from '../actions/index';
|
import { updateLoggedInChannel } from '../actions/index';
|
||||||
import { setUserCookies } from '../utils/cookies.js';
|
import { setUserCookies } from '../utils/cookies.js';
|
||||||
import { replaceChannelSelectionInNavBar } from '../utils/page.js';
|
import { replaceChannelSelectionInNavBar } from '../utils/page.js';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
class ChannelLoginForm extends React.Component {
|
class ChannelLoginForm extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
|
@ -83,8 +82,4 @@ const mapDispatchToProps = dispatch => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ChannelLoginForm.propTypes = {
|
|
||||||
onChannelLogin: PropTypes.func.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(null, mapDispatchToProps)(ChannelLoginForm);
|
export default connect(null, mapDispatchToProps)(ChannelLoginForm);
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { setPublishInChannel } from '../actions/index';
|
import { setPublishInChannel } from '../actions/index';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
class AnonymousOrChannelSelect extends React.Component {
|
class channelSelect extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.toggleAnonymousPublish = this.toggleAnonymousPublish.bind(this);
|
this.toggleAnonymousPublish = this.toggleAnonymousPublish.bind(this);
|
||||||
|
@ -46,9 +45,4 @@ const mapDispatchToProps = dispatch => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
AnonymousOrChannelSelect.propTypes = {
|
export default connect(mapStateToProps, mapDispatchToProps)(channelSelect);
|
||||||
publishInChannel : PropTypes.bool.isRequired,
|
|
||||||
onPublishInChannelChange: PropTypes.func.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(AnonymousOrChannelSelect);
|
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { selectFile, updateError } from '../actions';
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import Preview from '../components/Preview.jsx';
|
import { selectFile, updateError } from '../actions';
|
||||||
import { validateFile } from '../utils/file.js';
|
import { validateFile } from '../utils/file.js';
|
||||||
import PropTypes from 'prop-types';
|
import Preview from '../components/Preview.jsx';
|
||||||
|
|
||||||
class Dropzone extends React.Component {
|
class Dropzone extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
|
@ -160,11 +159,4 @@ const mapDispatchToProps = dispatch => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
Dropzone.propTypes = {
|
|
||||||
file : PropTypes.object,
|
|
||||||
thumbnail : PropTypes.string.isRequired,
|
|
||||||
fileError : PropTypes.string,
|
|
||||||
onFileError: PropTypes.func.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(Dropzone);
|
export default connect(mapStateToProps, mapDispatchToProps)(Dropzone);
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
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
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { connect } from 'react-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
|
|||||||
|
import { getCookie } from '../utils/cookies.js';
|
||||||
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
|
|||||||
import PreviewDropzone from './Dropzone.jsx';
|
import PreviewDropzone from './Dropzone.jsx';
|
||||||
import PublishTitleInput from './PublishTitleInput.jsx';
|
import PublishTitleInput from './PublishTitleInput.jsx';
|
||||||
import ChannelSelector from '../components/ChannelSelector.jsx';
|
import ChannelSelector from '../components/ChannelSelector.jsx';
|
||||||
|
@ -6,11 +8,8 @@ import PublishUrlInput from './PublishUrlInput.jsx';
|
||||||
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
|
|||||||
import PublishThumbnailInput from './PublishThumbnailInput.jsx';
|
import PublishThumbnailInput from './PublishThumbnailInput.jsx';
|
||||||
import PublishMetadataInputs from './PublishMetadataInputs.jsx';
|
import PublishMetadataInputs from './PublishMetadataInputs.jsx';
|
||||||
import AnonymousOrChannelSelect from './ChannelSelect.jsx';
|
import AnonymousOrChannelSelect from './ChannelSelect.jsx';
|
||||||
import { connect } from 'react-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
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
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
|
|||||||
import { getCookie } from '../utils/cookies.js';
|
|
||||||
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
|
|||||||
import {selectFile, clearFile, updateLoggedInChannel, updatePublishStatus, updateError} from '../actions';
|
import {selectFile, clearFile, updateLoggedInChannel, updatePublishStatus, updateError} from '../actions';
|
||||||
import * as states from '../constants/publishing_states';
|
import * as publishStates from '../constants/publishing_states';
|
||||||
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
|
|||||||
|
|
||||||
class PublishForm extends React.Component {
|
class PublishForm extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
|
@ -55,18 +54,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 fd = this.appendDataToFormData(file, metadata);
|
const fd = this.appendDataToFormData(file, metadata);
|
||||||
const that = this;
|
const that = this;
|
||||||
xhr.upload.addEventListener('loadstart', function () {
|
xhr.upload.addEventListener('loadstart', function () {
|
||||||
that.props.onPublishStatusChange(states.LOAD_START, 'upload started');
|
that.props.onPublishStatusChange(publishStates.LOAD_START, 'upload started');
|
||||||
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
|
|||||||
});
|
});
|
||||||
xhr.upload.addEventListener('progress', function (e) {
|
xhr.upload.addEventListener('progress', function (e) {
|
||||||
if (e.lengthComputable) {
|
if (e.lengthComputable) {
|
||||||
const percentage = Math.round((e.loaded * 100) / e.total);
|
const percentage = Math.round((e.loaded * 100) / e.total);
|
||||||
console.log('progress:', percentage);
|
console.log('progress:', percentage);
|
||||||
that.props.onPublishStatusChange(states.LOADING, `${percentage}%`);
|
that.props.onPublishStatusChange(publishStates.LOADING, `${percentage}%`);
|
||||||
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
|
|||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
xhr.upload.addEventListener('load', function () {
|
xhr.upload.addEventListener('load', function () {
|
||||||
console.log('loaded 100%');
|
console.log('loaded 100%');
|
||||||
that.props.onPublishStatusChange(states.PUBLISHING, null);
|
that.props.onPublishStatusChange(publishStates.PUBLISHING, null);
|
||||||
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
|
|||||||
}, false);
|
}, false);
|
||||||
xhr.open('POST', uri, true);
|
xhr.open('POST', uri, true);
|
||||||
xhr.onreadystatechange = function () {
|
xhr.onreadystatechange = function () {
|
||||||
|
@ -75,12 +74,12 @@ 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
|
|||||||
if (xhr.status === 200) {
|
if (xhr.status === 200) {
|
||||||
console.log('publish complete!');
|
console.log('publish complete!');
|
||||||
const url = JSON.parse(xhr.response).message.url;
|
const url = JSON.parse(xhr.response).message.url;
|
||||||
that.props.onPublishStatusChange(states.SUCCESS, url);
|
that.props.onPublishStatusChange(publishStates.SUCCESS, 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
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
|
|||||||
window.location = url;
|
window.location = url;
|
||||||
} else if (xhr.status === 502) {
|
} else if (xhr.status === 502) {
|
||||||
that.props.onPublishStatusChange(states.FAILED, 'Spee.ch was not able to get a response from the LBRY network.');
|
that.props.onPublishStatusChange(publishStates.FAILED, 'Spee.ch was not able to get a response from the LBRY network.');
|
||||||
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
|
|||||||
} else {
|
} else {
|
||||||
that.props.onPublishStatusChange(states.FAILED, JSON.parse(xhr.response).message);
|
that.props.onPublishStatusChange(publishStates.FAILED, JSON.parse(xhr.response).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
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
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -226,24 +225,4 @@ 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
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
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
|
|||||||
file : PropTypes.object.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
|
|||||||
claim : PropTypes.string.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
|
|||||||
title : PropTypes.string.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
|
|||||||
thumbnail : PropTypes.string.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
|
|||||||
description : PropTypes.string.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
|
|||||||
license : PropTypes.string.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
|
|||||||
nsfw : PropTypes.bool.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
|
|||||||
loggedInChannel : PropTypes.object.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
|
|||||||
publishInChannel : PropTypes.bool.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
|
|||||||
fileError : 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
|
|||||||
urlError : 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,
|
|
||||||
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
|
|||||||
onFileClear : 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
|
|||||||
onChannelLogin : 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
|
|||||||
onPublishStatusChange: 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
|
|||||||
};
|
|
||||||
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
|
|||||||
export default connect(mapStateToProps, mapDispatchToProps)(PublishForm);
|
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
|
|
@ -1,7 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { updateMetadata } from '../actions/index';
|
import { updateMetadata } from '../actions/index';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
const textarea = document.getElementById('publish-description');
|
const textarea = document.getElementById('publish-description');
|
||||||
|
@ -16,11 +15,14 @@ class MetadataInputs extends React.Component {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
showInputs : false,
|
showInputs : false,
|
||||||
|
descriptionLimit : 200,
|
||||||
|
descriptionScrollHeight: null,
|
||||||
};
|
};
|
||||||
this.toggleShowInputs = this.toggleShowInputs.bind(this);
|
this.toggleShowInputs = this.toggleShowInputs.bind(this);
|
||||||
this.handleInput = this.handleInput.bind(this);
|
this.handleInput = this.handleInput.bind(this);
|
||||||
this.handleCheck = this.handleCheck.bind(this);
|
this.handleCheck = this.handleCheck.bind(this);
|
||||||
this.handleSelection = this.handleSelection.bind(this);
|
this.handleSelection = this.handleSelection.bind(this);
|
||||||
|
this.setDescriptionScrollHeight = this.setDescriptionScrollHeight.bind(this);
|
||||||
}
|
}
|
||||||
toggleShowInputs () {
|
toggleShowInputs () {
|
||||||
this.setState({'showInputs': !this.state.showInputs});
|
this.setState({'showInputs': !this.state.showInputs});
|
||||||
|
@ -43,6 +45,10 @@ class MetadataInputs extends React.Component {
|
||||||
const selectedOption = event.target.selectedOptions[0].value;
|
const selectedOption = event.target.selectedOptions[0].value;
|
||||||
this.props.onMetadataChange(name, selectedOption);
|
this.props.onMetadataChange(name, selectedOption);
|
||||||
}
|
}
|
||||||
|
setDescriptionScrollHeight (event) {
|
||||||
|
const scrollHeight = event.target.scrollHeight;
|
||||||
|
this.setState({descriptionScrollHeight: scrollHeight});
|
||||||
|
}
|
||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<div id="publish-details" className="row row--padded row--no-top row--wide">
|
<div id="publish-details" className="row row--padded row--no-top row--wide">
|
||||||
|
@ -53,7 +59,16 @@ class MetadataInputs extends React.Component {
|
||||||
<div className="column column--3 column--med-10 align-content-top">
|
<div className="column column--3 column--med-10 align-content-top">
|
||||||
<label htmlFor="publish-license" className="label">Description:</label>
|
<label htmlFor="publish-license" className="label">Description:</label>
|
||||||
</div><div className="column column--7 column--sml-10">
|
</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} />
|
<textarea
|
||||||
|
rows="1"
|
||||||
|
id="publish-description"
|
||||||
|
className="textarea textarea--primary textarea--full-width"
|
||||||
|
name="description"
|
||||||
|
placeholder="Optional description"
|
||||||
|
value={this.props.description}
|
||||||
|
onInput={this.setDescriptionScrollHeight}
|
||||||
|
height={Math.min(this.state.descriptionScrollHeight, this.state.descriptionLimit) + 'px'}
|
||||||
|
onChange={this.handleInput} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -99,11 +114,4 @@ const mapDispatchToProps = dispatch => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
MetadataInputs.propTypes = {
|
|
||||||
description : PropTypes.string.isRequired,
|
|
||||||
license : PropTypes.string.isRequired,
|
|
||||||
nsfw : PropTypes.bool.isRequired,
|
|
||||||
onMetadataChange: PropTypes.func.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(MetadataInputs);
|
export default connect(mapStateToProps, mapDispatchToProps)(MetadataInputs);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
I suspect there is a less hacky way to do this ;) I suspect there is a less hacky way to do this ;)
I suspect there is a less hacky way to do this ;) I suspect there is a less hacky way to do this ;)
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { updateMetadata } from '../actions/index';
|
import { updateMetadata } from '../actions/index';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
I suspect there is a less hacky way to do this ;) I suspect there is a less hacky way to do this ;)
|
|||||||
|
|
||||||
class ThumbnailInput extends React.Component {
|
class ThumbnailInput extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
|
@ -84,9 +83,4 @@ const mapDispatchToProps = dispatch => {
|
||||||
I suspect there is a less hacky way to do this ;) I suspect there is a less hacky way to do this ;)
I suspect there is a less hacky way to do this ;) I suspect there is a less hacky way to do this ;)
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ThumbnailInput.propTypes = {
|
|
||||||
I suspect there is a less hacky way to do this ;) I suspect there is a less hacky way to do this ;)
|
|||||||
thumbnail : PropTypes.string.isRequired,
|
|
||||||
I suspect there is a less hacky way to do this ;) I suspect there is a less hacky way to do this ;)
|
|||||||
onThumbnailChange: PropTypes.func.isRequired,
|
|
||||||
I suspect there is a less hacky way to do this ;) I suspect there is a less hacky way to do this ;)
|
|||||||
};
|
|
||||||
I suspect there is a less hacky way to do this ;) I suspect there is a less hacky way to do this ;)
|
|||||||
|
|
||||||
I suspect there is a less hacky way to do this ;) I suspect there is a less hacky way to do this ;)
|
|||||||
export default connect(mapStateToProps, mapDispatchToProps)(ThumbnailInput);
|
export default connect(mapStateToProps, mapDispatchToProps)(ThumbnailInput);
|
||||||
|
|
||||||
I suspect there is a less hacky way to do this ;) I suspect there is a less hacky way to do this ;)
I suspect there is a less hacky way to do this ;) I suspect there is a less hacky way to do this ;)
|
|
@ -1,7 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {updateMetadata} from '../actions/index';
|
import {updateMetadata} from '../actions/index';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
class TitleInput extends React.Component {
|
class TitleInput extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
|
@ -35,9 +34,4 @@ const mapDispatchToProps = dispatch => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
TitleInput.propTypes = {
|
|
||||||
title : PropTypes.string.isRequired,
|
|
||||||
onMetadataChange: PropTypes.func.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(TitleInput);
|
export default connect(mapStateToProps, mapDispatchToProps)(TitleInput);
|
||||||
|
|
|
@ -3,7 +3,6 @@ import Dropzone from './Dropzone.jsx';
|
||||||
import PublishForm from './PublishForm.jsx';
|
import PublishForm from './PublishForm.jsx';
|
||||||
import PublishStatus from '../components/PublishStatus.jsx';
|
import PublishStatus from '../components/PublishStatus.jsx';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
class PublishTool extends React.Component {
|
class PublishTool extends React.Component {
|
||||||
render () {
|
render () {
|
||||||
|
@ -32,10 +31,4 @@ const mapStateToProps = state => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
PublishTool.propTypes = {
|
|
||||||
file : PropTypes.object,
|
|
||||||
status : PropTypes.string,
|
|
||||||
message: PropTypes.string,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, null)(PublishTool);
|
export default connect(mapStateToProps, null)(PublishTool);
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { connect } from 'react-redux';
|
||||||
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).
|
|||||||
import { makeGetRequest } from '../utils/xhr.js';
|
import { makeGetRequest } from '../utils/xhr.js';
|
||||||
import UrlMiddle from '../components/PublishUrlMiddle.jsx';
|
import UrlMiddle from '../components/PublishUrlMiddle.jsx';
|
||||||
import {updateError} from '../actions';
|
import {updateError} from '../actions';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
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).
|
|||||||
|
|
||||||
class UrlChooser extends React.Component {
|
class UrlChooser extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
|
@ -105,13 +104,4 @@ 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).
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
UrlChooser.propTypes = {
|
|
||||||
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).
|
|||||||
fileName : PropTypes.string.isRequired,
|
|
||||||
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).
|
|||||||
loggedInChannelName : PropTypes.string.isRequired,
|
|
||||||
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).
|
|||||||
loggedInChannelShortId: PropTypes.string.isRequired,
|
|
||||||
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).
|
|||||||
publishInChannel : PropTypes.bool.isRequired,
|
|
||||||
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).
|
|||||||
claim : PropTypes.string.isRequired,
|
|
||||||
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).
|
|||||||
urlError : PropTypes.string,
|
|
||||||
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).
|
|||||||
|
|
||||||
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).
|
|||||||
export default connect(mapStateToProps, mapDispatchToProps)(UrlChooser);
|
export default connect(mapStateToProps, mapDispatchToProps)(UrlChooser);
|
||||||
|
|
||||||
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).
|
Generally you should avoid doing dom stuff/setting state in
componentWillMount
. Especially since it seems that they will be removing it in a future React version.componentDidMount
is preferred