From 3d9434d040feb46aa4f768f5303977b842f72847 Mon Sep 17 00:00:00 2001 From: Moritz Kirstein Date: Mon, 25 Nov 2024 17:23:07 +0100 Subject: [PATCH] feat: add onvoarding env config --- app.config.js | 4 +++- src/@context/MarketMetadata/_types.ts | 1 + src/@context/UserPreferences.tsx | 6 ++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app.config.js b/app.config.js index 24253ca1..5fca60f5 100644 --- a/app.config.js +++ b/app.config.js @@ -110,5 +110,7 @@ module.exports = { faucet: { enabled: process.env.NEXT_PUBLIC_FAUCET_ENABLED || 'false', baseUri: 'https://faucet.api.pontus-x.eu' - } + }, + + showOnboardingModuleByDefault: process.env.NEXT_PUBLIC_SHOW_ONBOARDING_MODULE_BY_DEFAULT === 'true', } diff --git a/src/@context/MarketMetadata/_types.ts b/src/@context/MarketMetadata/_types.ts index 2cf441c4..1b45735d 100644 --- a/src/@context/MarketMetadata/_types.ts +++ b/src/@context/MarketMetadata/_types.ts @@ -50,6 +50,7 @@ export interface AppConfig { enabled: string baseUri: string } + showOnboardingModuleByDefault: boolean } export interface SiteContent { siteTitle: string diff --git a/src/@context/UserPreferences.tsx b/src/@context/UserPreferences.tsx index d5d87ace..734752fa 100644 --- a/src/@context/UserPreferences.tsx +++ b/src/@context/UserPreferences.tsx @@ -72,7 +72,7 @@ function UserPreferencesProvider({ const [chainIds, setChainIds] = useState( localStorage?.chainIds || appConfig.chainIds ) - const { defaultPrivacyPolicySlug } = appConfig + const { defaultPrivacyPolicySlug, showOnboardingModuleByDefault } = appConfig const [privacyPolicySlug, setPrivacyPolicySlug] = useState( localStorage?.privacyPolicySlug || defaultPrivacyPolicySlug @@ -96,9 +96,7 @@ function UserPreferencesProvider({ ) const [showOnboardingModule, setShowOnboardingModule] = useState( - localStorage?.showOnboardingModule === undefined - ? false - : localStorage?.showOnboardingModule + localStorage?.showOnboardingModule ?? showOnboardingModuleByDefault ) const [onboardingStep, setOnboardingStep] = useState(