feat: added the transaction status on the transactions table
This commit is contained in:
parent
cb44468e47
commit
c42b6f49c1
3 changed files with 30 additions and 28 deletions
|
|
@ -19,34 +19,13 @@ import { onlyFirstToUpper } from 'src/utils/string'
|
|||
|
||||
import CopyToClipboard from './CopyToClipboard'
|
||||
import styles from './DetailsCard.styles'
|
||||
import { getStatus } from './helper'
|
||||
|
||||
const useStyles = makeStyles(styles)
|
||||
|
||||
const formatAddress = (cryptoCode = '', address = '') =>
|
||||
formatCryptoAddress(cryptoCode, address).replace(/(.{5})/g, '$1 ')
|
||||
|
||||
const getCashOutStatus = it => {
|
||||
if (it.hasError) return 'Error'
|
||||
if (it.dispense) return 'Success'
|
||||
if (it.expired) return 'Expired'
|
||||
return 'Pending'
|
||||
}
|
||||
|
||||
const getCashInStatus = it => {
|
||||
if (it.operatorCompleted) return 'Cancelled'
|
||||
if (it.hasError) return 'Error'
|
||||
if (it.sendConfirmed) return 'Sent'
|
||||
if (it.expired) return 'Expired'
|
||||
return 'Pending'
|
||||
}
|
||||
|
||||
const getStatus = it => {
|
||||
if (it.class === 'cashOut') {
|
||||
return getCashOutStatus(it)
|
||||
}
|
||||
return getCashInStatus(it)
|
||||
}
|
||||
|
||||
const Label = ({ children }) => {
|
||||
const classes = useStyles()
|
||||
return <Label1 className={classes.label}>{children}</Label1>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import { toUnit, formatCryptoAddress } from 'src/utils/coin'
|
|||
|
||||
import DetailsRow from './DetailsCard'
|
||||
import { mainStyles } from './Transactions.styles'
|
||||
import { getStatus } from './helper'
|
||||
|
||||
const useStyles = makeStyles(mainStyles)
|
||||
|
||||
|
|
@ -118,17 +119,16 @@ const Transactions = () => {
|
|||
},
|
||||
{
|
||||
header: 'Date (UTC)',
|
||||
view: it => moment.utc(it.created).format('YYYY-MM-DD'),
|
||||
view: it => moment.utc(it.created).format('YYYY-MM-DD HH:mm:ss'),
|
||||
textAlign: 'right',
|
||||
size: 'sm',
|
||||
width: 140
|
||||
width: 200
|
||||
},
|
||||
{
|
||||
header: 'Time (UTC)',
|
||||
view: it => moment.utc(it.created).format('HH:mm:ss'),
|
||||
textAlign: 'right',
|
||||
header: 'Status',
|
||||
view: it => getStatus(it),
|
||||
size: 'sm',
|
||||
width: 140
|
||||
width: 80
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
|||
23
new-lamassu-admin/src/pages/Transactions/helper.js
Normal file
23
new-lamassu-admin/src/pages/Transactions/helper.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
const getCashOutStatus = it => {
|
||||
if (it.hasError) return 'Error'
|
||||
if (it.dispense) return 'Success'
|
||||
if (it.expired) return 'Expired'
|
||||
return 'Pending'
|
||||
}
|
||||
|
||||
const getCashInStatus = it => {
|
||||
if (it.operatorCompleted) return 'Cancelled'
|
||||
if (it.hasError) return 'Error'
|
||||
if (it.sendConfirmed) return 'Sent'
|
||||
if (it.expired) return 'Expired'
|
||||
return 'Pending'
|
||||
}
|
||||
|
||||
const getStatus = it => {
|
||||
if (it.class === 'cashOut') {
|
||||
return getCashOutStatus(it)
|
||||
}
|
||||
return getCashInStatus(it)
|
||||
}
|
||||
|
||||
export { getStatus }
|
||||
Loading…
Add table
Add a link
Reference in a new issue