diff options
author | elijah <elijah@riseup.net> | 2016-11-08 13:56:15 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2016-11-08 13:56:15 -0800 |
commit | 54613799b6277cfaf5636f9a193a70622ba0c0ae (patch) | |
tree | c5d4fa6a9582c675433a4c3da1475a1eed450a18 /ui | |
parent | 9d845e98a2a5cda8aaa22f581e28506a627dca43 (diff) |
ui: disable account remove button when appropriate
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/components/main_panel/account_list.js | 3 | ||||
-rw-r--r-- | ui/app/components/main_panel/index.js | 13 |
2 files changed, 10 insertions, 6 deletions
diff --git a/ui/app/components/main_panel/account_list.js b/ui/app/components/main_panel/account_list.js index 36b6c18..85d6824 100644 --- a/ui/app/components/main_panel/account_list.js +++ b/ui/app/components/main_panel/account_list.js @@ -80,12 +80,13 @@ export default class AccountList extends React.Component { <Glyphicon glyph="triangle-left" /> </Button> ) + let removeDisabled = !this.props.account || this.props.account.authenticated plusminusButtons = ( <ButtonGroup style={style}> <Button onClick={this.add} className="btn-inverse"> <Glyphicon glyph="plus" /> </Button> - <Button disabled={this.props.account == null} onClick={this.askRemove} className="btn-inverse"> + <Button disabled={removeDisabled} onClick={this.askRemove} className="btn-inverse"> <Glyphicon glyph="minus" /> </Button> </ButtonGroup> diff --git a/ui/app/components/main_panel/index.js b/ui/app/components/main_panel/index.js index 1948535..2949b1b 100644 --- a/ui/app/components/main_panel/index.js +++ b/ui/app/components/main_panel/index.js @@ -50,11 +50,14 @@ export default class MainPanel extends React.Component { removeAccount(account) { Account.remove(account).then( newActiveAccount => { - console.log(newActiveAccount) - this.setState({ - account: newActiveAccount, - accounts: Account.list - }) + if (newActiveAccount == null) { + App.start() + } else { + this.setState({ + account: newActiveAccount, + accounts: Account.list + }) + } }, error => { console.log(error) |