Skip to content

Commit 95a6c38

Browse files
committed
[NEB-173]: Hide testnets in nebula chain selector (#6746)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## 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}` <!-- end pr-codex -->
1 parent b1060de commit 95a6c38

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

apps/dashboard/src/@/components/blocks/NetworkSelectors.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export function MultiNetworkSelector(props: {
1919
disableChainId?: boolean;
2020
className?: string;
2121
priorityChains?: number[];
22+
hideTestnets?: boolean;
2223
}) {
2324
const { allChains, idToChain } = useAllChainsData();
2425

@@ -44,13 +45,17 @@ export function MultiNetworkSelector(props: {
4445
sortedChains = [...priorityChains, ...otherChains];
4546
}
4647

48+
if (props.hideTestnets) {
49+
sortedChains = sortedChains.filter((chain) => !chain.testnet);
50+
}
51+
4752
return sortedChains.map((chain) => {
4853
return {
4954
label: cleanChainName(chain.name),
5055
value: String(chain.chainId),
5156
};
5257
});
53-
}, [allChains, props.priorityChains, idToChain]);
58+
}, [allChains, props.priorityChains, idToChain, props.hideTestnets]);
5459

5560
const searchFn = useCallback(
5661
(option: Option, searchValue: string) => {

apps/dashboard/src/app/nebula-app/(app)/components/ContextFilters.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ export function ContextFiltersForm(props: {
189189
<FormLabel>Chain IDs</FormLabel>
190190
<FormControl>
191191
<MultiNetworkSelector
192+
hideTestnets
192193
disableChainId
193194
className="bg-background"
194195
selectedChainIds={form

0 commit comments

Comments
 (0)