Skip to content

Commit c818ade

Browse files
authored
feat: Add validators fee voting tab & reorganize Network tab (#1098)
## High Level Overview of Change <!-- Please include a summary/list of the changes. If too broad, please consider splitting into multiple PRs. --> This PR is trying to achieve the following: - Add voting (for fee voting) and uptime (similar to the existing page) for validators page. - Remove "validators", "nodes", and "upgrade status" tabs for Network. Each now would be a separate page under Network in top nav bar. - Refactor ValidatorsTable.jsx into TypeScript hooks. Resolve: #1058 ### Type of Change <!-- Please check relevant options, delete irrelevant ones. --> - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [x] Refactor (non-breaking change that only restructures code) - [ ] Tests (You added tests for code that already exists, or your new feature included in this PR) - [ ] Documentation Updates - [ ] Translation Updates - [ ] Release ### TypeScript/Hooks Update <!-- In an effort to modernize the codebase, you should convert the files that you work with to React Hooks and TypeScript. If this is not possible (e.g. it's too many changes, touching too many files, etc.) please explain why here. --> - [x] Updated files to React Hooks - [x] Updated files to TypeScript ## Before / After <!-- If just refactoring / back-end changes, this can be just an in-English description of the change at a technical level. If a UI change, screenshots should be included. --> Validators page (Uptime): <img width="513" alt="Screenshot 2024-12-11 at 11 54 28 AM" src="https://github.com/user-attachments/assets/1d10a49b-ea64-40bc-83ec-ad1373c0af27" /> Validators page (Voting): <img width="514" alt="Screenshot 2024-12-11 at 1 39 56 PM" src="https://github.com/user-attachments/assets/17bcc4a5-e85c-4b3c-9296-e475012587fe" /> Voting Mobile View: <img width="358" alt="Screenshot 2024-12-11 at 1 40 39 PM" src="https://github.com/user-attachments/assets/cbc94bf0-b658-4408-850f-b95a9ef4489f" /> Upgrade Status: <img width="508" alt="Screenshot 2024-12-11 at 1 41 16 PM" src="https://github.com/user-attachments/assets/98ca1c7c-2a5c-4139-b6d4-563ef0f1d1f7" />
1 parent cfa322a commit c818ade

30 files changed

+493
-326
lines changed

public/locales/ca-CA/translations.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@
558558
"enable_amendment_name": null,
559559
"amendment_status": null,
560560
"expected_date": null,
561+
"base": null,
561562
"credential_type": null,
562563
"credential_issuer": null,
563564
"subject": null,

public/locales/en-US/translations.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@
559559
"enable_amendment_name": "Amendment Name",
560560
"amendment_status": "Amendment Status",
561561
"expected_date": "Expected Date",
562+
"base": "Base",
562563
"credential_type": "Credential Type",
563564
"credential_issuer": "Credential Issuer",
564565
"subject": "Subject",

public/locales/es-ES/translations.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@
554554
"enable_amendment_name": null,
555555
"amendment_status": null,
556556
"expected_date": null,
557+
"base": null,
557558
"credential_type": null,
558559
"credential_issuer": null,
559560
"subject": null,

public/locales/fr-FR/translations.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@
555555
"enable_amendment_name": null,
556556
"amendment_status": null,
557557
"expected_date": null,
558+
"base": null,
558559
"credential_type": null,
559560
"credential_issuer": null,
560561
"subject": null,

public/locales/ja-JP/translations.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@
554554
"enable_amendment_name": null,
555555
"amendment_status": null,
556556
"expected_date": null,
557+
"base": null,
557558
"credential_type": null,
558559
"credential_issuer": null,
559560
"subject": null,

public/locales/ko-KR/translations.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@
552552
"enable_amendment_name": null,
553553
"amendment_status": null,
554554
"expected_date": null,
555+
"base": null,
555556
"credential_type": null,
556557
"credential_issuer": null,
557558
"subject": null,

src/containers/App/index.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,21 @@ import {
1717
ACCOUNT_ROUTE,
1818
LEDGER_ROUTE,
1919
LEDGERS_ROUTE,
20-
NETWORK_ROUTE,
2120
NFT_ROUTE,
2221
TOKEN_ROUTE,
2322
TRANSACTION_ROUTE,
2423
VALIDATOR_ROUTE,
2524
AMENDMENTS_ROUTE,
2625
AMENDMENT_ROUTE,
2726
MPT_ROUTE,
27+
NODES_ROUTE,
28+
VALIDATORS_ROUTE,
29+
UPGRADE_STATUS_ROUTE,
2830
} from './routes'
2931
import { LedgersPage as Ledgers } from '../Ledgers'
3032
import { Ledger } from '../Ledger'
3133
import { AccountsRouter } from '../Accounts/AccountsRouter'
3234
import { Transaction } from '../Transactions'
33-
import { Network } from '../Network'
3435
import { Validator } from '../Validators'
3536
import { Token } from '../Token'
3637
import { NFT } from '../NFT/NFT'
@@ -39,6 +40,9 @@ import { useCustomNetworks } from '../shared/hooks'
3940
import { Amendments } from '../Amendments'
4041
import { Amendment } from '../Amendment'
4142
import { MPT } from '../MPT/MPT'
43+
import { Nodes } from '../Network/Nodes'
44+
import { Validators } from '../Network/Validators'
45+
import { UpgradeStatus } from '../Network/UpgradeStatus'
4246

4347
export const AppWrapper = () => {
4448
const mode = process.env.VITE_ENVIRONMENT
@@ -65,7 +69,9 @@ export const AppWrapper = () => {
6569
[LEDGER_ROUTE, Ledger],
6670
[ACCOUNT_ROUTE, AccountsRouter],
6771
[TRANSACTION_ROUTE, Transaction],
68-
[NETWORK_ROUTE, Network],
72+
[NODES_ROUTE, Nodes],
73+
[VALIDATORS_ROUTE, Validators],
74+
[UPGRADE_STATUS_ROUTE, UpgradeStatus],
6975
[AMENDMENTS_ROUTE, Amendments],
7076
[VALIDATOR_ROUTE, Validator],
7177
[TOKEN_ROUTE, Token],

src/containers/App/navigation.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ import { NavigationMenuAnyRoute } from '../Header/NavigationMenu'
33
import {
44
AMENDMENTS_ROUTE,
55
LEDGERS_ROUTE,
6-
NETWORK_ROUTE,
7-
VALIDATOR_ROUTE,
6+
NODES_ROUTE,
7+
UPGRADE_STATUS_ROUTE,
8+
VALIDATORS_ROUTE,
89
} from './routes'
910

1011
const isNetwork = (path) =>
11-
path.indexOf(buildPath(NETWORK_ROUTE, {})) === 0 ||
12-
path.indexOf(buildPath(VALIDATOR_ROUTE, { identifier: '' })) === 0
12+
path.indexOf(buildPath(VALIDATORS_ROUTE, {})) === 0 ||
13+
path.indexOf(buildPath(NODES_ROUTE, {})) === 0 ||
14+
path.indexOf(buildPath(UPGRADE_STATUS_ROUTE, {})) === 0 ||
15+
path.indexOf(buildPath(AMENDMENTS_ROUTE, {})) === 0
1316

1417
// NOTE: for submenus, remove `path` field and add `children` array of objects
1518
export const navigationConfig: NavigationMenuAnyRoute[] = [
@@ -19,24 +22,20 @@ export const navigationConfig: NavigationMenuAnyRoute[] = [
1922
current: (path: string) => !isNetwork(path),
2023
},
2124
{
22-
route: NETWORK_ROUTE,
2325
title: 'network',
2426
current: (path: string) => isNetwork(path),
2527
children: [
2628
{
27-
route: NETWORK_ROUTE,
29+
route: NODES_ROUTE,
2830
title: 'nodes',
29-
params: { tab: 'nodes' },
3031
},
3132
{
32-
route: NETWORK_ROUTE,
33+
route: VALIDATORS_ROUTE,
3334
title: 'validators',
34-
params: { tab: 'validators' },
3535
},
3636
{
37-
route: NETWORK_ROUTE,
37+
route: UPGRADE_STATUS_ROUTE,
3838
title: 'upgrade_status',
39-
params: { tab: 'upgrade-status' },
4039
},
4140
{
4241
route: AMENDMENTS_ROUTE,

src/containers/App/routes.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,18 @@ export const LEDGER_ROUTE: RouteDefinition<{
1818
path: `/ledgers/:identifier`,
1919
}
2020

21-
export const NETWORK_ROUTE: RouteDefinition<{
22-
tab?: 'nodes' | 'validators' | 'upgrade-status'
21+
export const NODES_ROUTE: RouteDefinition = {
22+
path: '/network/nodes',
23+
}
24+
25+
export const VALIDATORS_ROUTE: RouteDefinition<{
26+
tab?: 'uptime' | 'voting'
2327
}> = {
24-
path: '/network/:tab?',
28+
path: '/network/validators/:tab?',
29+
}
30+
31+
export const UPGRADE_STATUS_ROUTE: RouteDefinition = {
32+
path: '/network/upgrade-status',
2533
}
2634

2735
export const NFT_ROUTE: RouteDefinition<{

src/containers/Network/NetworkTabs.tsx

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)