/* @flow */ import React from 'react'; import ColorHash from 'color-hash'; import ScaleText from 'react-scale-text'; import * as stateUtils from 'reducers/utils'; import BigNumber from 'bignumber.js'; import type { Props as BaseProps } from './index'; type Props = { pending: $PropertyType<$ElementType, 'pending'>, tokens: $ElementType, removeToken: $ElementType } const SummaryTokens = (props: Props) => { if (!props.tokens || props.tokens.length < 1) return null; const bgColor = new ColorHash({ lightness: 0.7 }); const textColor = new ColorHash(); const tokens = props.tokens.map((token, index) => { const iconColor = { color: textColor.hex(token.name), background: bgColor.hex(token.name), borderColor: bgColor.hex(token.name), }; const pendingAmount: BigNumber = stateUtils.getPendingAmount(props.pending, token.symbol, true); const balance: string = new BigNumber(token.balance).minus(pendingAmount).toString(10); return (

{ token.symbol }

{ token.name }
{ balance } { token.symbol }
); }); return (
{ tokens }
); }; export default SummaryTokens;