From a87df1adc84cf83116d272d297ff164433cff0f1 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Thu, 13 Mar 2025 07:46:39 +0100 Subject: [PATCH] feat: simplify superblock layouts (#59260) --- .../Introduction/components/block.tsx | 13 ++++------- client/src/utils/curriculum-layout.ts | 22 ------------------- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/client/src/templates/Introduction/components/block.tsx b/client/src/templates/Introduction/components/block.tsx index dfccb38c518..41f0f621203 100644 --- a/client/src/templates/Introduction/components/block.tsx +++ b/client/src/templates/Introduction/components/block.tsx @@ -16,7 +16,7 @@ import { Link } from '../../../components/helpers'; import { completedChallengesSelector } from '../../../redux/selectors'; import { playTone } from '../../../utils/tone'; import { makeExpandedBlockSelector, toggleBlock } from '../redux'; -import { isGridBased, isProjectBased } from '../../../utils/curriculum-layout'; +import { isProjectBased } from '../../../utils/curriculum-layout'; import { BlockLayouts, BlockTypes } from '../../../../../shared/config/blocks'; import CheckMark from './check-mark'; import Challenges from './challenges'; @@ -115,10 +115,6 @@ class Block extends Component { return isProjectBased(challenge.challengeType, block); }); - const isGridSuperBlock = challenges.some(challenge => { - return isGridBased(superBlock, challenge.challengeType); - }); - const isAudited = isAuditedSuperBlock(curriculumLocale, superBlock); const blockTitle = t(`intro:${superBlock}.blocks.${block}.title`); @@ -410,10 +406,9 @@ class Block extends Component { !isEmptyBlock && ( <> {layoutToComponent[blockLayout]} - {(!isGridSuperBlock || isProjectBlock) && - superBlock !== SuperBlocks.FullStackDeveloper && ( - - )} + {superBlock !== SuperBlocks.FullStackDeveloper && ( + + )} ) ); diff --git a/client/src/utils/curriculum-layout.ts b/client/src/utils/curriculum-layout.ts index 0459aed67ee..441325f0f74 100644 --- a/client/src/utils/curriculum-layout.ts +++ b/client/src/utils/curriculum-layout.ts @@ -1,26 +1,4 @@ import { challengeTypes } from '../../../shared/config/challenge-types'; -import { SuperBlocks } from '../../../shared/config/curriculum'; - -// Show a grid layout on the superblock level - -const gridBasedSuperBlocks = [ - SuperBlocks.RespWebDesignNew, - SuperBlocks.JsAlgoDataStructNew, - SuperBlocks.SciCompPy, - SuperBlocks.A2English -]; - -export const isGridBased = ( - superBlock: SuperBlocks, - challengeType: unknown = null -) => { - // Python projects should not be displayed as a grid, but should be displayed - // as a list of projects. Otherwise, if we do not do this the project will be - // shown as a single certification project. - - if (challengeType === challengeTypes.pythonProject) return false; - return gridBasedSuperBlocks.includes(superBlock); -}; // Show a single project in a certification layout