mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-23 21:04:36 -05:00
feat: simplify superblock layouts (#59260)
This commit is contained in:
committed by
GitHub
parent
f648dac32f
commit
a87df1adc8
@@ -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<BlockProps> {
|
||||
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<BlockProps> {
|
||||
!isEmptyBlock && (
|
||||
<>
|
||||
{layoutToComponent[blockLayout]}
|
||||
{(!isGridSuperBlock || isProjectBlock) &&
|
||||
superBlock !== SuperBlocks.FullStackDeveloper && (
|
||||
<Spacer size='m' />
|
||||
)}
|
||||
{superBlock !== SuperBlocks.FullStackDeveloper && (
|
||||
<Spacer size='xs' />
|
||||
)}
|
||||
</>
|
||||
)
|
||||
);
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user