2016-04-10 02:00:56 +02:00
|
|
|
var splashStyle = {
|
|
|
|
color: 'white',
|
|
|
|
backgroundImage: 'url(' + lbry.imagePath('lbry-bg.png') + ')',
|
|
|
|
backgroundSize: 'cover',
|
|
|
|
minHeight: '100vh',
|
|
|
|
minWidth: '100vw',
|
|
|
|
display: 'flex',
|
|
|
|
flexDirection: 'column',
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center'
|
|
|
|
}, splashMessageStyle = {
|
2016-04-14 10:21:36 +02:00
|
|
|
marginTop: '24px',
|
|
|
|
width: '325px',
|
|
|
|
textAlign: 'center',
|
|
|
|
}, splashDetailsStyle = {
|
|
|
|
color: '#c3c3c3',
|
2016-04-10 02:00:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
var SplashScreen = React.createClass({
|
|
|
|
propTypes: {
|
|
|
|
message: React.PropTypes.string,
|
2016-04-14 07:49:00 +02:00
|
|
|
onLoadDone: React.PropTypes.func,
|
|
|
|
},
|
2016-04-14 10:21:36 +02:00
|
|
|
getInitialState: function() {
|
|
|
|
return {
|
|
|
|
details: 'Starting daemon'
|
|
|
|
}
|
|
|
|
},
|
2016-04-14 08:27:06 +02:00
|
|
|
updateStatus: function(checkNum=0, was_lagging=false) {
|
|
|
|
lbry.getDaemonStatus((status) => {
|
|
|
|
if (status.code == 'started') {
|
|
|
|
this.props.onLoadDone();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-04-14 10:21:36 +02:00
|
|
|
if (status.is_lagging) {
|
|
|
|
if (!was_lagging) { // We just started lagging, so display message as alert
|
|
|
|
alert(status.message);
|
|
|
|
}
|
|
|
|
} else { // Not lagging, so display the message normally
|
|
|
|
this.setState({
|
|
|
|
details: status.message
|
|
|
|
});
|
2016-04-14 08:27:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (checkNum < 600) {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.updateStatus(checkNum + 1, status.is_lagging);
|
|
|
|
}, 500);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
2016-04-14 07:49:00 +02:00
|
|
|
componentDidMount: function() {
|
2016-04-14 08:27:06 +02:00
|
|
|
this.updateStatus();
|
2016-04-10 02:00:56 +02:00
|
|
|
},
|
|
|
|
render: function() {
|
|
|
|
var imgSrc = lbry.imagePath('lbry-white-485x160.png');
|
|
|
|
return (
|
|
|
|
<div className="splash-screen" style={splashStyle}>
|
|
|
|
<img src={imgSrc} alt="LBRY"/>
|
|
|
|
<div style={splashMessageStyle}>
|
|
|
|
<h3>
|
|
|
|
{this.props.message}
|
|
|
|
<span className="busy-indicator"></span>
|
|
|
|
</h3>
|
2016-04-14 10:21:36 +02:00
|
|
|
<span style={splashDetailsStyle}>{this.state.details}...</span>
|
2016-04-10 02:00:56 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|