2016-11-22 21:19:08 +01:00
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
import lbry from './lbry.js';
|
2016-12-29 10:41:28 +01:00
|
|
|
import lighthouse from './lighthouse.js';
|
2016-11-22 21:19:08 +01:00
|
|
|
import App from './app.js';
|
|
|
|
import SplashScreen from './component/splash.js';
|
|
|
|
|
|
|
|
|
2016-03-14 23:05:24 +01:00
|
|
|
var init = function() {
|
2017-01-05 23:30:36 +01:00
|
|
|
window.lbry = lbry;
|
2016-12-29 10:41:28 +01:00
|
|
|
if (lbry.getClientSetting('debug')) {
|
|
|
|
window.lighthouse = lighthouse;
|
|
|
|
}
|
|
|
|
|
2016-03-14 23:05:24 +01:00
|
|
|
var canvas = document.getElementById('canvas');
|
2017-02-21 05:15:17 +01:00
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
<SplashScreen message="Connecting" onLoadDone={function() {
|
|
|
|
// Redirect to the claim code page if needed. Find somewhere better for this logic
|
|
|
|
if (!localStorage.getItem('claimCodeDone') && window.location.search == '' || window.location.search == '?' || window.location.search == 'discover') {
|
|
|
|
lbry.getBalance((balance) => {
|
|
|
|
if (balance <= 0) {
|
|
|
|
window.location.href = '?claim';
|
|
|
|
} else {
|
2016-07-04 17:29:58 +02:00
|
|
|
ReactDOM.render(<App/>, canvas);
|
2017-02-21 05:15:17 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
ReactDOM.render(<App/>, canvas);
|
|
|
|
}
|
|
|
|
}}/>,
|
|
|
|
canvas
|
|
|
|
);
|
2016-03-14 23:05:24 +01:00
|
|
|
};
|
|
|
|
|
2016-04-12 10:52:42 +02:00
|
|
|
init();
|