Skip to content

Commit

Permalink
Update data asset transations table (#2551)
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Dec 5, 2024
1 parent 7a7791d commit 7cdc896
Showing 1 changed file with 12 additions and 32 deletions.
44 changes: 12 additions & 32 deletions centrifuge-app/src/components/Report/AssetTransactions.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Pool } from '@centrifuge/centrifuge-js'
import { formatBalance, useGetExplorerUrl } from '@centrifuge/centrifuge-react'
import { useGetExplorerUrl } from '@centrifuge/centrifuge-react'
import { Box, IconAnchor, IconExternalLink, Text } from '@centrifuge/fabric'
import * as React from 'react'
import { formatBalance } from '../../../src/utils/formatting'
import { formatDate } from '../../utils/date'
import { getCSVDownloadUrl } from '../../utils/getCSVDownloadUrl'
import { useAssetTransactions } from '../../utils/usePools'
Expand All @@ -21,53 +22,35 @@ export function AssetTransactions({ pool }: { pool: Pool }) {

const columnConfig = [
{
header: 'Asset ID',
align: 'center',
csvOnly: false,
formatter: noop,
width: '80px',
},
{
header: 'Asset name',
align: 'left',
csvOnly: false,
formatter: noop,
},
{
header: 'Epoch',
align: 'center',
csvOnly: false,
formatter: noop,
},
{
header: 'Date',
header: 'Transaction date',
align: 'left',
csvOnly: false,
formatter: formatDate,
},
{
header: 'Transaction type',
header: 'Transaction',
align: 'left',
csvOnly: false,
formatter: noop,
width: '38%',
},
{
header: 'Currency amount',
header: 'Amount',
align: 'left',
csvOnly: false,
formatter: (v: any) => (typeof v === 'number' ? formatBalance(v, pool.currency.symbol, 2) : '-'),
},
{
header: 'Currency',
align: 'left',
csvOnly: true,
header: 'Epoch',
align: 'center',
csvOnly: false,
formatter: noop,
},
{
header: 'Transaction',
header: 'View transaction',
align: 'center',
csvOnly: false,
width: '80px',
width: '120px',
formatter: (v: any) => (
<IconAnchor
href={explorer.tx(v)}
Expand All @@ -90,13 +73,10 @@ export function AssetTransactions({ pool }: { pool: Pool }) {
?.map((tx) => ({
name: '',
value: [
tx.asset.id.split('-').at(-1)!,
tx.asset.name || `Asset ${tx.asset.id.split('-').at(-1)!}`,
tx.epochId.split('-').at(-1)!,
tx.timestamp.toISOString(),
formatAssetTransactionType(tx.type),
tx.amount?.toFloat() ?? '',
pool.currency.symbol,
tx.epochId.split('-').at(-1)!,
tx.hash,
],
heading: false,
Expand Down

0 comments on commit 7cdc896

Please sign in to comment.