Skip to content

Commit

Permalink
[PAY-2399] Update header and cell contents for withdrawals table (#8184)
Browse files Browse the repository at this point in the history
  • Loading branch information
schottra authored Apr 22, 2024
1 parent 37258ec commit 5d5e076
Showing 1 changed file with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import { isEmptyTransactionRow } from '../utils'
import styles from './WithdrawalsTable.module.css'

const messages = {
cash: 'Cash'
cash: 'Cash',
crypto: 'Crypto'
}

export type WithdrawalsTableColumn =
Expand Down Expand Up @@ -54,16 +55,23 @@ const defaultColumns: WithdrawalsTableColumn[] = [

// Cell Render Functions
const renderDestinationCell = (cellInfo: TransactionCell) => {
const { metadata, transactionType } = cellInfo.row.original
const destination =
transactionType === USDCTransactionType.WITHDRAWAL
? messages.cash
: metadata
return typeof destination === 'string' ? (
<span className={styles.text}>{destination}</span>
) : (
''
)
const { transactionType } = cellInfo.row.original
let destination = ''
switch (transactionType) {
case USDCTransactionType.WITHDRAWAL:
destination = messages.cash
break
case USDCTransactionType.TRANSFER:
destination = messages.crypto
break
default:
console.error(
`Unexpected transaction type for withdrawal: ${transactionType}`
)
break
}

return <span className={styles.text}>{destination}</span>
}

const renderDateCell = (cellInfo: TransactionCell) => {
Expand All @@ -80,7 +88,7 @@ const renderAmountCell = (cellInfo: TransactionCell) => {
const tableColumnMap = {
destination: {
id: 'destination',
Header: 'Wallet',
Header: 'Method',
accessor: 'metadata',
Cell: renderDestinationCell,
width: 480,
Expand Down

0 comments on commit 5d5e076

Please sign in to comment.