From a95185de5e93b52103cec56dda2bb9ce5969f7a7 Mon Sep 17 00:00:00 2001 From: Kristof Csillag Date: Wed, 29 May 2024 16:13:06 +0200 Subject: [PATCH] Add config variable for skipping the graph This is mostly useful if we want to restrict a deployment to display only a few layers. --- .changelog/1441.intermal.md | 1 + .env | 1 + .env.production | 1 + public/pontusx/new/pontusx-special-o-blue.svg | 62 +++++++++++++++++++ .../pontusx/new/pontusx-special-o-white.svg | 62 +++++++++++++++++++ .../pontusx/new/pontusx_horizontal_blue.svg | 47 ++++++++++++++ .../pontusx/new/pontusx_horizontal_white.svg | 47 ++++++++++++++ public/pontusx/new/pontusx_vertical_blue.svg | 47 ++++++++++++++ public/pontusx/new/pontusx_vertical_white.svg | 47 ++++++++++++++ src/app/utils/route-utils.ts | 1 + src/routes.tsx | 12 ++-- src/types/global.d.ts | 1 + 12 files changed, 325 insertions(+), 4 deletions(-) create mode 100644 .changelog/1441.intermal.md create mode 100644 public/pontusx/new/pontusx-special-o-blue.svg create mode 100644 public/pontusx/new/pontusx-special-o-white.svg create mode 100644 public/pontusx/new/pontusx_horizontal_blue.svg create mode 100644 public/pontusx/new/pontusx_horizontal_white.svg create mode 100644 public/pontusx/new/pontusx_vertical_blue.svg create mode 100644 public/pontusx/new/pontusx_vertical_white.svg diff --git a/.changelog/1441.intermal.md b/.changelog/1441.intermal.md new file mode 100644 index 0000000000..9de0c9493f --- /dev/null +++ b/.changelog/1441.intermal.md @@ -0,0 +1 @@ +Add more configuration options for paratimes diff --git a/.env b/.env index 41f5ce9938..ffcfc490d5 100644 --- a/.env +++ b/.env @@ -27,4 +27,5 @@ REACT_APP_STAGING_URLS=https://explorer.stg.oasis.io REACT_APP_SHOW_BUILD_BANNERS=true # REACT_APP_FIXED_NETWORK=testnet # REACT_APP_FIXED_LAYER=sapphire +# REACT_APP_SKIP_GRAPH=true REACT_APP_SHOW_FIAT_VALUES=true diff --git a/.env.production b/.env.production index 165b287f88..6551bf3ffc 100644 --- a/.env.production +++ b/.env.production @@ -22,4 +22,5 @@ REACT_APP_STAGING_URLS=https://explorer.stg.oasis.io REACT_APP_SHOW_BUILD_BANNERS=true # REACT_APP_FIXED_NETWORK=testnet # REACT_APP_FIXED_LAYER=sapphire +# REACT_APP_SKIP_GRAPH=true REACT_APP_SHOW_FIAT_VALUES=true diff --git a/public/pontusx/new/pontusx-special-o-blue.svg b/public/pontusx/new/pontusx-special-o-blue.svg new file mode 100644 index 0000000000..7ee32c95b5 --- /dev/null +++ b/public/pontusx/new/pontusx-special-o-blue.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/pontusx/new/pontusx-special-o-white.svg b/public/pontusx/new/pontusx-special-o-white.svg new file mode 100644 index 0000000000..b75a26e937 --- /dev/null +++ b/public/pontusx/new/pontusx-special-o-white.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/pontusx/new/pontusx_horizontal_blue.svg b/public/pontusx/new/pontusx_horizontal_blue.svg new file mode 100644 index 0000000000..5cf1e50cd5 --- /dev/null +++ b/public/pontusx/new/pontusx_horizontal_blue.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/pontusx/new/pontusx_horizontal_white.svg b/public/pontusx/new/pontusx_horizontal_white.svg new file mode 100644 index 0000000000..fb05dfa65b --- /dev/null +++ b/public/pontusx/new/pontusx_horizontal_white.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/pontusx/new/pontusx_vertical_blue.svg b/public/pontusx/new/pontusx_vertical_blue.svg new file mode 100644 index 0000000000..e59c8e0407 --- /dev/null +++ b/public/pontusx/new/pontusx_vertical_blue.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/pontusx/new/pontusx_vertical_white.svg b/public/pontusx/new/pontusx_vertical_white.svg new file mode 100644 index 0000000000..da62d6f594 --- /dev/null +++ b/public/pontusx/new/pontusx_vertical_white.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/utils/route-utils.ts b/src/app/utils/route-utils.ts index db2e42c450..4d99cb82b8 100644 --- a/src/app/utils/route-utils.ts +++ b/src/app/utils/route-utils.ts @@ -11,6 +11,7 @@ import { isLayerHidden } 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 +export const skipGraph = !!fixedLayer || !!(process.env.REACT_APP_SKIP_GRAPH as boolean | undefined) export type ScopeFreedom = | 'network' // We can select only the network diff --git a/src/routes.tsx b/src/routes.tsx index 3a733452d1..d9c9098ff8 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -23,6 +23,7 @@ import { fixedNetwork, fixedLayer, RouteUtils, + skipGraph, } from './app/utils/route-utils' import { RoutingErrorPage } from './app/pages/RoutingErrorPage' import { ThemeByNetwork, withDefaultTheme } from './app/components/ThemeByNetwork' @@ -65,7 +66,7 @@ const NetworkSpecificPart = () => ( ) /** - * In case of being restricted to a specific layer, jump to a dashboard + * In case of being restricted to a specific layer or layers, jump to a dashboard * * This should be rendered on the landing page, since we don't want the opening graph. */ @@ -75,8 +76,11 @@ const RedirectToDashboard: FC = () => { useEffect(() => navigate( RouteUtils.getDashboardRoute({ - network: fixedNetwork ?? RouteUtils.getEnabledNetworksForLayer(fixedLayer!)[0]!, - layer: fixedLayer!, + network: + fixedNetwork ?? fixedLayer + ? RouteUtils.getEnabledNetworksForLayer(fixedLayer)[0]! + : RouteUtils.getEnabledScopes()[0].network, + layer: fixedLayer ?? RouteUtils.getEnabledScopes()[0].layer, }), ), ) @@ -99,7 +103,7 @@ export const routes: RouteObject[] = [ children: [ { path: '/', - element: fixedLayer ? : withDefaultTheme(, true), + element: skipGraph ? : withDefaultTheme(, true), }, ...(!!fixedNetwork && !!fixedLayer ? [] diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 42bdd67405..ce3fbc22b7 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -28,6 +28,7 @@ declare global { REACT_APP_STAGING_URLS?: string REACT_APP_FIXED_NETWORK?: string REACT_APP_FIXED_LAYER?: string + REACT_APP_SKIP_GRAPH?: string REACT_APP_SHOW_FIAT_VALUES: 'true' | 'false' } }