From edc4ee24f220648c3a68022dfe808d86a0196d9c Mon Sep 17 00:00:00 2001 From: bill bittner Date: Fri, 12 Jan 2018 10:21:40 -0800 Subject: [PATCH] added forwarding to asset show page when publish is complete --- public/assets/css/general.css | 2 +- public/assets/js/generalFunctions.js | 19 +++++++++++++++++++ react/components/PublishStatus.jsx | 3 ++- react/containers/ChannelCreateForm.jsx | 2 +- react/containers/ChannelLoginForm.jsx | 2 +- react/containers/PublishForm.jsx | 12 +++++++----- react/utils/{pageUpdate.js => page.js} | 0 7 files changed, 31 insertions(+), 9 deletions(-) rename react/utils/{pageUpdate.js => page.js} (100%) diff --git a/public/assets/css/general.css b/public/assets/css/general.css index 9625166f..1e6d5b86 100644 --- a/public/assets/css/general.css +++ b/public/assets/css/general.css @@ -507,7 +507,7 @@ table { /* Assets */ .asset { - max-width: 100%; + width: 100%; } #show-body #asset-boilerpate { diff --git a/public/assets/js/generalFunctions.js b/public/assets/js/generalFunctions.js index b7e389b6..8f5dc4c7 100644 --- a/public/assets/js/generalFunctions.js +++ b/public/assets/js/generalFunctions.js @@ -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; diff --git a/react/components/PublishStatus.jsx b/react/components/PublishStatus.jsx index ce7bce99..0ca3951a 100644 --- a/react/components/PublishStatus.jsx +++ b/react/components/PublishStatus.jsx @@ -33,7 +33,8 @@ function PublishStatus ({ status, message }) { } {(status === SUCCESS) &&
- {message} +

Your publish is complete! You are being redirected to it now.

+

If you are not automatically redirected, click here.

} {(status === FAILED) && diff --git a/react/containers/ChannelCreateForm.jsx b/react/containers/ChannelCreateForm.jsx index 008f2d0b..1e2326ad 100644 --- a/react/containers/ChannelCreateForm.jsx +++ b/react/containers/ChannelCreateForm.jsx @@ -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) { diff --git a/react/containers/ChannelLoginForm.jsx b/react/containers/ChannelLoginForm.jsx index 47beaf34..e60042f8 100644 --- a/react/containers/ChannelLoginForm.jsx +++ b/react/containers/ChannelLoginForm.jsx @@ -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) { diff --git a/react/containers/PublishForm.jsx b/react/containers/PublishForm.jsx index 5df38ba6..89cea2ec 100644 --- a/react/containers/PublishForm.jsx +++ b/react/containers/PublishForm.jsx @@ -44,11 +44,11 @@ class PublishForm extends React.Component { } // is there a claim chosen? 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 (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? resolve(); @@ -79,7 +79,9 @@ class PublishForm extends React.Component { 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); + const url = JSON.parse(xhr.response).message.url; + that.props.onPublishStatusChange(SUCCESS, url); + window.location = url; } 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 { -
- +
+

{this.state.publishRequestError}

diff --git a/react/utils/pageUpdate.js b/react/utils/page.js similarity index 100% rename from react/utils/pageUpdate.js rename to react/utils/page.js