diff --git a/packages/page-council/src/Overview/Voters.tsx b/packages/page-council/src/Overview/Voters.tsx index 14ae6f5a34..60e8fe7c66 100644 --- a/packages/page-council/src/Overview/Voters.tsx +++ b/packages/page-council/src/Overview/Voters.tsx @@ -19,7 +19,14 @@ function Voters ({ balance, voters }: Props): React.ReactElement | null { } return ( -  ({voters.length})}> + + } + > {voters.map((who): React.ReactNode => -  ({formatNumber(nominators.length)}) - + }> {nominators.map(([who, bonded]): React.ReactNode => - + {isMain diff --git a/packages/page-staking/src/Targets/Validator.tsx b/packages/page-staking/src/Targets/Validator.tsx index ff9cc11dd4..ccb4051a8d 100644 --- a/packages/page-staking/src/Targets/Validator.tsx +++ b/packages/page-staking/src/Targets/Validator.tsx @@ -44,7 +44,12 @@ function Validator ({ info: { accountId, bondOther, bondOwn, bondTotal, commissi -  ({formatNumber(numNominators)}) + + + { - const [properties, systemChain, systemName, systemVersion, injectedAccounts] = await Promise.all([ + const [properties, systemChain, systemChainType, systemName, systemVersion, injectedAccounts] = await Promise.all([ api.rpc.system.properties(), api.rpc.system.chain(), + api.rpc.system.chainType + ? api.rpc.system.chainType() + : Promise.resolve(registry.createType('ChainType', 'Live')), api.rpc.system.name(), api.rpc.system.version(), injectedPromise .then(() => web3Accounts()) - .then((accounts): InjectedAccountExt[] => - accounts.map(({ address, meta }): InjectedAccountExt => ({ - address, - meta: { - ...meta, - name: `${meta.name} (${meta.source === 'polkadot-js' ? 'extension' : meta.source})` - } - })) - ) + .then((accounts) => accounts.map(({ address, meta }): InjectedAccountExt => ({ + address, + meta: { + ...meta, + name: `${meta.name} (${meta.source === 'polkadot-js' ? 'extension' : meta.source})` + } + }))) .catch((error): InjectedAccountExt[] => { console.error('web3Enable', error); @@ -84,21 +86,22 @@ async function retrieve (api: ApiPromise): Promise { injectedAccounts, properties, systemChain: (systemChain || '').toString(), + systemChainType, systemName: systemName.toString(), systemVersion: systemVersion.toString() }; } async function loadOnReady (api: ApiPromise): Promise { - const { injectedAccounts, properties, systemChain, systemName, systemVersion } = await retrieve(api); + const { injectedAccounts, properties, systemChain, systemChainType, systemName, systemVersion } = await retrieve(api); const ss58Format = uiSettings.prefix === -1 ? properties.ss58Format.unwrapOr(DEFAULT_SS58).toNumber() : uiSettings.prefix; const tokenSymbol = properties.tokenSymbol.unwrapOr(undefined)?.toString(); const tokenDecimals = properties.tokenDecimals.unwrapOr(DEFAULT_DECIMALS).toNumber(); - const isDevelopment = isTestChain(systemChain); + const isDevelopment = systemChainType.isDevelopment || systemChainType.isLocal || isTestChain(systemChain); - console.log('api: found chain', systemChain, JSON.stringify(properties)); + console.log(`chain: ${systemChain} (${systemChainType}), ${JSON.stringify(properties)}`); // explicitly override the ss58Format as specified registry.setChainProperties(registry.createType('ChainProperties', { ...properties, ss58Format })); diff --git a/packages/react-components/src/AddressInfo.tsx b/packages/react-components/src/AddressInfo.tsx index cabd7b4fa9..2b81324776 100644 --- a/packages/react-components/src/AddressInfo.tsx +++ b/packages/react-components/src/AddressInfo.tsx @@ -9,7 +9,7 @@ import { BareProps } from './types'; import BN from 'bn.js'; import React from 'react'; import styled from 'styled-components'; -import { formatBalance, formatNumber, isObject } from '@polkadot/util'; +import { formatBalance, formatNumber, hexToString, isObject } from '@polkadot/util'; import { Expander, Icon, Tooltip } from '@polkadot/react-components'; import { withCalls, withMulti } from '@polkadot/react-api/hoc'; import { useAccounts } from '@polkadot/react-hooks'; @@ -256,12 +256,12 @@ function renderBalances (props: Props, allAccounts: string[], t: (key: string) = name='info circle' /> ( + text={balancesAll.lockedBreakdown.map(({ amount, id, reasons }, index): React.ReactNode => (
{amount.isMax() ? t('everything') : formatBalance(amount, { forceUnit: '-' }) - }
{reasons.toString()}
+ }{id &&
{hexToString(id.toHex())}
}
{reasons.toString()}
))} trigger={`${address}-locks-trigger`} diff --git a/packages/react-components/src/Expander.tsx b/packages/react-components/src/Expander.tsx index 66c7e0849f..143d839e60 100644 --- a/packages/react-components/src/Expander.tsx +++ b/packages/react-components/src/Expander.tsx @@ -102,6 +102,10 @@ export default React.memo(styled(Expander)` min-width: 12rem; overflow: hidden; + .ui--Expander-summary-header > .ui--FormatBalance { + min-width: 12rem; + } + > div { overflow: hidden; text-overflow: ellipsis; diff --git a/packages/react-components/src/Tooltip.tsx b/packages/react-components/src/Tooltip.tsx index fc76aa1d6c..b0193e0e6b 100644 --- a/packages/react-components/src/Tooltip.tsx +++ b/packages/react-components/src/Tooltip.tsx @@ -85,10 +85,15 @@ export default React.memo(styled(Tooltip)` } .faded { + margin-top: -0.25rem; opacity: 0.75 !important; font-size: 0.75em !important; } + .faded+.faded { + margin-top: -0.5rem; + } + .row+.row { margin-top: 0.5rem; } diff --git a/packages/react-query/src/FormatBalance.tsx b/packages/react-query/src/FormatBalance.tsx index b084e01eaa..652f96c541 100644 --- a/packages/react-query/src/FormatBalance.tsx +++ b/packages/react-query/src/FormatBalance.tsx @@ -16,6 +16,7 @@ interface Props extends BareProps { children?: React.ReactNode; isShort?: boolean; label?: React.ReactNode; + labelPost?: React.ReactNode; value?: Compact | BN | string | null | 'all'; withSi?: boolean; } @@ -48,7 +49,7 @@ function format (value: Compact | BN | string, currency: string, withSi?: b // return <>{prefix}.{`000${postfix || ''}`.slice(-3)}{unit === '-' ? '' : unit}; // } -function FormatBalance ({ children, className, isShort, label, value, withSi }: Props): React.ReactElement { +function FormatBalance ({ children, className, isShort, label, labelPost, value, withSi }: Props): React.ReactElement { const { t } = useTranslation(); const [currency] = useState(formatBalance.getDefaults().unit); @@ -60,7 +61,7 @@ function FormatBalance ({ children, className, isShort, label, value, withSi }: ? t('everything') : format(value, currency, withSi, isShort) : '-' - }{children} + }{labelPost}{children} ); }