React/Redux - publish component #323
|
@ -507,7 +507,7 @@ table {
|
|||
/* Assets */
|
||||
|
||||
.asset {
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#show-body #asset-boilerpate {
|
||||
|
|
|
@ -39,6 +39,25 @@ function postRequest (url, params) {
|
|||
})
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -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) &&
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -44,11 +44,11 @@ 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
|
||||
}
|
||||
// is there a claim chosen?
|
||||
if (!this.props.claim) {
|
||||
return reject(new Error('Please enter a claim name'));
|
||||
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 reject(new Error('Please enter a 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
|
||||
}
|
||||
// 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'));
|
||||
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 reject(new Error('Select "Anonymous" or log in to a channel'));
|
||||
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
|
||||
}
|
||||
// tbd: is the claim available?
|
||||
resolve();
|
||||
|
@ -79,7 +79,9 @@ 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
|
||||
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);
|
||||
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 url = JSON.parse(xhr.response).message.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
|
||||
that.props.onPublishStatusChange(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
|
||||
window.location = 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
|
||||
} 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 {
|
|||
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">
|
||||
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="input-error" id="input-error-publish-submit" hidden="true">{this.state.publishRequestError}</div>
|
||||
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--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.state.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
|
||||
<button id="publish-submit" className="button--primary button--large" onClick={this.publish}>Publish</button>
|
||||
</div>
|
||||
|
||||
|
|
|||
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
|
This probably should not be a string based check.