2016-11-22 14:19:08 -06:00
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
import lbry from './lbry.js';
|
2016-12-29 04:41:28 -05:00
|
|
|
import lighthouse from './lighthouse.js';
|
2016-11-22 14:19:08 -06:00
|
|
|
import App from './app.js';
|
|
|
|
import SplashScreen from './component/splash.js';
|
|
|
|
|
|
|
|
|
2016-03-14 18:05:24 -04:00
|
|
|
var init = function() {
|
2017-01-05 17:30:36 -05:00
|
|
|
window.lbry = lbry;
|
2016-12-29 04:41:28 -05:00
|
|
|
if (lbry.getClientSetting('debug')) {
|
|
|
|
window.lighthouse = lighthouse;
|
|
|
|
}
|
|
|
|
|
2016-03-14 18:05:24 -04:00
|
|
|
var canvas = document.getElementById('canvas');
|
|
|
|
|
|
|
|
ReactDOM.render(
|
2016-04-14 01:49:00 -04:00
|
|
|
<SplashScreen message="Connecting" onLoadDone={function() {
|
2016-09-02 03:08:46 -04:00
|
|
|
// 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') {
|
2016-07-04 11:29:58 -04:00
|
|
|
lbry.getBalance((balance) => {
|
|
|
|
if (balance <= 0) {
|
|
|
|
window.location.href = '?claim';
|
|
|
|
} else {
|
|
|
|
ReactDOM.render(<App/>, canvas);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
ReactDOM.render(<App/>, canvas);
|
|
|
|
}
|
2016-04-14 01:49:00 -04:00
|
|
|
}}/>,
|
2016-03-14 18:05:24 -04:00
|
|
|
canvas
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2016-04-12 04:52:42 -04:00
|
|
|
init();
|