Add Cancel link when loading screen is lagging

This commit is contained in:
Alex Liebowitz 2017-01-31 02:02:15 -05:00
parent 34d04255de
commit 810b94fa77

View file

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import lbry from '../lbry.js'; import lbry from '../lbry.js';
import {BusyMessage, Icon} from './common.js'; import {BusyMessage, Icon} from './common.js';
import {Link} from '../component/link.js'
var LoadScreen = React.createClass({ var LoadScreen = React.createClass({
propTypes: { propTypes: {
@ -8,6 +9,9 @@ var LoadScreen = React.createClass({
details: React.PropTypes.string, details: React.PropTypes.string,
isWarning: React.PropTypes.bool, isWarning: React.PropTypes.bool,
}, },
handleCancelClick: function() {
history.back();
},
getDefaultProps: function() { getDefaultProps: function() {
return { return {
isWarning: false, isWarning: false,
@ -21,7 +25,7 @@ var LoadScreen = React.createClass({
} }
}, },
render: function() { render: function() {
var imgSrc = lbry.imagePath('lbry-white-485x160.png'); const imgSrc = lbry.imagePath('lbry-white-485x160.png');
return ( return (
<div className="load-screen"> <div className="load-screen">
<img src={imgSrc} alt="LBRY"/> <img src={imgSrc} alt="LBRY"/>
@ -29,7 +33,10 @@ var LoadScreen = React.createClass({
<h3> <h3>
<BusyMessage message={this.props.message} /> <BusyMessage message={this.props.message} />
</h3> </h3>
{this.props.isWarning ? <Icon icon="icon-warning" /> : null} <span className={'load-screen__details ' + (this.props.isWarning ? 'load-screen__details--warning' : '')}>{this.props.details}</span> {!this.props.isWarning ? <Icon icon="icon-warning" /> : null} <span className={'load-screen__details ' + (!this.props.isWarning ? 'load-screen__details--warning' : '')}>{this.props.details}</span>
{!this.props.isWarning
? <div><Link label="Cancel" onClick={this.handleCancelClick} className='load-screen__cancel-link button-text' /></div>
: null}
</div> </div>
</div> </div>
); );