Skip to content

Commit

Permalink
Explorer validator sorting (#7481)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jibz1 authored Jan 23, 2023
1 parent 6b27f65 commit 958802e
Show file tree
Hide file tree
Showing 9 changed files with 317 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ const TRUNCATE_LENGTH = 16;

const columns = [
{
headerLabel: 'Time',
header: 'Time',
accessorKey: 'time',
},
{
headerLabel: 'Package ID',
header: 'Package ID',
accessorKey: 'packageId',
},
{
headerLabel: 'Transaction ID',
header: 'Transaction ID',
accessorKey: 'txnDigest',
},
{
headerLabel: 'Sender',
header: 'Sender',
accessorKey: 'sender',
},
];
Expand Down
19 changes: 13 additions & 6 deletions apps/explorer/src/components/top-validators-card/StakeColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,30 @@

import { SUI_TYPE_ARG } from '@mysten/sui.js';

import { useFormatCoin } from '~/hooks/useFormatCoin';
import { useFormatCoin, CoinFormat } from '~/hooks/useFormatCoin';
import { Text } from '~/ui/Text';

type StakeColumnProps = {
stake: bigint | number | string;
hideCoinSymbol?: boolean;
};

export function StakeColumn({ stake }: StakeColumnProps) {
const [amount, symbol] = useFormatCoin(stake, SUI_TYPE_ARG);
export function StakeColumn({ stake, hideCoinSymbol }: StakeColumnProps) {
const [amount, symbol] = useFormatCoin(
stake,
SUI_TYPE_ARG,
hideCoinSymbol ? CoinFormat.FULL : CoinFormat.ROUNDED
);
return (
<div className="flex items-end gap-0.5">
<Text variant="bodySmall/medium" color="steel-darker">
{amount}
</Text>
<Text variant="captionSmall/medium" color="steel-dark">
{symbol}
</Text>
{!hideCoinSymbol && (
<Text variant="captionSmall/medium" color="steel-dark">
{symbol}
</Text>
)}
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ const validatorsTable = (
}),
columns: [
{
headerLabel: 'Name',
header: 'Name',
accessorKey: 'name',
},
{
headerLabel: 'Address',
header: 'Address',
accessorKey: 'address',
},
{
headerLabel: 'Stake',
header: 'Stake',
accessorKey: 'stake',
},
],
Expand Down
14 changes: 6 additions & 8 deletions apps/explorer/src/components/transaction-card/TxCardUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,31 +141,29 @@ export const genTableDataFromTxData = (
})),
columns: [
{
headerLabel: 'Time',
header: 'Time',
accessorKey: 'date',
},
{
headerLabel: 'Type',
header: 'Type',
accessorKey: 'txTypes',
},
{
headerLabel: () => (
header: () => (
<div className={styles.addresses}>Transaction ID</div>
),
accessorKey: 'transactionId',
},
{
headerLabel: () => (
<div className={styles.addresses}>Addresses</div>
),
header: () => <div className={styles.addresses}>Addresses</div>,
accessorKey: 'addresses',
},
{
headerLabel: 'Amount',
header: 'Amount',
accessorKey: 'amounts',
},
{
headerLabel: 'Gas',
header: 'Gas',
accessorKey: 'gas',
},
],
Expand Down
Loading

2 comments on commit 958802e

@vercel
Copy link

@vercel vercel bot commented on 958802e Jan 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

explorer – ./apps/explorer

explorer-mysten-labs.vercel.app
explorer-topaz.vercel.app
explorer-git-main-mysten-labs.vercel.app
explorer.sui.io

@vercel
Copy link

@vercel vercel bot commented on 958802e Jan 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wallet-adapter – ./sdk/wallet-adapter/example

wallet-adapter-mysten-labs.vercel.app
sui-wallet-adapter.vercel.app
wallet-adapter-git-main-mysten-labs.vercel.app

Please sign in to comment.