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',
|
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 {
|
2016-04-15 12:41:01 +02:00
|
|
|
details: 'Starting daemon',
|
|
|
|
isLagging: false,
|
2016-04-14 10:21:36 +02:00
|
|
|
}
|
|
|
|
},
|
2016-04-18 03:32:45 +02:00
|
|
|
updateStatus: function(was_lagging=false) {
|
2016-04-14 08:27:06 +02:00
|
|
|
lbry.getDaemonStatus((status) => {
|
|
|
|
if (status.code == 'started') {
|
|
|
|
this.props.onLoadDone();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-04-15 12:41:01 +02:00
|
|
|
this.setState({
|
|
|
|
details: status.message + (status.is_lagging ? '' : '...'),
|
|
|
|
isLagging: status.is_lagging,
|
|
|
|
});
|
2016-04-14 08:27:06 +02:00
|
|
|
|
2016-04-18 03:32:45 +02:00
|
|
|
setTimeout(() => {
|
|
|
|
this.updateStatus(status.is_lagging);
|
|
|
|
}, 500);
|
2016-04-14 08:27:06 +02:00
|
|
|
});
|
|
|
|
},
|
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>
|
2016-08-21 16:55:32 +02:00
|
|
|
<BusyMessage message={this.props.message} />
|
2016-04-10 02:00:56 +02:00
|
|
|
</h3>
|
2016-04-15 12:41:01 +02:00
|
|
|
<Icon icon='icon-warning' style={this.state.isLagging ? {} : { display: 'none' }}/> <span style={ this.state.isLagging ? {} : {'color': '#c3c3c3'} }>{this.state.details}</span>
|
2016-04-10 02:00:56 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|