Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add low-funds feature flag to conditionally render LowFunds alert #581

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CardSection } from '@/components/styled/CardSection';
import { useFeatureFlag } from '@/hooks/useFeatureFlag';

import { AddBackupWalletAlert } from './AddBackupWalletAlert';
import { AvoidSuspensionAlert } from './AvoidSuspensionAlert';
Expand All @@ -8,13 +9,15 @@ import { NoAvailableSlotsOnTheContract } from './NoAvailableSlotsOnTheContract';
import { UpdateAvailableAlert } from './UpdateAvailableAlert';

export const AlertSections = () => {
const isLowFundsEnabled = useFeatureFlag('low-funds');

return (
<CardSection vertical>
<UpdateAvailableAlert />
<AddBackupWalletAlert />
<NewStakingProgramAlert />
<AvoidSuspensionAlert />
<LowFunds />
{isLowFundsEnabled && <LowFunds />}
<NoAvailableSlotsOnTheContract />
</CardSection>
);
Expand Down
3 changes: 3 additions & 0 deletions frontend/hooks/useFeatureFlag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const FeatureFlagsSchema = z.enum([
'manage-wallet',
'rewards-streak',
'staking-contract-section',
'low-funds',
]);
type FeatureFlags = z.infer<typeof FeatureFlagsSchema>;

Expand All @@ -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,
},
});

Expand Down
Loading