Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom block ordering on address transaction page #2387

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion types/api/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,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.
Loading