From b99aaba13706947294dfaba18b19f178b11d06c2 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 17 Dec 2018 12:44:04 -0800 Subject: [PATCH 1/2] Improve EIP 1102 Support My previous 1102 PR was not ideal: It was still using the account-polling logic for the `enable()` function, which meant if a user declined the login, it would keep re-requesting it in a loop. This version replaces the account polling with a `Connect` button on the no-accounts view, giving the user a graceful and patient place to initiate the login process in a way that should be compatible with all major web3 browsers. This broke the tests again, sorry about that, I kindof just got this good enough for my personal uses at the moment. --- src/AccountUnavailable.jsx | 12 ----------- src/Login.jsx | 34 ++++++++++++++++++++++++++++++ src/Web3Provider.jsx | 43 ++++++++++++++++++++++++++++++-------- src/stylesheet.js | 40 +++++++++++++++++++++++++++++++++++ 4 files changed, 108 insertions(+), 21 deletions(-) delete mode 100644 src/AccountUnavailable.jsx create mode 100644 src/Login.jsx diff --git a/src/AccountUnavailable.jsx b/src/AccountUnavailable.jsx deleted file mode 100644 index a155d5a..0000000 --- a/src/AccountUnavailable.jsx +++ /dev/null @@ -1,12 +0,0 @@ -const React = require('react'); -const ErrorTemplate = require('./ErrorTemplate'); - -const AccountUnavailable = ErrorTemplate.bind(null, { - title: 'No ETH Account Available', - message: ` -It seems that you don't have an ETH account selected. If using -MetaMask, please make sure that your wallet is unlocked and that -you have at least one account in your accounts list.` -}); - -module.exports = AccountUnavailable; diff --git a/src/Login.jsx b/src/Login.jsx new file mode 100644 index 0000000..d1d1d9d --- /dev/null +++ b/src/Login.jsx @@ -0,0 +1,34 @@ +const React = require('react'); +const IconNoWeb3 = require('./IconNoWeb3'); +const stylesheet = require('./stylesheet'); + +let requestLogin +function LoginView(props) { + requestLogin = props.requestLogin.bind(this) + return ( +
+