diff --git a/src/app/components/LayerPicker/LayerMenu.tsx b/src/app/components/LayerPicker/LayerMenu.tsx index e5b6c18ebe..20c7a9a3e6 100644 --- a/src/app/components/LayerPicker/LayerMenu.tsx +++ b/src/app/components/LayerPicker/LayerMenu.tsx @@ -9,9 +9,9 @@ import Tooltip from '@mui/material/Tooltip' import { COLORS } from '../../../styles/theme/colors' import { Layer } from '../../../oasis-nexus/api' import { getLayerLabels } from '../../utils/content' -import { RouteUtils } from '../../utils/route-utils' +import { isLayerHidden, RouteUtils } from '../../utils/route-utils' import { Network } from '../../../types/network' -import { isLayerHidden, orderByLayer } from '../../../types/layers' +import { orderByLayer } from '../../../types/layers' import { useScreenSize } from '../../hooks/useScreensize' import { useScopeParam } from '../../hooks/useScopeParam' diff --git a/src/app/pages/ConsensusDashboardPage/ParaTimesCard.tsx b/src/app/pages/ConsensusDashboardPage/ParaTimesCard.tsx index 55430e42c5..e16fa13815 100644 --- a/src/app/pages/ConsensusDashboardPage/ParaTimesCard.tsx +++ b/src/app/pages/ConsensusDashboardPage/ParaTimesCard.tsx @@ -6,10 +6,9 @@ import CardHeader from '@mui/material/CardHeader' import CardContent from '@mui/material/CardContent' import { styled } from '@mui/material/styles' import { Layer, Runtime } from '../../../oasis-nexus/api' -import { isNotOnHiddenLayer } from '../../../types/layers' import { COLORS } from '../../../styles/theme/colors' import { CardHeaderWithCounter } from '../../components/CardHeaderWithCounter' -import { RouteUtils } from '../../utils/route-utils' +import { isNotOnHiddenLayer, RouteUtils } from '../../utils/route-utils' import { SearchScope } from '../../../types/searchScope' import { EnabledRuntimePreview, InactiveRuntimePreview } from './RuntimePreview' diff --git a/src/app/utils/route-utils.ts b/src/app/utils/route-utils.ts index a7162bcdf2..5a649e64bb 100644 --- a/src/app/utils/route-utils.ts +++ b/src/app/utils/route-utils.ts @@ -7,7 +7,7 @@ import { Network } from '../../types/network' import { SearchScope } from '../../types/searchScope' import { isStableDeploy } from '../../config' import { getSearchTermFromRequest } from '../components/Search/search-utils' -import { isLayerHidden } from '../../types/layers' +import type { HasLayer } from '../../types/layers' export const fixedNetwork = process.env.REACT_APP_FIXED_NETWORK as Network | undefined export const fixedLayer = process.env.REACT_APP_FIXED_LAYER as Layer | undefined @@ -37,6 +37,12 @@ export type SpecifiedPerEnabledLayer = { export type SpecifiedPerEnabledRuntime = SpecifiedPerEnabledLayer +export const hiddenLayers: Layer[] = [Layer.pontusxdev, Layer.pontusx] + +export const isLayerHidden = (layer: Layer): boolean => hiddenLayers.includes(layer) + +export const isNotOnHiddenLayer = (item: HasLayer) => !isLayerHidden(item.layer) + export abstract class RouteUtils { private static ENABLED_LAYERS_FOR_NETWORK = { [Network.mainnet]: { diff --git a/src/types/layers.ts b/src/types/layers.ts index 41df3c5d01..35c186a793 100644 --- a/src/types/layers.ts +++ b/src/types/layers.ts @@ -5,7 +5,7 @@ import { uniq } from '../app/utils/helpers' // eslint-disable-next-line no-restricted-imports import { Layer } from '../oasis-nexus/generated/api' -interface HasLayer { +export interface HasLayer { layer: Layer } @@ -20,8 +20,6 @@ const layerOrder: Record = { [Layer.pontusx]: 6, } -const hiddenLayers: Layer[] = [Layer.pontusxdev, Layer.pontusx] - export const orderByLayer = (itemA: HasLayer, itemB: HasLayer): number => layerOrder[itemA.layer] - layerOrder[itemB.layer] @@ -32,7 +30,3 @@ export const doesLayerSupportEncryptedTransactions = (layer: Layer): boolean => export const doesAnyOfTheseLayersSupportEncryptedTransactions = (layers: Layer[] | undefined): boolean => uniq(layers).some(doesLayerSupportEncryptedTransactions) - -export const isLayerHidden = (layer: Layer): boolean => hiddenLayers.includes(layer) - -export const isNotOnHiddenLayer = (item: HasLayer) => !isLayerHidden(item.layer)