From de04a5b527eb44596797af4e3a2e04bdd5ac4c1a Mon Sep 17 00:00:00 2001 From: Sam Keen Date: Wed, 6 Jul 2022 14:40:55 +0100 Subject: [PATCH] Feat/715: Create flag for explorer txs page (#717) * frontend-monorepo-715: Create flag for explorer txs page * frontend-monorepo-715: Prettier formatted * Update apps/explorer-e2e/.env Co-authored-by: Dexter Edwards Co-authored-by: Dexter Edwards --- apps/explorer-e2e/.env | 1 + apps/explorer-e2e/.env.devnet | 1 + apps/explorer-e2e/.env.stagnet1 | 1 + apps/explorer-e2e/.env.stagnet2 | 1 + apps/explorer-e2e/.env.testnet | 1 + apps/explorer/.env | 1 + apps/explorer/.env.capsule | 1 + apps/explorer/README.md | 1 + apps/explorer/src/app/config/env.ts | 1 + apps/explorer/src/app/routes/router-config.tsx | 4 ++-- apps/explorer/src/app/routes/txs/home/index.tsx | 12 ++++++++++-- 11 files changed, 21 insertions(+), 4 deletions(-) diff --git a/apps/explorer-e2e/.env b/apps/explorer-e2e/.env index 5254f0d9d..aeaff4720 100644 --- a/apps/explorer-e2e/.env +++ b/apps/explorer-e2e/.env @@ -11,6 +11,7 @@ NX_EXPLORER_ASSETS=1 NX_EXPLORER_GENESIS=1 NX_EXPLORER_GOVERNANCE=1 NX_EXPLORER_MARKETS=1 +NX_EXPLORER_TXS_LIST=0 NX_EXPLORER_NETWORK_PARAMETERS=1 NX_EXPLORER_PARTIES=1 NX_EXPLORER_VALIDATORS=1 diff --git a/apps/explorer-e2e/.env.devnet b/apps/explorer-e2e/.env.devnet index 8f70eae3b..3065f3c3a 100644 --- a/apps/explorer-e2e/.env.devnet +++ b/apps/explorer-e2e/.env.devnet @@ -11,6 +11,7 @@ NX_EXPLORER_ASSETS=1 NX_EXPLORER_GENESIS=1 NX_EXPLORER_GOVERNANCE=1 NX_EXPLORER_MARKETS=1 +NX_EXPLORER_TXS_LIST=1 NX_EXPLORER_NETWORK_PARAMETERS=1 NX_EXPLORER_PARTIES=1 NX_EXPLORER_VALIDATORS=1 diff --git a/apps/explorer-e2e/.env.stagnet1 b/apps/explorer-e2e/.env.stagnet1 index 25d7f4c53..1d833d3c9 100644 --- a/apps/explorer-e2e/.env.stagnet1 +++ b/apps/explorer-e2e/.env.stagnet1 @@ -11,6 +11,7 @@ NX_EXPLORER_ASSETS=1 NX_EXPLORER_GENESIS=1 NX_EXPLORER_GOVERNANCE=1 NX_EXPLORER_MARKETS=1 +NX_EXPLORER_TXS_LIST=1 NX_EXPLORER_NETWORK_PARAMETERS=1 NX_EXPLORER_PARTIES=1 NX_EXPLORER_VALIDATORS=1 diff --git a/apps/explorer-e2e/.env.stagnet2 b/apps/explorer-e2e/.env.stagnet2 index ba4aaec74..4352d0666 100644 --- a/apps/explorer-e2e/.env.stagnet2 +++ b/apps/explorer-e2e/.env.stagnet2 @@ -11,6 +11,7 @@ NX_EXPLORER_ASSETS=1 NX_EXPLORER_GENESIS=1 NX_EXPLORER_GOVERNANCE=1 NX_EXPLORER_MARKETS=1 +NX_EXPLORER_TXS_LIST=1 NX_EXPLORER_NETWORK_PARAMETERS=1 NX_EXPLORER_PARTIES=1 NX_EXPLORER_VALIDATORS=1 diff --git a/apps/explorer-e2e/.env.testnet b/apps/explorer-e2e/.env.testnet index 121ec4323..add164e7a 100644 --- a/apps/explorer-e2e/.env.testnet +++ b/apps/explorer-e2e/.env.testnet @@ -11,6 +11,7 @@ NX_EXPLORER_ASSETS=1 NX_EXPLORER_GENESIS=1 NX_EXPLORER_GOVERNANCE=1 NX_EXPLORER_MARKETS=1 +NX_EXPLORER_TXS_LIST=1 NX_EXPLORER_NETWORK_PARAMETERS=1 NX_EXPLORER_PARTIES=1 NX_EXPLORER_VALIDATORS=1 diff --git a/apps/explorer/.env b/apps/explorer/.env index 6715926fc..a978e7639 100644 --- a/apps/explorer/.env +++ b/apps/explorer/.env @@ -22,3 +22,4 @@ NX_EXPLORER_NETWORK_PARAMETERS=1 NX_EXPLORER_PARTIES=1 NX_EXPLORER_VALIDATORS=1 NX_EXPLORER_MARKETS=1 +NX_EXPLORER_TXS_LIST=1 diff --git a/apps/explorer/.env.capsule b/apps/explorer/.env.capsule index 4fa0a1a12..e9cd02f8c 100644 --- a/apps/explorer/.env.capsule +++ b/apps/explorer/.env.capsule @@ -12,6 +12,7 @@ NX_EXPLORER_ASSETS=1 NX_EXPLORER_GENESIS=1 NX_EXPLORER_GOVERNANCE=1 NX_EXPLORER_MARKETS=1 +NX_EXPLORER_TXS_LIST=1 NX_EXPLORER_NETWORK_PARAMETERS=1 NX_EXPLORER_PARTIES=1 NX_EXPLORER_VALIDATORS=1 diff --git a/apps/explorer/README.md b/apps/explorer/README.md index 22368e944..0a8e8cc7c 100644 --- a/apps/explorer/README.md +++ b/apps/explorer/README.md @@ -58,6 +58,7 @@ There are a few different configuration options offered for this app: | `NX_EXPLORER_GENESIS` | Enable the genesis page for the explorer | | `NX_EXPLORER_GOVERNANCE` | Enable the governance page for the explorer | | `NX_EXPLORER_MARKETS` | Enable the markets page for the explorer | +| `NX_EXPLORER_TXS_LIST` | Enable the transactions list page for the explorer | | `NX_EXPLORER_NETWORK_PARAMETERS` | Enable the network parameters page for the explorer | | `NX_EXPLORER_PARTIES` | Enable the parties page for the explorer | | `NX_EXPLORER_VALIDATORS` | Enable the validators page for the explorer | diff --git a/apps/explorer/src/app/config/env.ts b/apps/explorer/src/app/config/env.ts index 4a4e5bd4b..6340d421f 100644 --- a/apps/explorer/src/app/config/env.ts +++ b/apps/explorer/src/app/config/env.ts @@ -24,6 +24,7 @@ export const ENV = { genesis: truthy.includes(windowOrDefault('NX_EXPLORER_GENESIS')), governance: truthy.includes(windowOrDefault('NX_EXPLORER_GOVERNANCE')), markets: truthy.includes(windowOrDefault('NX_EXPLORER_MARKETS')), + txsList: truthy.includes(windowOrDefault('NX_EXPLORER_TXS_LIST')), networkParameters: truthy.includes( windowOrDefault('NX_EXPLORER_NETWORK_PARAMETERS') ), diff --git a/apps/explorer/src/app/routes/router-config.tsx b/apps/explorer/src/app/routes/router-config.tsx index 66ea07656..7117c326f 100644 --- a/apps/explorer/src/app/routes/router-config.tsx +++ b/apps/explorer/src/app/routes/router-config.tsx @@ -12,7 +12,7 @@ import Genesis from './genesis'; import { Block } from './blocks/id'; import { Blocks } from './blocks/home'; import { Tx } from './txs/id'; -import { TxsHome } from './txs/home'; +import { TxsHome, TxsHomeFallback } from './txs/home'; import { PendingTxs } from './pending'; import flags from '../config/flags'; import { t } from '@vegaprotocol/react-helpers'; @@ -129,7 +129,7 @@ const routerConfig = [ }, { index: true, - element: , + element: flags.txsList ? : , }, ], }, diff --git a/apps/explorer/src/app/routes/txs/home/index.tsx b/apps/explorer/src/app/routes/txs/home/index.tsx index 5316a02ea..17bad9184 100644 --- a/apps/explorer/src/app/routes/txs/home/index.tsx +++ b/apps/explorer/src/app/routes/txs/home/index.tsx @@ -94,7 +94,7 @@ const Txs = ({ latestBlockHeight }: TxsProps) => { ); }; -const Wrapper = () => { +export const TxsHome = () => { const { state: { data, error, loading }, } = useFetch( @@ -119,4 +119,12 @@ const Wrapper = () => { ); }; -export { Wrapper as TxsHome }; +export const TxsHomeFallback = () => ( + <> + {t('Transactions')} +
+ The transactions list is currently disabled. Please use the search bar to + discover transaction data +
+ +);