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 (
<Grid
data={txns}
search={true}
search
// sort={true}
pagination={{
enabled: true,
@ -267,12 +267,28 @@ function TransactionsTable(props: { txns: Transaction[] }) {
{
id: 'category',
name: 'Type',
formatter: (cell) =>
cell === 'BUY_LEADERBOARD_SLOT' ? 'Buy' : 'Tax',
formatter: (cell, row) => {
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',
name: 'Amount',
name: 'Transfer',
formatter: (cell) => formatMoney(cell as number),
},
{
@ -290,6 +306,12 @@ function TransactionsTable(props: { txns: Transaction[] }) {
)}</span>`
),
},
{
hidden: true,
id: 'data',
name: 'New Value',
formatter: (cell) => (cell as SlotData).newValue ?? '',
},
]}
/>
)