Skip to content

Commit 351ee03

Browse files
authored
feat(leaderboard): Show Validator Identity, Use Timestamp (#2947)
1 parent bc60aea commit 351ee03

File tree

21 files changed

+652
-388
lines changed

21 files changed

+652
-388
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export const INDEXING_PROGRESS_QUERY_KEY = 'indexingProgress';
22
export const LEADERBOARD_QUERY_KEY = 'leaderboard';
33
export const LATEST_FINALIZED_BLOCK_QUERY_KEY = 'latestFinalizedBlock';
4+
export const ACCOUNT_IDENTITIES_QUERY_KEY = 'accountIdentities';

apps/leaderboard/src/features/indexingProgress/components/SyncProgressIndicator.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ export const SyncProgressIndicator = () => {
5555
animated={!isSynced}
5656
/>
5757
{isSynced
58-
? `Indexing ${lastProcessedBlock} of ${targetBlock}`
59-
: 'Syncing...'}{' '}
58+
? `Synced ${lastProcessedBlock} of ${targetBlock} `
59+
: `Indexing ${lastProcessedBlock} of ${targetBlock} `}
6060
({progress.toFixed(2)}%)
6161
</>
6262
);

apps/leaderboard/src/features/indexingProgress/queries/indexingProgressQuery.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ const IndexingProgressQueryDocument = graphql(/* GraphQL */ `
88
query IndexingProgress {
99
_metadata {
1010
lastProcessedHeight
11-
lastProcessedTimestamp
1211
targetHeight
13-
indexerHealthy
1412
}
1513
}
1614
`);

apps/leaderboard/src/features/leaderboard/components/BadgesCell.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
import capitalize from 'lodash/capitalize';
2-
import cx from 'classnames';
31
import {
42
Tooltip,
53
TooltipBody,
64
TooltipTrigger,
75
} from '@tangle-network/ui-components/components/Tooltip';
8-
import type { FC } from 'react';
96
import { Typography } from '@tangle-network/ui-components/typography/Typography';
7+
import capitalize from 'lodash/capitalize';
8+
import type { FC } from 'react';
109
import { BADGE_ICON_RECORD, BadgeEnum } from '../constants';
1110

1211
export const BadgesCell: FC<{ badges: BadgeEnum[] }> = ({ badges }) => {
1312
return (
14-
<div className="flex flex-wrap gap-[2px]">
13+
<div className="flex items-center gap-0.5">
1514
{badges.length === 0 ? (
1615
<Typography variant="body1">No badges</Typography>
1716
) : (
@@ -35,15 +34,8 @@ type Props = {
3534
const BadgeWithTooltip: FC<Props> = ({ badge, emoji }) => {
3635
return (
3736
<Tooltip>
38-
<TooltipTrigger asChild>
39-
<div
40-
className={cx(
41-
'size-6 aspect-square rounded-full cursor-pointer',
42-
'flex items-center justify-center',
43-
)}
44-
>
45-
<Typography variant="body1">{emoji}</Typography>
46-
</div>
37+
<TooltipTrigger className="size-6 aspect-square flex-initial">
38+
{emoji}
4739
</TooltipTrigger>
4840

4941
<TooltipBody>{badge.split('_').map(capitalize).join(' ')}</TooltipBody>

apps/leaderboard/src/features/leaderboard/components/ExpandedInfo.tsx

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,25 @@ import { CircleIcon } from '@radix-ui/react-icons';
22
import { CheckboxCircleFill } from '@tangle-network/icons';
33
import {
44
Card,
5+
isSubstrateAddress,
56
KeyValueWithButton,
67
Typography,
8+
ValidatorIdentity,
79
} from '@tangle-network/ui-components';
810
import { Row } from '@tanstack/react-table';
911
import React from 'react';
1012
import { Account } from '../types';
13+
import { createAccountExplorerUrl } from '../utils/createAccountExplorerUrl';
1114
import { formatDisplayBlockNumber } from '../utils/formatDisplayBlockNumber';
1215

1316
interface ExpandedInfoProps {
1417
row: Row<Account>;
15-
latestBlockNumber?: number | null;
16-
latestBlockTimestamp?: Date | null;
1718
}
1819

19-
export const ExpandedInfo: React.FC<ExpandedInfoProps> = ({
20-
row,
21-
latestBlockNumber,
22-
latestBlockTimestamp,
23-
}) => {
20+
export const ExpandedInfo: React.FC<ExpandedInfoProps> = ({ row }) => {
2421
const account = row.original;
2522
const address = account.id;
23+
const accountNetwork = account.network;
2624

2725
// Helper function to render a detail row with label and value
2826
const DetailRow = ({
@@ -80,22 +78,32 @@ export const ExpandedInfo: React.FC<ExpandedInfoProps> = ({
8078
<Section title="Account Details">
8179
<DetailRow
8280
label="Account ID"
83-
value={<KeyValueWithButton size="sm" keyValue={address} />}
81+
value={
82+
isSubstrateAddress(address) ? (
83+
<ValidatorIdentity
84+
address={address}
85+
accountExplorerUrl={createAccountExplorerUrl(
86+
address,
87+
accountNetwork,
88+
)}
89+
/>
90+
) : (
91+
<KeyValueWithButton size="sm" keyValue={address} />
92+
)
93+
}
8494
/>
8595
<DetailRow
8696
label="Created"
8797
value={formatDisplayBlockNumber(
8898
account.createdAt,
89-
latestBlockNumber,
90-
latestBlockTimestamp,
99+
account.createdAtTimestamp,
91100
)}
92101
/>
93102
<DetailRow
94103
label="Last Updated"
95104
value={formatDisplayBlockNumber(
96105
account.lastUpdatedAt,
97-
latestBlockNumber,
98-
latestBlockTimestamp,
106+
account.lastUpdatedAtTimestamp,
99107
)}
100108
/>
101109
</Section>

0 commit comments

Comments
 (0)