From e6d8e3ad2bbdcb272658e678cf661c7a05909459 Mon Sep 17 00:00:00 2001 From: Tom Beynon Date: Wed, 2 Mar 2022 02:10:07 +0000 Subject: [PATCH] Improve REStake UX --- src/components/DelegateForm.js | 6 +--- src/components/Delegations.js | 52 +++++++++++++++------------------- src/components/Validators.js | 2 +- 3 files changed, 25 insertions(+), 35 deletions(-) diff --git a/src/components/DelegateForm.js b/src/components/DelegateForm.js index 7ce2cd78..a431652d 100644 --- a/src/components/DelegateForm.js +++ b/src/components/DelegateForm.js @@ -96,11 +96,7 @@ class DelegateForm extends React.Component { actionText(){ if(this.props.redelegate) return 'Redelegate' if(this.props.undelegate) return 'Undelegate' - if(this.props.validator){ - return 'Delegate' - }else{ - return 'Add Validator' - } + return 'Delegate' } denom(){ diff --git a/src/components/Delegations.js b/src/components/Delegations.js index cc82d748..3cdc2373 100644 --- a/src/components/Delegations.js +++ b/src/components/Delegations.js @@ -103,7 +103,7 @@ class Delegations extends React.Component { this.props.restClient.getGrants(this.props.network.data.testaddress, this.props.address) .then( (result) => { }, (error) => { - if (error.response.status === 501) { + if (error.response && error.response.status === 501) { this.setState({ authzMissing: true }); } }) @@ -227,34 +227,31 @@ class Delegations extends React.Component { stargateClient={this.props.stargateClient} onDelegate={this.onClaimRewards}>{validator.description.moniker} - {operator ? : } + + {operator ? this.restakePossible() ? ( + this.grantsValid(operator) ? ( + + ) : ( + + ) + ) : : } + {validator.commission.commission_rates.rate * 100}% {rewards && rewards.reward.map(el => )} - {this.restakePossible() && ( - - {operator && ( - this.grantsValid(operator) ? ( - - ) : ( - - ) - )} - - )}
{!this.state.validatorLoading[validatorAddress] @@ -390,14 +387,11 @@ class Delegations extends React.Component { Validator - Operator + REStake Commission APY Delegation Rewards - {this.restakePossible() && - REStake - } diff --git a/src/components/Validators.js b/src/components/Validators.js index 623aed5b..fdd137c3 100644 --- a/src/components/Validators.js +++ b/src/components/Validators.js @@ -81,7 +81,7 @@ function Validators(props) { Validator - Operator + REStake {filteredOperators.map(([validator_address, item], i) => renderItem(item, true))}