From c3073a7d65bc27d6c5c193e2f41d7d71bda7d842 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 8 Apr 2019 08:20:01 +0200 Subject: [PATCH] Combine controller/session when the same (#917) --- packages/app-staking/src/Overview/Address.tsx | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/packages/app-staking/src/Overview/Address.tsx b/packages/app-staking/src/Overview/Address.tsx index 80227f0bdf..4436f5dc97 100644 --- a/packages/app-staking/src/Overview/Address.tsx +++ b/packages/app-staking/src/Overview/Address.tsx @@ -91,10 +91,7 @@ class Address extends React.PureComponent { withCopy={false} withNonce={false} > -
- {this.renderControllerId()} - {this.renderSessionId()} -
+ {this.renderKeys()} {this.renderNominators()} {this.renderOffline()} @@ -131,34 +128,35 @@ class Address extends React.PureComponent { this.setState({ badgeExpanded: !badgeExpanded }); } - private renderControllerId () { + private renderKeys () { const { t } = this.props; - const { bondedId } = this.state; - - if (!bondedId) { - return null; - } + const { bondedId, sessionId } = this.state; + const isSame = bondedId === sessionId; return ( -
- - -
- ); - } - - private renderSessionId () { - const { t } = this.props; - const { sessionId } = this.state; - - if (!sessionId) { - return null; - } - - return ( -
- - +
+ {bondedId + ? ( +
+ + +
+ ) + : null + } + {!isSame && sessionId + ? ( +
+ + +
+ ) + : null + }
); }