Correctly categorize transactions

This commit is contained in:
Austin Chen 2022-04-01 09:51:45 -07:00
parent 98ab5e27c2
commit d9a1ef7328

View File

@ -252,7 +252,7 @@ function TransactionsTable(props: { txns: Transaction[] }) {
return ( return (
<Grid <Grid
data={txns} data={txns}
search={true} search
// sort={true} // sort={true}
pagination={{ pagination={{
enabled: true, enabled: true,
@ -267,12 +267,28 @@ function TransactionsTable(props: { txns: Transaction[] }) {
{ {
id: 'category', id: 'category',
name: 'Type', name: 'Type',
formatter: (cell) => formatter: (cell, row) => {
cell === 'BUY_LEADERBOARD_SLOT' ? 'Buy' : 'Tax', if (cell === 'LEADERBOARD_TAX') {
return 'Tax'
}
// If newValue === 0
// @ts-ignore
if (row.cells[6].data?.newValue === 0) {
return 'Sell'
}
// If fromUser === toUser
if (row.cells[3].data === row.cells[4].data) {
return 'Edit'
}
return 'Buy'
},
}, },
{ {
id: 'amount', id: 'amount',
name: 'Amount', name: 'Transfer',
formatter: (cell) => formatMoney(cell as number), formatter: (cell) => formatMoney(cell as number),
}, },
{ {
@ -290,6 +306,12 @@ function TransactionsTable(props: { txns: Transaction[] }) {
)}</span>` )}</span>`
), ),
}, },
{
hidden: true,
id: 'data',
name: 'New Value',
formatter: (cell) => (cell as SlotData).newValue ?? '',
},
]} ]}
/> />
) )