added forwarding to asset show page when publish is complete

This commit is contained in:
bill bittner 2018-01-12 10:21:40 -08:00
parent 74247b7647
commit edc4ee24f2
7 changed files with 31 additions and 9 deletions

View file

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

View file

@ -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){ function createProgressBar(element, size){
var x = 0; var x = 0;
var adder = 1; var adder = 1;

View file

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

View file

@ -3,7 +3,7 @@ import {connect} from 'react-redux';
import {updateLoggedInChannel} from '../actions/index'; 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/pageUpdate.js'; import { replaceChannelSelectionInNavBar } from '../utils/page.js';
class ChannelCreateForm extends React.Component { class ChannelCreateForm extends React.Component {
constructor (props) { constructor (props) {

View file

@ -3,7 +3,7 @@ import { makePostRequest } from '../utils/xhr.js';
import { connect } from 'react-redux'; 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/pageUpdate.js'; import { replaceChannelSelectionInNavBar } from '../utils/page.js';
class ChannelLoginForm extends React.Component { class ChannelLoginForm extends React.Component {
constructor (props) { constructor (props) {

View file

@ -44,11 +44,11 @@ class PublishForm extends React.Component {
} }
// is there a claim chosen? // is there a claim chosen?
if (!this.props.claim) { if (!this.props.claim) {
return reject(new Error('Please enter a claim name')); return reject(new Error('Please enter a URL'));
} }
// if publishInChannel is true, is a channel logged in (or selected) // if publishInChannel is true, is a channel logged in (or selected)
if (this.props.publishInChannel && !this.props.loggedInChannel.name) { if (this.props.publishInChannel && !this.props.loggedInChannel.name) {
return reject(new Error('Select Anonymous or log in to a channel')); return reject(new Error('Select "Anonymous" or log in to a channel'));
} }
// tbd: is the claim available? // tbd: is the claim available?
resolve(); resolve();
@ -79,7 +79,9 @@ class PublishForm extends React.Component {
console.log('publish response:', xhr.response); console.log('publish response:', xhr.response);
if (xhr.status === 200) { if (xhr.status === 200) {
console.log('publish complete!'); console.log('publish complete!');
that.props.onPublishStatusChange(SUCCESS, JSON.parse(xhr.response).message.lbryTx.claim_id); const url = JSON.parse(xhr.response).message.url;
that.props.onPublishStatusChange(SUCCESS, url);
window.location = url;
} else if (xhr.status === 502) { } else if (xhr.status === 502) {
that.props.onPublishStatusChange(FAILED, 'Spee.ch was not able to get a response from the LBRY network.'); that.props.onPublishStatusChange(FAILED, 'Spee.ch was not able to get a response from the LBRY network.');
} else { } else {
@ -172,8 +174,8 @@ class PublishForm extends React.Component {
<PublishMetadataInputs /> <PublishMetadataInputs />
</div> </div>
<div className="row row--padded row--wide"> <div className="row row--padded row--wide align-content-center">
<div className="input-error" id="input-error-publish-submit" hidden="true">{this.state.publishRequestError}</div> <p className="info-message-placeholder info-message--failure">{this.state.publishRequestError}</p>
<button id="publish-submit" className="button--primary button--large" onClick={this.publish}>Publish</button> <button id="publish-submit" className="button--primary button--large" onClick={this.publish}>Publish</button>
</div> </div>