From 6b2ef763fa84776952bc5675da5f677bacacd7e8 Mon Sep 17 00:00:00 2001 From: Gleiser Oliveira Date: Thu, 9 Nov 2023 18:02:26 -0600 Subject: [PATCH] feat: add feature flag for the swap route --- src/containers/Layout/useGetMenuItems.tsx | 10 +++++++--- src/hooks/useIsFeatureEnabled/__tests__/index.spec.ts | 1 + src/hooks/useIsFeatureEnabled/index.tsx | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/containers/Layout/useGetMenuItems.tsx b/src/containers/Layout/useGetMenuItems.tsx index f8555ce3c2..ae9d2aa7ed 100644 --- a/src/containers/Layout/useGetMenuItems.tsx +++ b/src/containers/Layout/useGetMenuItems.tsx @@ -9,6 +9,7 @@ import { MenuItem } from './types'; const useGetMenuItems = () => { const { accountAddress } = useAuth(); const corePoolRouteEnabled = useIsFeatureEnabled({ name: 'corePoolRoute' }); + const swapRouteEnabled = useIsFeatureEnabled({ name: 'swapRoute' }); const historyRouteEnabled = useIsFeatureEnabled({ name: 'historyRoute' }); const convertVrtRouteEnabled = useIsFeatureEnabled({ name: 'convertVrtRoute' }); const vaiRouteEnabled = useIsFeatureEnabled({ name: 'vaiRoute' }); @@ -60,14 +61,17 @@ const useGetMenuItems = () => { i18nKey: 'layout.menuItems.vaults', iconName: 'vault', }, - { + ); + + if (swapRouteEnabled) { + menuItems.push({ to: routes.swap.path, // Translation key: do not remove this comment // t('layout.menuItems.swap') i18nKey: 'layout.menuItems.swap', iconName: 'convert', - }, - ); + }); + } if (historyRouteEnabled) { menuItems.push({ diff --git a/src/hooks/useIsFeatureEnabled/__tests__/index.spec.ts b/src/hooks/useIsFeatureEnabled/__tests__/index.spec.ts index cdb822f98a..1b0319f6fd 100644 --- a/src/hooks/useIsFeatureEnabled/__tests__/index.spec.ts +++ b/src/hooks/useIsFeatureEnabled/__tests__/index.spec.ts @@ -15,6 +15,7 @@ describe('useIsFeatureEnabled', () => { 'corePoolMarketRoute', 'historyRoute', 'convertVrtRoute', + 'swapRoute', 'vaiRoute', ]; diff --git a/src/hooks/useIsFeatureEnabled/index.tsx b/src/hooks/useIsFeatureEnabled/index.tsx index 1ae89c638c..037f8f31bc 100644 --- a/src/hooks/useIsFeatureEnabled/index.tsx +++ b/src/hooks/useIsFeatureEnabled/index.tsx @@ -14,6 +14,7 @@ const featureFlags = { convertVrtRoute: [ChainId.BSC_MAINNET, ChainId.BSC_TESTNET], historyRoute: [ChainId.BSC_MAINNET, ChainId.BSC_TESTNET], vaiRoute: [ChainId.BSC_MAINNET, ChainId.BSC_TESTNET], + swapRoute: [ChainId.BSC_MAINNET, ChainId.BSC_TESTNET], createProposal: [ChainId.BSC_MAINNET, ChainId.BSC_TESTNET], };