import BigNumber from 'bignumber.js' import * as React from 'react' import { Trans, useTranslation } from 'react-i18next' import { StyleSheet, Text } from 'react-native' import LineItemRow from 'src/components/LineItemRow' import TokenDisplay, { formatValueToDisplay } from 'src/components/TokenDisplay' import { LocalCurrencyCode, LocalCurrencySymbol } from 'src/localCurrency/consts' import colors from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' import { useTokenInfo } from 'src/tokens/hooks' import { LocalAmount } from 'src/transactions/types' interface Props { tokenAmount: BigNumber tokenId?: string localAmount?: LocalAmount feeToAddInUsd?: BigNumber | undefined hideSign?: boolean title?: string | null showLocalAmountForTotal?: boolean showApproxTotalBalance?: boolean showApproxExchangeRate?: boolean } export default function TokenTotalLineItem({ tokenAmount, tokenId, localAmount, feeToAddInUsd, hideSign, title, showLocalAmountForTotal = true, showApproxTotalBalance = false, showApproxExchangeRate = false, }: Props) { const { t } = useTranslation() const tokenInfo = useTokenInfo(tokenId) const feeInToken = tokenInfo?.priceUsd ? feeToAddInUsd?.dividedBy(tokenInfo.priceUsd) : undefined const showLocalAmountForSubtotal = !showLocalAmountForTotal return ( <> } /> {localAmount?.exchangeRate ? ( `${ LocalCurrencySymbol[localAmount.currencyCode as LocalCurrencyCode] }${formatValueToDisplay(new BigNumber(localAmount.exchangeRate))}` ) : ( )} } amount={ } style={styles.subtotal} textStyle={styles.subtotalText} /> ) } const styles = StyleSheet.create({ subtotal: { marginVertical: 0, }, subtotalText: { ...typeScale.labelSmall, color: colors.contentSecondary, }, exchangeRate: { ...typeScale.labelSmall, color: colors.contentSecondary, }, })