From be4e32c95eaaf5aed976dcd15b6c15164c774a56 Mon Sep 17 00:00:00 2001 From: 0xdef1cafe <88504456+0xdef1cafe@users.noreply.github.com> Date: Tue, 3 Oct 2023 10:35:58 +1100 Subject: [PATCH] feat: ure flag --- .env.base | 1 + .env.dev | 3 ++- src/config.ts | 1 + src/pages/Trade/Trade.tsx | 4 +++- src/state/slices/preferencesSlice/preferencesSlice.ts | 2 ++ src/test/mocks/store.ts | 1 + 6 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.env.base b/.env.base index a900fe1c716..b02e21f17ce 100644 --- a/.env.base +++ b/.env.base @@ -24,6 +24,7 @@ REACT_APP_FEATURE_CHATWOOT=false REACT_APP_FEATURE_COINBASE_WALLET=true REACT_APP_FEATURE_ADVANCED_SLIPPAGE=true REACT_APP_FEATURE_WALLET_CONNECT_V2=false +REACT_APP_FEATURE_FOX_DISCOUNTS=false # absolute URL prefix REACT_APP_ABSOLUTE_URL_PREFIX=https://app.shapeshift.com diff --git a/.env.dev b/.env.dev index e379379fb27..6390ddd9516 100644 --- a/.env.dev +++ b/.env.dev @@ -1,6 +1,7 @@ # feature flags REACT_APP_FEATURE_NFT_METADATA=true REACT_APP_FEATURE_WALLET_CONNECT_V2=true +REACT_APP_FEATURE_FOX_DISCOUNTS=true # logging REACT_APP_REDUX_WINDOW=false @@ -46,4 +47,4 @@ REACT_APP_COSMOS_NODE_URL=https://dev-daemon.cosmos.shapeshift.com REACT_APP_THORCHAIN_NODE_URL=https://dev-daemon.thorchain.shapeshift.com # thorchain -REACT_APP_MIDGARD_URL=https://dev-indexer.thorchain.shapeshift.com/v2 \ No newline at end of file +REACT_APP_MIDGARD_URL=https://dev-indexer.thorchain.shapeshift.com/v2 diff --git a/src/config.ts b/src/config.ts index bfa806d4c65..6b3527f32e3 100644 --- a/src/config.ts +++ b/src/config.ts @@ -146,6 +146,7 @@ const validators = { REACT_APP_EXPERIMENTAL_CUSTOM_SEND_NONCE: bool({ default: false }), REACT_APP_EXPERIMENTAL_MM_SNAPPY_FINGERS: bool({ default: false }), REACT_APP_SNAP_ID: str(), + REACT_APP_FEATURE_FOX_DISCOUNTS: bool({ default: false }), } function reporter({ errors }: envalid.ReporterOptions) { diff --git a/src/pages/Trade/Trade.tsx b/src/pages/Trade/Trade.tsx index e5e5da8f80d..a872b1fff10 100644 --- a/src/pages/Trade/Trade.tsx +++ b/src/pages/Trade/Trade.tsx @@ -3,19 +3,21 @@ import { memo } from 'react' import { FeeExplainer } from 'components/FeeExplainer/FeeExplainer' import { Main } from 'components/Layout/Main' import { MultiHopTrade } from 'components/MultiHopTrade/MultiHopTrade' +import { useFeatureFlag } from 'hooks/useFeatureFlag/useFeatureFlag' import { RecentTransactions } from 'pages/Dashboard/RecentTransactions' const maxWidth = { base: '100%', lg: 'container.sm' } const padding = { base: 0, md: 8 } export const Trade = memo(() => { + const foxDiscountsEnabled = useFeatureFlag('FoxDiscounts') return (
- + {foxDiscountsEnabled && } diff --git a/src/state/slices/preferencesSlice/preferencesSlice.ts b/src/state/slices/preferencesSlice/preferencesSlice.ts index 8207af5f713..8873daf31a8 100644 --- a/src/state/slices/preferencesSlice/preferencesSlice.ts +++ b/src/state/slices/preferencesSlice/preferencesSlice.ts @@ -44,6 +44,7 @@ export type FeatureFlags = { WalletConnectV2: boolean CustomSendNonce: boolean Snaps: boolean + FoxDiscounts: boolean } export type Flag = keyof FeatureFlags @@ -105,6 +106,7 @@ const initialState: Preferences = { WalletConnectV2: getConfig().REACT_APP_FEATURE_WALLET_CONNECT_V2, CustomSendNonce: getConfig().REACT_APP_EXPERIMENTAL_CUSTOM_SEND_NONCE, Snaps: getConfig().REACT_APP_EXPERIMENTAL_MM_SNAPPY_FINGERS, + FoxDiscounts: getConfig().REACT_APP_FEATURE_FOX_DISCOUNTS, }, selectedLocale: simpleLocale(), balanceThreshold: '0', diff --git a/src/test/mocks/store.ts b/src/test/mocks/store.ts index 70e6a8001ba..490e27e6e2d 100644 --- a/src/test/mocks/store.ts +++ b/src/test/mocks/store.ts @@ -92,6 +92,7 @@ export const mockStore: ReduxState = { WalletConnectV2: false, CustomSendNonce: false, Snaps: false, + FoxDiscounts: false, }, selectedLocale: 'en', balanceThreshold: '0',