Skip to content

Commit

Permalink
Merge pull request #85 from remotestorage/feature/26-connect_button
Browse files Browse the repository at this point in the history
Disable connect button when connecting
  • Loading branch information
raucao authored Jan 19, 2018
2 parents 3c385ee + cfc53b1 commit 1ffead5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/assets/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ polygon.rs-logo-shape,
.rs-sign-in-form input[type=submit]:active {
background-color: #3fb34f;
}
.rs-sign-in-form input[type=submit]:disabled,
.rs-sign-in-form input[type=submit]:disabled:hover {
background-color: #aaa;
}

.rs-sign-in-error.rs-hidden,
.rs-box-error.rs-hidden {
Expand Down
4 changes: 2 additions & 2 deletions src/assets/widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,9 @@ <h1 class="rs-big-headline">Connect your storage</h1>
<div class="rs-content">
<form name="rs-sign-in-form" class="rs-sign-in-form">
<h1 class="rs-big-headline">Connect your storage</h1>
<input type="text" name='rs-user-address' placeholder="[email protected]" autocapitalize="off">
<input type="text" name="rs-user-address" placeholder="[email protected]" autocapitalize="off">
<div class="rs-sign-in-error rs-hidden"></div>
<input type="submit" value="Connect">
<input type="submit" class="rs-connect" value="Connect">
<a href="https://remotestorage.io/get/" class="rs-help" target="_blank">Need help?</a>
</form>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ Widget.prototype = {
}

this.rsSignInForm = document.querySelector('.rs-sign-in-form');
this.rsConnectButton = document.querySelector('.rs-connect');

this.rsDisconnectButton = document.querySelector('.rs-disconnect');
this.rsSyncButton = document.querySelector('.rs-sync');
Expand Down Expand Up @@ -256,6 +257,7 @@ Widget.prototype = {
this.rsSignInForm.addEventListener('submit', (e) => {
e.preventDefault();
let userAddress = document.querySelector('input[name=rs-user-address]').value;
this.rsConnectButton.disabled = true;
this.rs.connect(userAddress);
});
},
Expand Down Expand Up @@ -428,6 +430,7 @@ Widget.prototype = {
msgContainer.innerHTML = error.message;
msgContainer.classList.remove('rs-hidden');
msgContainer.classList.add('rs-visible');
this.rsConnectButton.disabled = false;
},

handleSyncError (/* error */) {
Expand Down

0 comments on commit 1ffead5

Please sign in to comment.