diff --git a/src/app/components/PageLayout/Header.tsx b/src/app/components/PageLayout/Header.tsx index 0262b36b06..b47058e983 100644 --- a/src/app/components/PageLayout/Header.tsx +++ b/src/app/components/PageLayout/Header.tsx @@ -18,7 +18,7 @@ const needsScopeSelector = (): boolean => { case 'network': return RouteUtils.getEnabledNetworksForLayer(getFixedLayer()!).length > 1 case 'layer': - return RouteUtils.getEnabledLayersForNetwork(getFixedNetwork()!).length > 1 + return RouteUtils.getVisibleLayersForNetwork(getFixedNetwork()!).length > 1 case 'both': return RouteUtils.getEnabledScopes().length > 1 case 'none': diff --git a/src/app/utils/route-utils.ts b/src/app/utils/route-utils.ts index b78f8043b7..7792d083e4 100644 --- a/src/app/utils/route-utils.ts +++ b/src/app/utils/route-utils.ts @@ -7,6 +7,7 @@ import { Network } from '../../types/network' import { SearchScope } from '../../types/searchScope' import { isStableDeploy } from '../../config' import { getSearchTermFromRequest } from '../components/Search/search-utils' +import { isLayerNotHidden } from '../../types/layers' export const isTesting = () => process.env.NODE_ENV === 'test' @@ -154,6 +155,10 @@ export abstract class RouteUtils { return Object.values(Layer).filter(layer => RouteUtils.ENABLED_LAYERS_FOR_NETWORK[network][layer]) } + static getVisibleLayersForNetwork(network: Network): Layer[] { + return this.getEnabledLayersForNetwork(network).filter(isLayerNotHidden) + } + static getProposalsRoute = (network: Network) => { return `${getNetworkPath(network)}/consensus/proposal` } diff --git a/src/types/layers.ts b/src/types/layers.ts index 53ed43c177..58f9ff9e2b 100644 --- a/src/types/layers.ts +++ b/src/types/layers.ts @@ -33,5 +33,6 @@ export const doesAnyOfTheseLayersSupportEncryptedTransactions = (layers: Layer[] uniq(layers).some(doesLayerSupportEncryptedTransactions) export const isLayerHidden = (layer: Layer): boolean => hiddenLayers.includes(layer) +export const isLayerNotHidden = (layer: Layer): boolean => !hiddenLayers.includes(layer) export const isNotOnHiddenLayer = (item: HasLayer) => !isLayerHidden(item.layer)