LBRY couldn't connect to our servers to confirm your invitation code. Please check your internet connection.
+ If you continue to have problems, you can still browse LBRY and visit the Settings page to redeem your code later. +diff --git a/dist/img/warning.png b/dist/img/warning.png new file mode 100644 index 000000000..c15cc246a Binary files /dev/null and b/dist/img/warning.png differ diff --git a/dist/index.html b/dist/index.html index 3ecc0a4d2..2bc0d6e83 100644 --- a/dist/index.html +++ b/dist/index.html @@ -20,8 +20,9 @@
- - + + + @@ -32,6 +33,7 @@ + diff --git a/js/app.js b/js/app.js index 1306ae5c7..f4fc8adad 100644 --- a/js/app.js +++ b/js/app.js @@ -1,4 +1,13 @@ var App = React.createClass({ + _error_key_labels: { + connectionString: 'API connection string', + method: 'Method', + params: 'Parameters', + code: 'Error code', + message: 'Error message', + data: 'Error data', + }, + getInitialState: function() { // For now, routes are in format ?page or ?page=args var match, param, val, viewingPage, @@ -11,35 +20,42 @@ var App = React.createClass({ viewingPage: viewingPage, drawerOpen: drawerOpenRaw !== null ? JSON.parse(drawerOpenRaw) : true, pageArgs: val, + errorInfo: null, + modal: null, + startNotice: null, + updateUrl: null, + isOldOSX: null, }; }, componentDidMount: function() { lbry.getStartNotice(function(notice) { if (notice) { - alert(notice); + this.setState({ + modal: 'startNotice', + startNotice: notice + }); } }); }, componentWillMount: function() { - lbry.checkNewVersionAvailable(function(isAvailable) { + document.addEventListener('unhandledError', (event) => { + this.alertError(event.detail); + }); + lbry.checkNewVersionAvailable((isAvailable) => { if (!isAvailable || sessionStorage.getItem('upgradeSkipped')) { return; } - var message = 'The version of LBRY you\'re using is not up to date.\n\n' + - 'Choose "OK" to download the latest version.'; - - lbry.getVersionInfo(function(versionInfo) { + lbry.getVersionInfo((versionInfo) => { + var isOldOSX = false; if (versionInfo.os_system == 'Darwin') { var updateUrl = 'https://lbry.io/get/lbry.dmg'; var maj, min, patch; [maj, min, patch] = versionInfo.lbrynet_version.split('.'); if (maj == 0 && min <= 2 && patch <= 2) { - // On OS X with version <= 0.2.2, we need to notify user to close manually close LBRY - message += '\n\nBefore installing the new version, make sure to exit LBRY, if you started the app ' + - 'click that LBRY icon in your status bar and choose "Quit."'; + isOldOSX = true; } } else if (versionInfo.os_system == 'Linux') { var updateUrl = 'https://lbry.io/get/lbry.deb'; @@ -49,13 +65,11 @@ var App = React.createClass({ var updateUrl = 'https://lbry.io/get'; } - if (window.confirm(message)) - { - lbry.stop(); - window.location = updateUrl; - } else { - sessionStorage.setItem('upgradeSkipped', true); - }; + this.setState({ + modal: 'upgrade', + isOldOSX: isOldOSX, + updateUrl: updateUrl, + }) }); }); }, @@ -67,12 +81,40 @@ var App = React.createClass({ sessionStorage.setItem('drawerOpen', false); this.setState({ drawerOpen: false }); }, + closeModal: function() { + this.setState({ + modal: null, + }); + }, + handleUpgradeClicked: function() { + lbry.stop(); + window.location = this.state.updateUrl; + }, + handleSkipClicked: function() { + sessionStorage.setItem('upgradeSkipped', true); + this.setState({ + modal: null, + }); + }, onSearch: function(term) { this.setState({ viewingPage: 'discover', pageArgs: term }); }, + alertError: function(error) { + var errorInfoList = []; + for (let key of Object.keys(error)) { + let val = typeof error[key] == 'string' ? error[key] : JSON.stringify(error[key]); + let label = this._error_key_labels[key]; + errorInfoList.push({val}
The version of LBRY you're using is not up to date. Choose "Upgrade" to get the latest version.
+ {this.state.isOldOSX + ?Before installing the new version, make sure to exit LBRY. If you started the app, click the LBRY icon in your status bar and choose "Quit."
+ : null} + +We're sorry that LBRY has encountered an error. This has been reported and we will investigate the problem.
+LBRY couldn't connect to our servers to confirm your invitation code. Please check your internet connection.
+ If you continue to have problems, you can still browse LBRY and visit the Settings page to redeem your code later. +Your file has been published to LBRY at the address lbry://{this.state.name}
!
{description}
@@ -117,7 +117,7 @@ var DetailPage = React.createClass({ componentWillMount: function() { document.title = 'lbry://' + this.props.name; - lbry.search(this.props.name, (results) => { + lbry.lighthouse.search(this.props.name, (results) => { var result = results[0]; if (result.name != this.props.name) { diff --git a/js/page/wallet.js b/js/page/wallet.js index a6eaa690c..7f5c536cc 100644 --- a/js/page/wallet.js +++ b/js/page/wallet.js @@ -17,6 +17,7 @@ var AddressSection = React.createClass({ getInitialState: function() { return { address: null, + modal: null, } }, componentWillMount: function() { @@ -58,7 +59,9 @@ var SendToAddressSection = React.createClass({ if ((this.state.balance - this.state.amount) < 1) { - alert("Insufficient balance: after this transaction you would have less than 1 LBC in your wallet.") + this.setState({ + modal: 'insufficientBalance', + }); return; } @@ -85,6 +88,11 @@ var SendToAddressSection = React.createClass({ }) }); }, + closeModal: function() { + this.setState({ + modal: null, + }); + }, getInitialState: function() { return { address: "", @@ -136,6 +144,9 @@ var SendToAddressSection = React.createClass({ : '' } +