From e88e435dde461b5f8f317cd4cda235e4aeaa2fca Mon Sep 17 00:00:00 2001 From: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> Date: Thu, 30 May 2019 11:27:43 +0200 Subject: [PATCH] Use derive staking info (#1239) * use derive.staking.info * tooltip on button & remove unlock comp * merge master fix * duplicate Bonded * translation and lint * comments --- packages/ui-app/src/AddressInfo.tsx | 95 +++++++++--- packages/ui-app/src/AddressRow.tsx | 1 - packages/ui-app/src/AddressSummary.tsx | 23 +-- packages/ui-app/src/TxButton.tsx | 4 +- packages/ui-app/src/Unlocking.tsx | 35 ----- packages/ui-app/src/index.tsx | 1 - packages/ui-app/src/styles/components.css | 20 --- packages/ui-reactive/src/Unlocking.tsx | 173 ---------------------- packages/ui-reactive/src/index.ts | 1 - 9 files changed, 81 insertions(+), 272 deletions(-) delete mode 100644 packages/ui-app/src/Unlocking.tsx delete mode 100644 packages/ui-reactive/src/Unlocking.tsx diff --git a/packages/ui-app/src/AddressInfo.tsx b/packages/ui-app/src/AddressInfo.tsx index 4183aeff9a..531a8edbb9 100644 --- a/packages/ui-app/src/AddressInfo.tsx +++ b/packages/ui-app/src/AddressInfo.tsx @@ -2,25 +2,25 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedBalances } from '@polkadot/api-derive/types'; +import { DerivedBalances, DerivedStaking } from '@polkadot/api-derive/types'; import { BareProps, I18nProps } from './types'; import React from 'react'; import styled from 'styled-components'; -import { withCalls, withMulti } from '@polkadot/ui-api'; import { formatBalance, formatNumber } from '@polkadot/util'; +import { Icon, Tooltip, TxButton } from '@polkadot/ui-app'; +import { withCalls, withMulti } from '@polkadot/ui-api'; import translate from './translate'; import CryptoType from './CryptoType'; -import Bonded from './Bonded'; import Label from './Label'; -import Unlocking from './Unlocking'; type Props = BareProps & I18nProps & { balances_all?: DerivedBalances, children?: React.ReactNode, + staking_info?: DerivedStaking, value: string, - withBalance?: boolean | { available?: boolean, bonded?: boolean, free?: boolean, locked?: boolean }, + withBalance?: boolean | { available?: boolean, bonded?: boolean, free?: boolean, redeemable?: boolean, unlocking?: boolean }, withExtended?: boolean | { crypto?: boolean, nonce?: boolean } }; @@ -51,9 +51,9 @@ class AddressInfo extends React.PureComponent { } private renderBalances () { - const { balances_all, t, value, withBalance = true } = this.props; + const { balances_all, staking_info, t, withBalance = true } = this.props; const balanceDisplay = withBalance === true - ? { available: true, bonded: true, free: true, locked: true } + ? { available: true, bonded: true, free: true, redeemable: true, unlocking: true } : withBalance ? withBalance : undefined; @@ -79,19 +79,28 @@ class AddressInfo extends React.PureComponent { {balanceDisplay.bonded && ( <>