// Copyright 2017-2021 @polkadot/app-staking authors & contributors // SPDX-License-Identifier: Apache-2.0 import type { Slash } from './types'; import React, { useCallback } from 'react'; import { AddressMini, AddressSmall, Badge, Checkbox, Expander } from '@polkadot/react-components'; import { FormatBalance } from '@polkadot/react-query'; import { formatNumber } from '@polkadot/util'; import { useTranslation } from '../translate'; interface Props { index: number; isSelected: boolean; onSelect?: (index: number) => void; slash: Slash; } function Row ({ index, isSelected, onSelect, slash: { isMine, slash: { others, own, payout, reporters, validator }, total, totalOther } }: Props): React.ReactElement { const { t } = useTranslation(); const _onSelect = useCallback( () => onSelect && onSelect(index), [index, onSelect] ); return ( {isMine && ( )} {!!others.length && ( ('Nominators ({{count}})', { replace: { count: formatNumber(others.length) } })}> {others.map(([accountId, balance], index): React.ReactNode => ( ))} )} {reporters.map((reporter, index): React.ReactNode => ( ))} ); } export default React.memo(Row);