mirror of
https://github.com/status-im/safe-react.git
synced 2025-01-13 11:34:08 +00:00
Fix transaction description value (#377)
* Fix transaction description value * Remove duplicated symbols
This commit is contained in:
parent
2dafa88337
commit
87b883ae77
@ -1,6 +1,7 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
|
import { getTxAmount } from '~/routes/safe/components/Transactions/TxsTable/columns'
|
||||||
import { type Transaction } from '~/routes/safe/store/models/transaction'
|
import { type Transaction } from '~/routes/safe/store/models/transaction'
|
||||||
import Bold from '~/components/layout/Bold'
|
import Bold from '~/components/layout/Bold'
|
||||||
import EtherscanLink from '~/components/EtherscanLink'
|
import EtherscanLink from '~/components/EtherscanLink'
|
||||||
@ -40,8 +41,7 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TransferDescProps = {
|
type TransferDescProps = {
|
||||||
value: string,
|
amount: string,
|
||||||
symbol: string,
|
|
||||||
recipient: string,
|
recipient: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,20 +52,18 @@ type DescriptionDescProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CustomDescProps = {
|
type CustomDescProps = {
|
||||||
value: string,
|
amount: string,
|
||||||
recipient: string,
|
recipient: string,
|
||||||
data: String,
|
data: String,
|
||||||
classes: Object,
|
classes: Object,
|
||||||
}
|
}
|
||||||
|
|
||||||
const TransferDescription = ({ value = '', symbol, recipient }: TransferDescProps) => (
|
const TransferDescription = ({ amount = '', recipient }: TransferDescProps) => (
|
||||||
<Block data-testid={TRANSACTIONS_DESC_SEND_TEST_ID}>
|
<Block data-testid={TRANSACTIONS_DESC_SEND_TEST_ID}>
|
||||||
<Bold>
|
<Bold>
|
||||||
Send
|
Send
|
||||||
{' '}
|
{' '}
|
||||||
{value}
|
{amount}
|
||||||
{' '}
|
|
||||||
{symbol}
|
|
||||||
{' '}
|
{' '}
|
||||||
to:
|
to:
|
||||||
</Bold>
|
</Bold>
|
||||||
@ -99,7 +97,7 @@ const SettingsDescription = ({ removedOwner, addedOwner, newThreshold }: Descrip
|
|||||||
)
|
)
|
||||||
|
|
||||||
const CustomDescription = ({
|
const CustomDescription = ({
|
||||||
data, value = 0, recipient, classes,
|
data, amount = 0, recipient, classes,
|
||||||
}: CustomDescProps) => {
|
}: CustomDescProps) => {
|
||||||
const [showTxData, setShowTxData] = useState(false)
|
const [showTxData, setShowTxData] = useState(false)
|
||||||
return (
|
return (
|
||||||
@ -108,9 +106,7 @@ const CustomDescription = ({
|
|||||||
<Bold>
|
<Bold>
|
||||||
Send
|
Send
|
||||||
{' '}
|
{' '}
|
||||||
{value}
|
{amount}
|
||||||
{' '}
|
|
||||||
ETH
|
|
||||||
{' '}
|
{' '}
|
||||||
to:
|
to:
|
||||||
</Bold>
|
</Bold>
|
||||||
@ -156,18 +152,27 @@ const CustomDescription = ({
|
|||||||
|
|
||||||
const TxDescription = ({ tx, classes }: Props) => {
|
const TxDescription = ({ tx, classes }: Props) => {
|
||||||
const {
|
const {
|
||||||
recipient, value, modifySettingsTx, removedOwner, addedOwner, newThreshold, cancellationTx, customTx, creationTx, data,
|
recipient,
|
||||||
|
modifySettingsTx,
|
||||||
|
removedOwner,
|
||||||
|
addedOwner,
|
||||||
|
newThreshold,
|
||||||
|
cancellationTx,
|
||||||
|
customTx,
|
||||||
|
creationTx,
|
||||||
|
data,
|
||||||
} = getTxData(tx)
|
} = getTxData(tx)
|
||||||
|
const amount = getTxAmount(tx)
|
||||||
return (
|
return (
|
||||||
<Block className={classes.txDataContainer}>
|
<Block className={classes.txDataContainer}>
|
||||||
{modifySettingsTx && (
|
{modifySettingsTx && (
|
||||||
<SettingsDescription removedOwner={removedOwner} newThreshold={newThreshold} addedOwner={addedOwner} />
|
<SettingsDescription removedOwner={removedOwner} newThreshold={newThreshold} addedOwner={addedOwner} />
|
||||||
)}
|
)}
|
||||||
{customTx && (
|
{customTx && (
|
||||||
<CustomDescription data={data} value={value} recipient={recipient} classes={classes} />
|
<CustomDescription data={data} amount={amount} recipient={recipient} classes={classes} />
|
||||||
)}
|
)}
|
||||||
{!cancellationTx && !modifySettingsTx && !customTx && !creationTx && (
|
{!cancellationTx && !modifySettingsTx && !customTx && !creationTx && (
|
||||||
<TransferDescription value={value} symbol={tx.symbol} recipient={recipient} />
|
<TransferDescription amount={amount} recipient={recipient} />
|
||||||
)}
|
)}
|
||||||
</Block>
|
</Block>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user