diff --git a/new-lamassu-admin/src/pages/Transactions/DetailsCard.js b/new-lamassu-admin/src/pages/Transactions/DetailsCard.js index c5d57ec9..6dc282f5 100644 --- a/new-lamassu-admin/src/pages/Transactions/DetailsCard.js +++ b/new-lamassu-admin/src/pages/Transactions/DetailsCard.js @@ -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 {children} diff --git a/new-lamassu-admin/src/pages/Transactions/Transactions.js b/new-lamassu-admin/src/pages/Transactions/Transactions.js index 018497ae..7e619b63 100644 --- a/new-lamassu-admin/src/pages/Transactions/Transactions.js +++ b/new-lamassu-admin/src/pages/Transactions/Transactions.js @@ -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 } ] diff --git a/new-lamassu-admin/src/pages/Transactions/helper.js b/new-lamassu-admin/src/pages/Transactions/helper.js new file mode 100644 index 00000000..91c0a7b9 --- /dev/null +++ b/new-lamassu-admin/src/pages/Transactions/helper.js @@ -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 }