Skip to content

Commit

Permalink
Add custom block ordering on address transaction page (#2387)
Browse files Browse the repository at this point in the history
Fixes #2366
  • Loading branch information
tom2drum authored Nov 25, 2024
1 parent bb745fe commit 712a4b1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion types/api/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export type TransactionType = 'rootstock_remasc' |
export type TxsResponse = TransactionsResponseValidated | TransactionsResponsePending | BlockTransactionsResponse;

export interface TransactionsSorting {
sort: 'value' | 'fee';
sort: 'value' | 'fee' | 'block_number';
order: 'asc' | 'desc';
}

Expand Down
1 change: 1 addition & 0 deletions ui/txs/TxsContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import TxsTable from './TxsTable';
const SORT_SEQUENCE: Record<TransactionsSortingField, Array<TransactionsSortingValue | undefined>> = {
value: [ 'value-desc', 'value-asc', undefined ],
fee: [ 'fee-desc', 'fee-asc', undefined ],
block_number: [ 'block_number-asc', undefined ],
};

type Props = {
Expand Down
14 changes: 11 additions & 3 deletions ui/txs/TxsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,19 @@ const TxsTable = ({
<Th width="180px">Txn hash</Th>
<Th width="160px">Type</Th>
<Th width="20%">Method</Th>
{ showBlockInfo && <Th width="18%">Block</Th> }
{ showBlockInfo && (
<Th width="18%">
<Link onClick={ isLoading ? undefined : sort('block_number') } display="flex" alignItems="center">
{ sorting === 'block_number-asc' && <IconSvg boxSize={ 5 } name="arrows/east" transform="rotate(-90deg)"/> }
{ sorting === 'block_number-desc' && <IconSvg boxSize={ 5 } name="arrows/east" transform="rotate(90deg)"/> }
Block
</Link>
</Th>
) }
<Th width="224px">From/To</Th>
{ !config.UI.views.tx.hiddenFields?.value && (
<Th width="20%" isNumeric>
<Link onClick={ sort('value') } display="flex" justifyContent="end">
<Link onClick={ isLoading ? undefined : sort('value') } display="flex" alignItems="center" justifyContent="end">
{ sorting === 'value-asc' && <IconSvg boxSize={ 5 } name="arrows/east" transform="rotate(-90deg)"/> }
{ sorting === 'value-desc' && <IconSvg boxSize={ 5 } name="arrows/east" transform="rotate(90deg)"/> }
{ `Value ${ currencyUnits.ether }` }
Expand All @@ -69,7 +77,7 @@ const TxsTable = ({
) }
{ !config.UI.views.tx.hiddenFields?.tx_fee && (
<Th width="20%" isNumeric pr={ 5 }>
<Link onClick={ sort('fee') } display="flex" justifyContent="end">
<Link onClick={ isLoading ? undefined : sort('fee') } display="flex" alignItems="center" justifyContent="end">
{ sorting === 'fee-asc' && <IconSvg boxSize={ 5 } name="arrows/east" transform="rotate(-90deg)"/> }
{ sorting === 'fee-desc' && <IconSvg boxSize={ 5 } name="arrows/east" transform="rotate(90deg)"/> }
{ `Fee${ feeCurrency }` }
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 712a4b1

Please sign in to comment.