Skip to content

Commit

Permalink
chore: add order label to the historical transaction list (#99)
Browse files Browse the repository at this point in the history
* feat: add order label to the historical transaction table
  • Loading branch information
negar-abbasi authored Jun 17, 2024
1 parent 6a861af commit 6d44abf
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useCallback, useMemo } from 'react'
import { getAccountTransactionsTableSubRows } from '../utils/get-account-transactions-table-sub-rows'
import { InnerTransaction, Transaction } from '@/features/transactions/models'
import { transactionsTableColumns } from '@/features/transactions/components/transactions-table-columns'
import { ListingOrderLabel } from '@/features/common/components/listing-order-label'

type Props = {
address: Address
Expand All @@ -14,5 +15,10 @@ export function AccountTransactionHistory({ address }: Props) {
const createLoadablePage = useMemo(() => createLoadableAccountTransactionsPage(address), [address])
const getSubRows = useCallback((row: Transaction | InnerTransaction) => getAccountTransactionsTableSubRows(address, row), [address])

return <LazyLoadDataTable columns={transactionsTableColumns} getSubRows={getSubRows} createLoadablePage={createLoadablePage} />
return (
<div>
<LazyLoadDataTable columns={transactionsTableColumns} getSubRows={getSubRows} createLoadablePage={createLoadablePage} />
<ListingOrderLabel oldestToNewest={false} />
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { InnerTransaction, Transaction } from '@/features/transactions/models'
import { useCallback, useMemo } from 'react'
import { getApplicationTransactionsTableSubRows } from '../utils/get-application-transactions-table-sub-rows'
import { transactionsTableColumns } from '@/features/transactions/components/transactions-table-columns'
import { ListingOrderLabel } from '@/features/common/components/listing-order-label'

type Props = {
applicationId: ApplicationId
Expand All @@ -23,5 +24,10 @@ export function ApplicationTransactionHistory({ applicationId }: Props) {
[applicationId]
)

return <LazyLoadDataTable columns={transactionsTableColumns} getSubRows={getSubRows} createLoadablePage={createLoadablePage} />
return (
<div>
<LazyLoadDataTable columns={transactionsTableColumns} getSubRows={getSubRows} createLoadablePage={createLoadablePage} />
<ListingOrderLabel />
</div>
)
}
8 changes: 7 additions & 1 deletion src/features/assets/components/asset-transaction-history.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Transaction, InnerTransaction } from '@/features/transactions/models'
import { useCallback, useMemo } from 'react'
import { getAssetTransactionsTableSubRows } from '../utils/get-asset-transactions-table-sub-rows'
import { transactionsTableColumns } from '@/features/transactions/components/transactions-table-columns'
import { ListingOrderLabel } from '@/features/common/components/listing-order-label'

type Props = {
assetId: AssetId
Expand All @@ -14,5 +15,10 @@ export function AssetTransactionHistory({ assetId }: Props) {
const createLoadablePage = useMemo(() => createLoadableAssetTransactionsPage(assetId), [assetId])
const getSubRows = useCallback((row: Transaction | InnerTransaction) => getAssetTransactionsTableSubRows(assetId, row), [assetId])

return <LazyLoadDataTable columns={transactionsTableColumns} getSubRows={getSubRows} createLoadablePage={createLoadablePage} />
return (
<div>
<LazyLoadDataTable columns={transactionsTableColumns} getSubRows={getSubRows} createLoadablePage={createLoadablePage} />
<ListingOrderLabel />
</div>
)
}
10 changes: 10 additions & 0 deletions src/features/common/components/listing-order-label.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type Props = {
oldestToNewest?: boolean
}
export function ListingOrderLabel({ oldestToNewest = true }: Props) {
return (
<div className="mt-3">
<small>Note: This listing is {oldestToNewest ? 'oldest to newest' : 'newest to oldest'}.</small>
</div>
)
}
2 changes: 1 addition & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,6 @@
}

small {
@apply text-sm font-medium leading-none;
@apply text-sm text-muted-foreground leading-none;
}
}

0 comments on commit 6d44abf

Please sign in to comment.