From 3c240e89c286b5fe12891ead38c2731484e2e15f Mon Sep 17 00:00:00 2001 From: Shaun Hamilton Date: Thu, 30 Oct 2025 19:52:15 +0200 Subject: [PATCH] feat(client): add disabled blocks growthbook feature (#63322) --- .../config/growthbook-features-default.json | 3 ++ .../Introduction/super-block-intro.tsx | 40 ++++++++++++------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/client/config/growthbook-features-default.json b/client/config/growthbook-features-default.json index c9c12b31eb6..0d9583cea8e 100644 --- a/client/config/growthbook-features-default.json +++ b/client/config/growthbook-features-default.json @@ -141,5 +141,8 @@ "name": "prod-landing-two-button-cta" } ] + }, + "disabled_blocks": { + "defaultValue": [] } } diff --git a/client/src/templates/Introduction/super-block-intro.tsx b/client/src/templates/Introduction/super-block-intro.tsx index 8fe2c8d0e7f..1f8b254e7ef 100644 --- a/client/src/templates/Introduction/super-block-intro.tsx +++ b/client/src/templates/Introduction/super-block-intro.tsx @@ -10,6 +10,7 @@ import { scroller } from 'react-scroll'; import { bindActionCreators, Dispatch } from 'redux'; import { createSelector } from 'reselect'; import { Container, Col, Row, Spacer } from '@freecodecamp/ui'; +import { useFeatureValue } from '@growthbook/growthbook-react'; import { chapterBasedSuperBlocks, @@ -151,6 +152,11 @@ const SuperBlockIntroductionPage = (props: SuperBlockProps) => { // eslint-disable-next-line react-hooks/exhaustive-deps }, []); + const disabledBlocksFeature = useFeatureValue( + 'disabled_blocks', + [] + ); + const { data: { allChallengeNode: { nodes }, @@ -288,22 +294,26 @@ const SuperBlockIntroductionPage = (props: SuperBlockProps) => { /> ) : (
- {blocks.map(block => { - const blockChallenges = superBlockChallenges.filter( - c => c.block === block - ); - const blockLabel = blockChallenges[0].blockLabel; + {blocks + .filter(block => { + return !disabledBlocksFeature.includes(block); + }) + .map(block => { + const blockChallenges = superBlockChallenges.filter( + c => c.block === block + ); + const blockLabel = blockChallenges[0].blockLabel; - return ( - - ); - })} + return ( + + ); + })} {showCertification && !!user && (