From 6d71bb678e5afff07d63415bdc9b3e8a7b9fcd2b Mon Sep 17 00:00:00 2001 From: belopash Date: Thu, 9 May 2024 18:03:20 +0500 Subject: [PATCH] feat: make switcher demo feature --- .github/workflows/build.yaml | 2 ++ src/hooks/demoFeaturesEnabled.ts | 6 +----- src/layouts/NetworkLayout/NetworkLayout.tsx | 3 ++- src/pages/DashboardPage/Assets.tsx | 2 +- src/pages/DelegationsPage/DelegationsPage.tsx | 2 +- src/pages/GatewaysPage/GatewaysPage.tsx | 2 +- src/pages/WorkersPage/WorkersPage.tsx | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c5e1a5f..600d043 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -45,11 +45,13 @@ jobs: echo "::set-output name=wc_project_id::475eff0658d0f3300ca18971418d261b" echo "::set-output name=testnet_squid_api_url::https://subsquid.squids.live/subsquid-network-testnet/v/v1/graphql" echo "::set-output name=mainnet_squid_api_url::https://subsquid.squids.live/subsquid-network-mainnet/v/v1/graphql" + echo "::set-output name=enable_demo_features::false" else echo "::set-output name=app_env::dev" echo "::set-output name=wc_project_id::ec2facac9eaaca7cc0584baadc935c01" echo "::set-output name=testnet_squid_api_url::https://subsquid.squids.live/subsquid-network-testnet/v/v1/graphql" echo "::set-output name=mainnet_squid_api_url::https://subsquid.squids.live/subsquid-network-mainnet/v/v1/graphql" + echo "::set-output name=enable_demo_features::true" fi env: REF: ${{ github.ref }} diff --git a/src/hooks/demoFeaturesEnabled.ts b/src/hooks/demoFeaturesEnabled.ts index 3835ba7..f78cf75 100644 --- a/src/hooks/demoFeaturesEnabled.ts +++ b/src/hooks/demoFeaturesEnabled.ts @@ -1,7 +1,3 @@ -import process from 'process'; - export function demoFeaturesEnabled() { - return ( - process.env.ENABLE_DEMO_FEATURES === 'true' || localStorage.getItem('demo-features') === 'true' - ); + return process.env.ENABLE_DEMO_FEATURES === 'true'; } diff --git a/src/layouts/NetworkLayout/NetworkLayout.tsx b/src/layouts/NetworkLayout/NetworkLayout.tsx index ef12742..7bc1e47 100644 --- a/src/layouts/NetworkLayout/NetworkLayout.tsx +++ b/src/layouts/NetworkLayout/NetworkLayout.tsx @@ -16,6 +16,7 @@ import { Outlet } from 'react-router-dom'; import { Logo } from '@components/Logo'; import { NetworkSwitcher } from '@components/NetworkSwitcher'; import { TopBanner, useBannerHeight } from '@components/TopBanner'; +import { demoFeaturesEnabled } from '@hooks/demoFeaturesEnabled'; import { MenuIcon } from '@icons/MenuIcon'; import { UserMenu } from '@layouts/NetworkLayout/UserMenu.tsx'; import { useSwitchNetwork } from '@network/useSwitchNetwork'; @@ -290,7 +291,7 @@ export const NetworkLayout = ({ ) : null} - + {demoFeaturesEnabled() ? : null} {/*{narrowXs ? null : }*/} {narrowXs ? : null} diff --git a/src/pages/DashboardPage/Assets.tsx b/src/pages/DashboardPage/Assets.tsx index 0bd7962..b7ea6f6 100644 --- a/src/pages/DashboardPage/Assets.tsx +++ b/src/pages/DashboardPage/Assets.tsx @@ -73,7 +73,7 @@ export function MyAssets() { return ( - } /> + } /> {isLoading ? ( diff --git a/src/pages/DelegationsPage/DelegationsPage.tsx b/src/pages/DelegationsPage/DelegationsPage.tsx index 2fed615..b74ff98 100644 --- a/src/pages/DelegationsPage/DelegationsPage.tsx +++ b/src/pages/DelegationsPage/DelegationsPage.tsx @@ -24,7 +24,7 @@ export function MyDelegations() { return ( - + {isLoading ? ( ) : delegations.length ? ( diff --git a/src/pages/GatewaysPage/GatewaysPage.tsx b/src/pages/GatewaysPage/GatewaysPage.tsx index fd3d01c..5938b98 100644 --- a/src/pages/GatewaysPage/GatewaysPage.tsx +++ b/src/pages/GatewaysPage/GatewaysPage.tsx @@ -22,7 +22,7 @@ export function MyGateways() { return (