diff --git a/packages/apps/public/index.html b/packages/apps/public/index.html index c5172318c4..abd1dfd127 100644 --- a/packages/apps/public/index.html +++ b/packages/apps/public/index.html @@ -29,6 +29,7 @@ --bg-table: #3b3d3f; --bg-tabs: #38393f; --bg-toggle: #58595f; + --bg-sidebar: #1a1b20; --border-table: #343536; --border-tabs: #343536; --color-checkbox: rgba(78, 78, 78, 0.66); @@ -49,6 +50,7 @@ --bg-table: #ffffff; --bg-tabs: #ffffff; --bg-toggle: #e4e5e6; + --bg-sidebar: #fafafa; --border-table: #f1efed; --border-tabs: #f1efed; --color-checkbox: rgba(34, 36, 38, 0.15); diff --git a/packages/apps/public/locales/en/app-accounts.json b/packages/apps/public/locales/en/app-accounts.json index 9da8893091..464769c6c2 100644 --- a/packages/apps/public/locales/en/app-accounts.json +++ b/packages/apps/public/locales/en/app-accounts.json @@ -109,7 +109,6 @@ "Nominator": "Nominator", "Normal transfer without keep-alive checks": "Normal transfer without keep-alive checks", "One or more extensions are detected in your browser, however no accounts has been injected.": "One or more extensions are detected in your browser, however no accounts has been injected.", - "Owned": "Owned", "Password are ignored for hex seed": "Password are ignored for hex seed", "Pending call hashes": "Pending call hashes", "Please make sure to save this file in a secure location as it is required, together with your password, to restore your account.": "Please make sure to save this file in a secure location as it is required, together with your password, to restore your account.", @@ -337,10 +336,8 @@ "somebody@example.com": "somebody@example.com", "sort by": "sort by", "stash address": "stash address", - "sub": "sub", "sub name": "sub name", "subs": "subs", - "tags": "tags", "the account to make recoverable": "the account to make recoverable", "the account to recover to": "the account to recover to", "threshold": "threshold", diff --git a/packages/page-accounts/src/Accounts/index.spec.ts b/packages/page-accounts/src/Accounts/index.spec.ts index b972585f85..2c8dcd174c 100644 --- a/packages/page-accounts/src/Accounts/index.spec.ts +++ b/packages/page-accounts/src/Accounts/index.spec.ts @@ -1,21 +1,18 @@ // Copyright 2017-2021 @polkadot/page-accounts authors & contributors // SPDX-License-Identifier: Apache-2.0 -import { fireEvent, screen, waitFor } from '@testing-library/react'; +import { screen } from '@testing-library/react'; import BN from 'bn.js'; import i18next from '@polkadot/react-components/i18n'; import toShortAddress from '@polkadot/react-components/util/toShortAddress'; -import { AddressFlags } from '@polkadot/react-hooks/types'; import { anAccountWithBalance, anAccountWithBalanceAndMeta, anAccountWithInfo, anAccountWithMeta, anAccountWithStaking } from '@polkadot/test-support/creation/account'; import { makeStakingLedger as ledger } from '@polkadot/test-support/creation/stakingInfo/stakingLedger'; import { alice, MemoryStore } from '@polkadot/test-support/keyring'; import { Table } from '@polkadot/test-support/pagesElements'; -import { Sidebar } from '@polkadot/test-support/pagesElements/Sidebar'; import { balance, showBalance } from '@polkadot/test-support/utils/balance'; import { keyring } from '@polkadot/ui-keyring'; -import { AccountRow } from '../../test/pageElements/AccountRow'; import { AccountsPage } from '../../test/pages/accountsPage'; describe('Accounts page', () => { @@ -368,121 +365,4 @@ describe('Accounts page', () => { }); }); }); - - describe('sidebar', () => { - const initialName = 'INITIAL_NAME'; - const newName = 'NEW_NAME'; - const defaultTag = 'Default'; - const nameInputNotFoundError = 'Unable to find an element by: [data-testid="name-input"]'; - - let accountRows: AccountRow[]; - let sideBar: Sidebar; - - describe('changes name', () => { - beforeEach(async () => { - accountsPage.render([[alice, anAccountWithMeta({ isDevelopment: false, name: initialName })]]); - accountRows = await accountsPage.getAccountRows(); - sideBar = await accountRows[0].openSidebar(); - await sideBar.changeAccountName(newName); - }); - - it('within keyring', () => { - const changedAccount = keyring.getAccount(alice); - - expect(changedAccount?.meta?.name).toEqual(newName); - }); - - it('within sidebar', async () => { - await sideBar.assertAccountName(newName); - }); - - it('within account row', async () => { - await accountRows[0].assertAccountName(newName); - }); - }); - - it('cannot be edited if edit button has not been pressed', async () => { - accountsPage.renderDefaultAccounts(1); - accountRows = await accountsPage.getAccountRows(); - sideBar = await accountRows[0].openSidebar(); - await sideBar.clickByText('no tags'); - expect(sideBar.queryByRole('combobox')).toBeFalsy(); - - await expect(sideBar.typeAccountName(newName)).rejects.toThrowError(nameInputNotFoundError); - }); - - it('when isEditable is false account name is not editable', async () => { - accountsPage.renderAccountsWithDefaultAddresses( - anAccountWithInfo({ flags: { isEditable: false } as AddressFlags }) - ); - accountRows = await accountsPage.getAccountRows(); - sideBar = await accountRows[0].openSidebar(); - sideBar.edit(); - - await expect(sideBar.typeAccountName(newName)).rejects.toThrowError(nameInputNotFoundError); - }); - - describe('on edit cancel', () => { - beforeEach(async () => { - accountsPage.render([[alice, anAccountWithMeta({ isDevelopment: false, name: initialName, tags: [] })]]); - accountRows = await accountsPage.getAccountRows(); - sideBar = await accountRows[0].openSidebar(); - - await sideBar.assertTags('no tags'); - sideBar.edit(); - }); - - it('restores tags and name to state from keyring', async () => { - await sideBar.typeAccountName(newName); - await sideBar.selectTag(defaultTag); - - sideBar.cancel(); - await sideBar.assertTags('no tags'); - await sideBar.assertAccountName(initialName); - }); - - it('Cancel button disappears', () => { - sideBar.cancel(); - expect(sideBar.queryByRole('button', { name: 'Cancel' })).toBeFalsy(); - }); - }); - - describe('outside click', () => { - beforeEach(async () => { - accountsPage.renderAccountsWithDefaultAddresses( - anAccountWithMeta({ name: 'alice' }), - anAccountWithMeta({ name: 'bob' }) - ); - - accountRows = await accountsPage.getAccountRows(); - sideBar = await accountRows[0].openSidebar(); - sideBar.edit(); - }); - - it('cancels editing', async () => { - await sideBar.typeAccountName(newName); - await sideBar.selectTag(defaultTag); - - fireEvent.click(await screen.findByText('accounts')); - - await sideBar.assertTags('no tags'); - await sideBar.assertAccountName('ALICE'); - - expect(sideBar.queryByRole('button', { name: 'Cancel' })).toBeFalsy(); - }); - - it('within sidebar does not cancel editing', async () => { - await sideBar.clickByText('Tags'); - - expect(sideBar.queryByRole('button', { name: 'Cancel' })).toBeTruthy(); - }); - - it('cancels editing and changes name when opening sidebar for another account', async () => { - await waitFor(() => sideBar.assertAccountInput('alice')); - - sideBar = await accountRows[1].openSidebar(); - await sideBar.assertAccountName('BOB'); - }); - }); - }); }); diff --git a/packages/page-accounts/src/Sidebar/Balances.tsx b/packages/page-accounts/src/Sidebar/Balances.tsx index f1bf9e884c..8adf53eb84 100644 --- a/packages/page-accounts/src/Sidebar/Balances.tsx +++ b/packages/page-accounts/src/Sidebar/Balances.tsx @@ -4,7 +4,7 @@ import React from 'react'; import styled from 'styled-components'; -import { AddressInfo, Icon } from '@polkadot/react-components'; +import { AddressInfo } from '@polkadot/react-components'; import { useTranslation } from '../translate'; @@ -21,18 +21,14 @@ function Balances ({ address, className }: Props): React.ReactElement | n return (
-
- -   - {t('balance')} -
+ {t('balance')}
); @@ -40,10 +36,14 @@ function Balances ({ address, className }: Props): React.ReactElement | n export default React.memo(styled(Balances)` .balanceExpander { - .column.column--expander { + justify-content: flex-start; + + .column { width: auto; + max-width: 18.57rem; label { + text-align: left; color: inherit; font-size: 0.93rem; font-weight: var(--font-weight-normal); diff --git a/packages/page-accounts/src/Sidebar/Identity.tsx b/packages/page-accounts/src/Sidebar/Identity.tsx index d02c142a05..f90c4bb06c 100644 --- a/packages/page-accounts/src/Sidebar/Identity.tsx +++ b/packages/page-accounts/src/Sidebar/Identity.tsx @@ -2,42 +2,55 @@ // SPDX-License-Identifier: Apache-2.0 import type { AddressIdentity } from '@polkadot/react-hooks/types'; -import type { AccountId, BalanceOf } from '@polkadot/types/interfaces'; -import React from 'react'; +import React, { useMemo } from 'react'; -import { AddressMini, AvatarItem, Expander, Icon, IconLink, Tag } from '@polkadot/react-components'; -import { useApi, useCall, useRegistrars, useToggle } from '@polkadot/react-hooks'; +import { AddressMini, AvatarItem, Expander, IconLink, Tag } from '@polkadot/react-components'; +import { useApi, useRegistrars, useSubidentities, useToggle } from '@polkadot/react-hooks'; import { isHex } from '@polkadot/util'; import { useTranslation } from '../translate'; import RegistrarJudgement from './RegistrarJudgement'; +import UserIcon from './UserIcon'; interface Props { address: string; identity?: AddressIdentity; } +const SUBS_DISPLAY_THRESHOLD = 4; + function Identity ({ address, identity }: Props): React.ReactElement | null { const { t } = useTranslation(); const { api } = useApi(); const { isRegistrar, registrars } = useRegistrars(); const [isJudgementOpen, toggleIsJudgementOpen] = useToggle(); - const subs = useCall<[BalanceOf, AccountId[]]>(api.query.identity?.subsOf, [address])?.[1]; + const subs = useSubidentities(address); + + const subsList = useMemo(() => + subs?.map((sub) => + + ) + , [subs] + ); if (!identity || !identity.isExistent || !api.query.identity?.identityOf) { return null; } return ( -
+
-
- -   - {t('identity')} -
+ {t('identity')} | nu // ? // : // - + } subtitle={identity.legal} title={identity.display} @@ -162,26 +172,28 @@ function Identity ({ address, identity }: Props): React.ReactElement | nu
)} {!!subs?.length && ( -
- {subs.length > 1 - ?
{t('subs')}
- :
{t('sub')}
- } -
- -
- {subs.map((sub) => - - )} -
-
+
+
{t('subs')}
+
+ {subs.length > SUBS_DISPLAY_THRESHOLD + ? ( + + {subsList} + + ) + : ( + <> +
{subs.length}
+ {subsList} + + ) + }
-
)} +
+ )}
diff --git a/packages/page-accounts/src/Sidebar/Multisig.tsx b/packages/page-accounts/src/Sidebar/Multisig.tsx index 419f107b76..0a4c7a7366 100644 --- a/packages/page-accounts/src/Sidebar/Multisig.tsx +++ b/packages/page-accounts/src/Sidebar/Multisig.tsx @@ -5,7 +5,7 @@ import type { KeyringJson$Meta } from '@polkadot/ui-keyring/types'; import React from 'react'; -import { AddressMini, Icon, Static } from '@polkadot/react-components'; +import { AddressMini } from '@polkadot/react-components'; import { useTranslation } from '../translate'; @@ -24,31 +24,29 @@ function Multisig ({ isMultisig, meta }: Props): React.ReactElement | nul const { threshold, who } = meta; return ( -
+
-
- -   - {t('multisig')} + {t('multisig')} +
+
+
+
{t('threshold')}
+
+ {threshold}/{(who as string[]).length} +
+
+
+
{t('signatories')}
+
+ {(who as string[])?.map((address) => ( + + ))} +
- ('threshold')} - > - {threshold}/{(who as string[]).length} - - ('signatories')} - > - {(who as string[])?.map((address) => ( - - ))} -
); } diff --git a/packages/page-accounts/src/Sidebar/Sidebar.spec.tsx b/packages/page-accounts/src/Sidebar/Sidebar.spec.tsx new file mode 100644 index 0000000000..4e6e4cd0af --- /dev/null +++ b/packages/page-accounts/src/Sidebar/Sidebar.spec.tsx @@ -0,0 +1,184 @@ +// Copyright 2017-2021 @polkadot/page-accounts authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import { fireEvent, screen, waitFor, within } from '@testing-library/react'; + +import { AddressFlags } from '@polkadot/react-hooks/types'; +import { anAccount, anAccountWithInfo, anAccountWithMeta } from '@polkadot/test-support/creation/account'; +import { alice, bob, MemoryStore } from '@polkadot/test-support/keyring'; +import { Sidebar } from '@polkadot/test-support/pagesElements/Sidebar'; +import { mockApiHooks } from '@polkadot/test-support/utils/mockApiHooks'; +import { keyring } from '@polkadot/ui-keyring'; + +import { AccountRow } from '../../test/pageElements/AccountRow'; +import { AccountsPage } from '../../test/pages/accountsPage'; + +describe('Sidebar', () => { + let accountsPage: AccountsPage; + let accountRows: AccountRow[]; + let sideBar: Sidebar; + + beforeAll(() => { + if (keyring.getAccounts().length === 0) { + keyring.loadAll({ isDevelopment: true, store: new MemoryStore() }); + } + }); + + beforeEach(() => { + accountsPage = new AccountsPage(); + accountsPage.clearAccounts(); + }); + + describe('editing', () => { + const initialName = 'INITIAL_NAME'; + const newName = 'NEW_NAME'; + const defaultTag = 'Default'; + const nameInputNotFoundError = 'Unable to find an element by: [data-testid="name-input"]'; + + describe('changes name', () => { + beforeEach(async () => { + accountsPage.render([[alice, anAccountWithMeta({ isDevelopment: false, name: initialName })]]); + accountRows = await accountsPage.getAccountRows(); + sideBar = await accountRows[0].openSidebar(); + await sideBar.changeAccountName(newName); + }); + + it('within keyring', () => { + const changedAccount = keyring.getAccount(alice); + + expect(changedAccount?.meta?.name).toEqual(newName); + }); + + it('within sidebar', async () => { + await sideBar.assertAccountName(newName); + }); + + it('within account row', async () => { + await accountRows[0].assertAccountName(newName); + }); + }); + + it('cannot be edited if edit button has not been pressed', async () => { + accountsPage.renderDefaultAccounts(1); + accountRows = await accountsPage.getAccountRows(); + sideBar = await accountRows[0].openSidebar(); + await sideBar.clickByText('no tags'); + expect(sideBar.queryByRole('combobox')).toBeFalsy(); + + await expect(sideBar.typeAccountName(newName)).rejects.toThrowError(nameInputNotFoundError); + }); + + it('when isEditable is false account name is not editable', async () => { + accountsPage.renderAccountsWithDefaultAddresses( + anAccountWithInfo({ flags: { isEditable: false } as AddressFlags }) + ); + accountRows = await accountsPage.getAccountRows(); + sideBar = await accountRows[0].openSidebar(); + sideBar.edit(); + + await expect(sideBar.typeAccountName(newName)).rejects.toThrowError(nameInputNotFoundError); + }); + + describe('on edit cancel', () => { + beforeEach(async () => { + accountsPage.render([[alice, anAccountWithMeta({ isDevelopment: false, name: initialName, tags: [] })]]); + accountRows = await accountsPage.getAccountRows(); + sideBar = await accountRows[0].openSidebar(); + + await sideBar.assertTags('no tags'); + sideBar.edit(); + }); + + it('restores tags and name to state from keyring', async () => { + await sideBar.typeAccountName(newName); + await sideBar.selectTag(defaultTag); + + sideBar.cancel(); + await sideBar.assertTags('no tags'); + await sideBar.assertAccountName(initialName); + }); + + it('Cancel button disappears', () => { + sideBar.cancel(); + expect(sideBar.queryByRole('button', { name: 'Cancel' })).toBeFalsy(); + }); + }); + + describe('outside click', () => { + beforeEach(async () => { + accountsPage.renderAccountsWithDefaultAddresses( + anAccountWithMeta({ name: 'alice' }), + anAccountWithMeta({ name: 'bob' }) + ); + + accountRows = await accountsPage.getAccountRows(); + sideBar = await accountRows[0].openSidebar(); + sideBar.edit(); + }); + + it('cancels editing', async () => { + await sideBar.typeAccountName(newName); + await sideBar.selectTag(defaultTag); + + fireEvent.click(await screen.findByText('accounts')); + + await sideBar.assertTags('no tags'); + await sideBar.assertAccountName('ALICE'); + + expect(sideBar.queryByRole('button', { name: 'Cancel' })).toBeFalsy(); + }); + + it('within sidebar does not cancel editing', async () => { + await sideBar.clickByText('Tags'); + + expect(sideBar.queryByRole('button', { name: 'Cancel' })).toBeTruthy(); + }); + + it('cancels editing and changes name when opening sidebar for another account', async () => { + await waitFor(() => sideBar.assertAccountInput('alice')); + + sideBar = await accountRows[1].openSidebar(); + await sideBar.assertAccountName('BOB'); + }); + }); + }); + + describe('identity section', () => { + it('does not display subs when account has zero subs', async () => { + accountsPage.render([[alice, anAccount()]]); + accountRows = await accountsPage.getAccountRows(); + sideBar = await accountRows[0].openSidebar(); + const subs = await sideBar.findSubs(); + + expect(subs).toHaveLength(0); + }); + + it('displays count of subs and account names', async () => { + mockApiHooks.setSubs([bob]); + accountsPage.render([[alice, anAccount()], [bob, anAccountWithMeta({ name: 'Bob' })]]); + accountRows = await accountsPage.getAccountRows(); + sideBar = await accountRows[0].openSidebar(); + const subs = await sideBar.findSubs(); + + const subsNumber = subs[0].childNodes[0]; + const subAccount = subs[0].childNodes[1]; + + expect(subsNumber).toHaveClass('subs-number'); + expect(subsNumber).toHaveTextContent('1'); + expect(subAccount).toHaveTextContent('BOB'); + }); + + it('displays picked sub in sidebar', async () => { + mockApiHooks.setSubs([bob]); + accountsPage.render([[alice, anAccount()], [bob, anAccountWithMeta({ name: 'Bob' })]]); + accountRows = await accountsPage.getAccountRows(); + sideBar = await accountRows[0].openSidebar(); + const subs = await sideBar.findSubs(); + const subAccount = subs[0].childNodes[1]; + + fireEvent.click(await within(subAccount as HTMLElement).findByTestId('account-name')); + + await sideBar.assertAccountName('BOB'); + }); + }); +}); diff --git a/packages/page-accounts/src/Sidebar/Sidebar.tsx b/packages/page-accounts/src/Sidebar/Sidebar.tsx index 99d531effd..f90fa90b70 100644 --- a/packages/page-accounts/src/Sidebar/Sidebar.tsx +++ b/packages/page-accounts/src/Sidebar/Sidebar.tsx @@ -47,16 +47,18 @@ function FullSidebar ({ address, className = '', dataTestId, onClose, onUpdateNa sidebarRef={ref} /> - - - -
+
+ + + +
+
:first-child { - flex: 1; + color: var(--color-text); + font-size: 1.143rem; + } + + &.withDivider { + padding-top: 1rem; + + ::before { + position: absolute; + top: 0; + left: 0; + + content: ''; + width: 100%; + height: 1px; + background-color: var(--border-table); } } } - .ui--AddressMenu-identity { - .ui--AddressMenu-identityTable { + .ui--AddressMenu-identity, + .ui--AddressMenu-multisig { + .ui--AddressMenu-identityTable, + .ui--AddressMenu-multisigTable { font-size: 0.93rem; - margin-top: 0.3rem; + margin-top: 0.6rem; .tr { + padding: 0.25rem 0; display: inline-flex; align-items: center; width: 100%; .th { + text-transform: uppercase; + color: var(--color-label); font-weight: var(--font-weight-normal); - text-align: right; - flex-basis: 20%; + text-align: left; + flex-basis: 25%; + font-size: 0.714rem; &.top { align-self: flex-start; @@ -182,13 +206,46 @@ export default React.memo(styled(FullSidebar)` text-overflow: ellipsis; } } + + .ui--AddressMini, .subs-number { + margin-bottom: 0.4rem; + padding: 0; + } + + .subs-number { + font-size: 1rem; + margin-bottom: 0.714rem; + } } - .parent, .subs { + .parent { padding: 0 !important; } } + && .column { + align-items: center; + + .ui--FormatBalance:first-of-type { + margin-bottom: 0.4rem; + } + + label:first-of-type { + margin-bottom: 0.4rem; + color: var(--color-text); + } + + label { + color: var(--color-label); + text-transform: uppercase; + font-size: 0.714rem; + } + + .ui--FormatBalance, label { + line-height: 1rem; + } + } + .ui--AddressMenu-buttons { .ui--Button-Group { margin-bottom: 0; @@ -221,7 +278,7 @@ export default React.memo(styled(FullSidebar)` .inline-icon { cursor: pointer; margin: 0 0 0 0.5rem; - color: ${colorLink}; + color: ${colorLink}; } .name--input { @@ -238,4 +295,25 @@ export default React.memo(styled(FullSidebar)` opacity: 60%; } } + + .ui--AddressMenu-multisig .th.signatories { + align-self: flex-start; + } + + .ui--ScrollSection { + padding: 1rem; + overflow: auto; + } + + .ui--LinkSection { + border-top: 1px solid var(--border-table); + padding: 0.5rem 0 0.571rem; + width: 100%; + position: absolute; + bottom: 0; + + span { + margin: 0 0.5rem; + } + } `); diff --git a/packages/page-accounts/src/Sidebar/UserIcon.tsx b/packages/page-accounts/src/Sidebar/UserIcon.tsx new file mode 100644 index 0000000000..7f9f1b4e67 --- /dev/null +++ b/packages/page-accounts/src/Sidebar/UserIcon.tsx @@ -0,0 +1,45 @@ +// Copyright 2017-2021 @polkadot/app-accounts authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import React from 'react'; + +function UserIcon (): React.ReactElement { + return ( + + + + + + + + + + ); +} + +export default React.memo(UserIcon); diff --git a/packages/page-accounts/src/modals/IdentitySub.tsx b/packages/page-accounts/src/modals/IdentitySub.tsx index f59c0c6577..5b7f181f11 100644 --- a/packages/page-accounts/src/modals/IdentitySub.tsx +++ b/packages/page-accounts/src/modals/IdentitySub.tsx @@ -2,14 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 import type { TFunction } from 'i18next'; -import type { Data, Option, Vec } from '@polkadot/types'; -import type { AccountId, Balance } from '@polkadot/types/interfaces'; +import type { Data, Option } from '@polkadot/types'; +import type { AccountId } from '@polkadot/types/interfaces'; import type { ITuple } from '@polkadot/types/types'; import React, { useCallback, useEffect, useState } from 'react'; import { Button, Columar, Input, InputAddress, Modal, Spinner, TxButton } from '@polkadot/react-components'; -import { useAccounts, useApi, useCall } from '@polkadot/react-hooks'; +import { useAccounts, useApi, useCall, useSubidentities } from '@polkadot/react-hooks'; import { u8aToString } from '@polkadot/util'; import { useTranslation } from '../translate'; @@ -80,17 +80,13 @@ function IdentitySub ({ address, index, name, setAddress, setName, t }: SubProps const IdentitySubMemo = React.memo(IdentitySub); -const transformIds = { - transform: ([, ids]: ITuple<[Balance, Vec]>) => ids.map((a) => a.toString()) -}; - const transformInfo = { withParams: true }; function IdentitySubModal ({ address, className, onClose }: Props): React.ReactElement { const { t } = useTranslation(); const { api } = useApi(); const { allAccounts } = useAccounts(); - const queryIds = useCall(api.query.identity.subsOf, [address], transformIds); + const queryIds = useSubidentities(address); const queryInfos = useCall<[[string[]], Option>[]]>(queryIds && queryIds.length !== 0 && api.query.identity.superOf.multi, [queryIds], transformInfo); const [infos, setInfos] = useState<[string, string][] | undefined>(); diff --git a/packages/react-components/src/AddressInfo.tsx b/packages/react-components/src/AddressInfo.tsx index fb1f0d6fd1..65824fefee 100644 --- a/packages/react-components/src/AddressInfo.tsx +++ b/packages/react-components/src/AddressInfo.tsx @@ -59,7 +59,7 @@ interface Props { withExtended?: boolean | CryptoActiveType; withHexSessionId?: (string | null)[]; withValidatorPrefs?: boolean | ValidatorPrefsType; - withoutLabel?: boolean; + withLabel?: boolean; } const DEFAULT_BALANCES: BalanceActiveType = { @@ -222,12 +222,12 @@ function renderValidatorPrefs ({ stakingInfo, withValidatorPrefs = false }: Prop ); } -function createBalanceItems (formatIndex: number, lookup: Record, t: TFunction, { address, balanceDisplay, balancesAll, bestNumber, democracyLocks, isAllLocked, otherBonded, ownBonded, stakingInfo, votingOf, withBalanceToggle }: { address: string; balanceDisplay: BalanceActiveType; balancesAll?: DeriveBalancesAll | DeriveBalancesAccountData; bestNumber: BlockNumber; democracyLocks?: DeriveDemocracyLock[]; isAllLocked: boolean; otherBonded: BN[]; ownBonded: BN; stakingInfo?: DeriveStakingAccount; votingOf?: Voting; withBalanceToggle: boolean }): React.ReactNode { +function createBalanceItems (formatIndex: number, lookup: Record, t: TFunction, { address, balanceDisplay, balancesAll, bestNumber, democracyLocks, isAllLocked, otherBonded, ownBonded, stakingInfo, votingOf, withBalanceToggle, withLabel }: { address: string; balanceDisplay: BalanceActiveType; balancesAll?: DeriveBalancesAll | DeriveBalancesAccountData; bestNumber: BlockNumber; democracyLocks?: DeriveDemocracyLock[]; isAllLocked: boolean; otherBonded: BN[]; ownBonded: BN; stakingInfo?: DeriveStakingAccount; votingOf?: Voting; withBalanceToggle: boolean, withLabel: boolean }): React.ReactNode { const allItems: React.ReactNode[] = []; !withBalanceToggle && balancesAll && balanceDisplay.total && allItems.push( -