From e7ecf6a7fa661682cc4177b677d33b823658137c Mon Sep 17 00:00:00 2001 From: mohandast52 Date: Fri, 13 Dec 2024 20:17:52 +0530 Subject: [PATCH] feat: add low-funds feature flag to conditionally render LowFunds alert --- .../components/MainPage/sections/AlertSections/index.tsx | 5 ++++- frontend/hooks/useFeatureFlag.ts | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/components/MainPage/sections/AlertSections/index.tsx b/frontend/components/MainPage/sections/AlertSections/index.tsx index d9ed1af87..4799f03b9 100644 --- a/frontend/components/MainPage/sections/AlertSections/index.tsx +++ b/frontend/components/MainPage/sections/AlertSections/index.tsx @@ -1,4 +1,5 @@ import { CardSection } from '@/components/styled/CardSection'; +import { useFeatureFlag } from '@/hooks/useFeatureFlag'; import { AddBackupWalletAlert } from './AddBackupWalletAlert'; import { AvoidSuspensionAlert } from './AvoidSuspensionAlert'; @@ -8,13 +9,15 @@ import { NoAvailableSlotsOnTheContract } from './NoAvailableSlotsOnTheContract'; import { UpdateAvailableAlert } from './UpdateAvailableAlert'; export const AlertSections = () => { + const isLowFundsEnabled = useFeatureFlag('low-funds'); + return ( - + {isLowFundsEnabled && } ); diff --git a/frontend/hooks/useFeatureFlag.ts b/frontend/hooks/useFeatureFlag.ts index c2d09dcf9..bfd9ec18d 100644 --- a/frontend/hooks/useFeatureFlag.ts +++ b/frontend/hooks/useFeatureFlag.ts @@ -10,6 +10,7 @@ const FeatureFlagsSchema = z.enum([ 'manage-wallet', 'rewards-streak', 'staking-contract-section', + 'low-funds', ]); type FeatureFlags = z.infer; @@ -29,12 +30,14 @@ const FEATURES_CONFIG = FeaturesConfigSchema.parse({ 'last-transactions': true, 'rewards-streak': true, 'staking-contract-section': true, + 'low-funds': true, }, [AgentType.Memeooorr]: { 'manage-wallet': false, 'last-transactions': false, 'rewards-streak': false, 'staking-contract-section': false, + 'low-funds': false, }, });