React/Redux - publish component #323

Merged
bones7242 merged 80 commits from react-upload into master 2018-01-25 22:43:20 +01:00
7 changed files with 31 additions and 9 deletions
Showing only changes of commit edc4ee24f2 - Show all commits

View file

@ -507,7 +507,7 @@ table {
/* Assets */
.asset {
max-width: 100%;
width: 100%;
}
#show-body #asset-boilerpate {

View file

@ -39,6 +39,25 @@ function postRequest (url, params) {
})
kauffj commented 2018-01-22 19:36:32 +01:00 (Migrated from github.com)
Review

This probably should not be a string based check.

This probably should not be a string based check.
}
function toggleSection(event){
event.preventDefault();
var dataSet = event.target.dataset;
var status = dataSet.open;
var masterElement = document.getElementById(event.target.id||event.srcElement.id);
var slaveElement = document.getElementById(dataSet.slaveelementid);
var closedLabel = dataSet.closedlabel;
var openLabel = dataSet.openlabel;
if (status === "false") {
slaveElement.hidden = false;
masterElement.innerText = openLabel;
masterElement.dataset.open = "true";
} else {
slaveElement.hidden = true;
masterElement.innerText = closedLabel;
masterElement.dataset.open = "false";
}
}
function createProgressBar(element, size){
var x = 0;
var adder = 1;

View file

@ -33,7 +33,8 @@ function PublishStatus ({ status, message }) {
}
{(status === SUCCESS) &&
<div className="row align-content-center">
{message}
<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>
</div>
}
{(status === FAILED) &&

View file

@ -3,7 +3,7 @@ import {connect} from 'react-redux';
import {updateLoggedInChannel} from '../actions/index';
import { makeGetRequest, makePostRequest } from '../utils/xhr.js';
import { setUserCookies } from '../utils/cookies.js';
import { replaceChannelSelectionInNavBar } from '../utils/pageUpdate.js';
import { replaceChannelSelectionInNavBar } from '../utils/page.js';
class ChannelCreateForm extends React.Component {
constructor (props) {

View file

@ -3,7 +3,7 @@ import { makePostRequest } from '../utils/xhr.js';
import { connect } from 'react-redux';
import { updateLoggedInChannel } from '../actions/index';
import { setUserCookies } from '../utils/cookies.js';
import { replaceChannelSelectionInNavBar } from '../utils/pageUpdate.js';
import { replaceChannelSelectionInNavBar } from '../utils/page.js';
class ChannelLoginForm extends React.Component {
constructor (props) {

View file

@ -44,11 +44,11 @@ class PublishForm extends React.Component {
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

I suspect this shouldn't be necessary with addition of Redux

I suspect this shouldn't be necessary with addition of Redux
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

I suspect this shouldn't be necessary with addition of Redux

I suspect this shouldn't be necessary with addition of Redux
}
// is there a claim chosen?
if (!this.props.claim) {
return reject(new Error('Please enter a claim name'));
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

I suspect this shouldn't be necessary with addition of Redux

I suspect this shouldn't be necessary with addition of Redux
return reject(new Error('Please enter a URL'));
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

I suspect this shouldn't be necessary with addition of Redux

I suspect this shouldn't be necessary with addition of Redux
}
// if publishInChannel is true, is a channel logged in (or selected)
if (this.props.publishInChannel && !this.props.loggedInChannel.name) {
return reject(new Error('Select Anonymous or log in to a channel'));
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

I suspect this shouldn't be necessary with addition of Redux

I suspect this shouldn't be necessary with addition of Redux
return reject(new Error('Select "Anonymous" or log in to a channel'));
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

I suspect this shouldn't be necessary with addition of Redux

I suspect this shouldn't be necessary with addition of Redux
}
// tbd: is the claim available?
resolve();
@ -79,7 +79,9 @@ class PublishForm extends React.Component {
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

I suspect this shouldn't be necessary with addition of Redux

I suspect this shouldn't be necessary with addition of Redux
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

I suspect this shouldn't be necessary with addition of Redux

I suspect this shouldn't be necessary with addition of Redux
console.log('publish response:', xhr.response);
if (xhr.status === 200) {
console.log('publish complete!');
that.props.onPublishStatusChange(SUCCESS, JSON.parse(xhr.response).message.lbryTx.claim_id);
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

I suspect this shouldn't be necessary with addition of Redux

I suspect this shouldn't be necessary with addition of Redux
const url = JSON.parse(xhr.response).message.url;
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

I suspect this shouldn't be necessary with addition of Redux

I suspect this shouldn't be necessary with addition of Redux
that.props.onPublishStatusChange(SUCCESS, url);
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

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;
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

I suspect this shouldn't be necessary with addition of Redux

I suspect this shouldn't be necessary with addition of Redux
} else if (xhr.status === 502) {
that.props.onPublishStatusChange(FAILED, 'Spee.ch was not able to get a response from the LBRY network.');
} else {
@ -172,8 +174,8 @@ class PublishForm extends React.Component {
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

I suspect this shouldn't be necessary with addition of Redux

I suspect this shouldn't be necessary with addition of Redux
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

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">
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

I suspect this shouldn't be necessary with addition of Redux

I suspect this shouldn't be necessary with addition of Redux
<div className="input-error" id="input-error-publish-submit" hidden="true">{this.state.publishRequestError}</div>
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

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--wide align-content-center">
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

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.state.publishRequestError}</p>
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

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>

kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

I suspect this shouldn't be necessary with addition of Redux

I suspect this shouldn't be necessary with addition of Redux
kauffj commented 2018-01-15 20:25:38 +01:00 (Migrated from github.com)
Review

These consts need to be shared across files

These consts need to be shared across files
kauffj commented 2018-01-15 20:31:56 +01:00 (Migrated from github.com)
Review

I suspect this shouldn't be necessary with addition of Redux

I suspect this shouldn't be necessary with addition of Redux