From 95a6c387031f531ae88924771e24c895948a9cfc Mon Sep 17 00:00:00 2001 From: MananTank Date: Wed, 16 Apr 2025 21:16:01 +0000 Subject: [PATCH] [NEB-173]: Hide testnets in nebula chain selector (#6746) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ## PR-Codex overview This PR introduces the ability to hide test networks in the `MultiNetworkSelector` component and updates its props accordingly. ### Detailed summary - Added `hideTestnets` prop to `MultiNetworkSelector` in `NetworkSelectors.tsx`. - Implemented filtering of `sortedChains` to exclude test networks if `hideTestnets` is true. - Updated dependency array in `useEffect` to include `props.hideTestnets`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .../dashboard/src/@/components/blocks/NetworkSelectors.tsx | 7 ++++++- .../src/app/nebula-app/(app)/components/ContextFilters.tsx | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/dashboard/src/@/components/blocks/NetworkSelectors.tsx b/apps/dashboard/src/@/components/blocks/NetworkSelectors.tsx index e8ccfe01a56..99a5943230c 100644 --- a/apps/dashboard/src/@/components/blocks/NetworkSelectors.tsx +++ b/apps/dashboard/src/@/components/blocks/NetworkSelectors.tsx @@ -19,6 +19,7 @@ export function MultiNetworkSelector(props: { disableChainId?: boolean; className?: string; priorityChains?: number[]; + hideTestnets?: boolean; }) { const { allChains, idToChain } = useAllChainsData(); @@ -44,13 +45,17 @@ export function MultiNetworkSelector(props: { sortedChains = [...priorityChains, ...otherChains]; } + if (props.hideTestnets) { + sortedChains = sortedChains.filter((chain) => !chain.testnet); + } + return sortedChains.map((chain) => { return { label: cleanChainName(chain.name), value: String(chain.chainId), }; }); - }, [allChains, props.priorityChains, idToChain]); + }, [allChains, props.priorityChains, idToChain, props.hideTestnets]); const searchFn = useCallback( (option: Option, searchValue: string) => { diff --git a/apps/dashboard/src/app/nebula-app/(app)/components/ContextFilters.tsx b/apps/dashboard/src/app/nebula-app/(app)/components/ContextFilters.tsx index ab037dd5248..b8daf0be7ad 100644 --- a/apps/dashboard/src/app/nebula-app/(app)/components/ContextFilters.tsx +++ b/apps/dashboard/src/app/nebula-app/(app)/components/ContextFilters.tsx @@ -189,6 +189,7 @@ export function ContextFiltersForm(props: { Chain IDs