diff --git a/packages/page-staking/src/Actions/Account/ListNominees.tsx b/packages/page-staking/src/Actions/Account/ListNominees.tsx index e4ae54e050..d2aefb7bd9 100644 --- a/packages/page-staking/src/Actions/Account/ListNominees.tsx +++ b/packages/page-staking/src/Actions/Account/ListNominees.tsx @@ -6,7 +6,7 @@ import type { BN } from '@polkadot/util'; import React, { useMemo } from 'react'; -import { AddressMini, Expander, MarkWarning } from '@polkadot/react-components'; +import { AddressMini, ExpanderScroll, MarkWarning } from '@polkadot/react-components'; import { useApi, useCall } from '@polkadot/react-hooks'; import { isFunction } from '@polkadot/util'; @@ -79,7 +79,7 @@ function ListNominees ({ nominating, stashId }: Props): React.ReactElement {renOver && ( - ('These validators are active but only the top {{max}} nominators by backing stake will be receiving rewards. The nominating stash is not one of those to be rewarded in the current era.', { replace: api.consts.staking?.maxNominatorRewardedPerValidator?.toString() })} renderChildren={renOver[1]} @@ -87,28 +87,28 @@ function ListNominees ({ nominating, stashId }: Props): React.ReactElement )} {renActive && ( - ('The validators selected by the Phragmen algorithm to nominate for this era.')} renderChildren={renActive[1]} summary={t('Active nominations ({{count}})', { replace: { count: renActive[0] } })} /> )} {renInactive && ( - ('The elected validator list that did not get selected by the Phragmen algorithm for this era. However they may be selected in the future.')} renderChildren={renInactive[1]} summary={t('Inactive nominations ({{count}})', { replace: { count: renInactive[0] } })} /> )} {renChilled && ( - ('The validators that got slashed and for which your nomination got auto-chilled. Re-nominating these will make them available to the Phragmen algorithm.')} renderChildren={renChilled[1]} summary={t('Renomination required ({{count}})', { replace: { count: renChilled[0] } })} /> )} {renWaiting && ( - ('The validators that are not in the validator set because they need more nominations or because they have willingly stopped validating. Any nominations made before the next election will also appear here.')} renderChildren={renWaiting[1]} summary={t('Waiting nominations ({{count}})', { replace: { count: renWaiting[0] } })} diff --git a/packages/page-staking/src/Actions/Account/index.tsx b/packages/page-staking/src/Actions/Account/index.tsx index ca7ca8edea..25e79937b5 100644 --- a/packages/page-staking/src/Actions/Account/index.tsx +++ b/packages/page-staking/src/Actions/Account/index.tsx @@ -236,7 +236,7 @@ function Account ({ allSlashes, className = '', info: { controllerId, destinatio ) : ( - + {isStashNominating && ( <> others.map(([accountId, balance], index): React.ReactNode => ( + + )), + [others] + ); + return ( @@ -41,16 +53,10 @@ function Row ({ index, isSelected, onSelect, slash: { isMine, slash: { others, o {!!others.length && ( - ('Nominators ({{count}})', { replace: { count: formatNumber(others.length) } })}> - {others.map(([accountId, balance], index): React.ReactNode => ( - - ))} - + ('Nominators ({{count}})', { replace: { count: formatNumber(others.length) } })} + /> )} diff --git a/packages/page-staking/src/Validators/Address/NominatedBy.tsx b/packages/page-staking/src/Validators/Address/NominatedBy.tsx index 374d2941bb..04a15e97dc 100644 --- a/packages/page-staking/src/Validators/Address/NominatedBy.tsx +++ b/packages/page-staking/src/Validators/Address/NominatedBy.tsx @@ -6,7 +6,7 @@ import type { NominatedBy as NominatedByType } from '../../types'; import React, { useMemo } from 'react'; -import { AddressMini, Expander } from '@polkadot/react-components'; +import { AddressMini, ExpanderScroll } from '@polkadot/react-components'; import { formatNumber } from '@polkadot/util'; import { useTranslation } from '../../translate'; @@ -63,13 +63,13 @@ function NominatedBy ({ nominators, slashingSpans }: Props): React.ReactElement< return ( {active && ( - ('Nominations ({{count}})', { replace: { count: formatNumber(active[0]) } })} /> )} {chilled && ( - ('Renomination required ({{count}})', { replace: { count: formatNumber(chilled[0]) } })} /> diff --git a/packages/page-staking/src/Validators/Address/StakeOther.tsx b/packages/page-staking/src/Validators/Address/StakeOther.tsx index 73be1dee00..e1056c54cc 100644 --- a/packages/page-staking/src/Validators/Address/StakeOther.tsx +++ b/packages/page-staking/src/Validators/Address/StakeOther.tsx @@ -5,7 +5,7 @@ import type { NominatorValue } from './types'; import React, { useMemo } from 'react'; -import { AddressMini, Expander } from '@polkadot/react-components'; +import { AddressMini, ExpanderScroll } from '@polkadot/react-components'; import { useApi } from '@polkadot/react-hooks'; import { FormatBalance } from '@polkadot/react-query'; import { BN, BN_ZERO } from '@polkadot/util'; @@ -59,7 +59,7 @@ function StakeOther ({ nominators, stakeOther }: Props): React.ReactElement {rewarded && ( <> - {unrewarded && ( - React.ReactNode[]; } +function mapRow (row: React.ReactNode, key: number): React.ReactNode { + return ( + + {row} + + ); +} + function ExpanderScroll ({ children, className, empty, help, helpIcon, renderChildren, summary }: Props): React.ReactElement { const hasContent = useMemo( () => !!(renderChildren || children), @@ -28,15 +36,10 @@ function ExpanderScroll ({ children, className, empty, help, helpIcon, renderChi isInline > {renderChildren - ? renderChildren().map((row, key) => ( - - {row} - - )) - : {children} + ? renderChildren().map(mapRow) + : Array.isArray(children) + ? children.map(mapRow) + : {children} } @@ -60,8 +63,8 @@ export default React.memo(styled(ExpanderScroll)` overflow-y: scroll; display: block; margin: 0 0 0 auto; - max-height: 14rem; - max-width: 30rem; + max-height: 13.75rem; + max-width: 25rem; overflow-x: hidden; } `);