mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-29 07:00:53 -04:00
refactor: simplify curriculum ordering (#55657)
This commit is contained in:
committed by
GitHub
parent
cb861ca971
commit
0eebe3ee2e
@@ -4,15 +4,19 @@ import { useTranslation } from 'react-i18next';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import {
|
||||
SuperBlockStages,
|
||||
SuperBlocks,
|
||||
superBlockOrder
|
||||
type SuperBlocks,
|
||||
SuperBlockStage,
|
||||
getStageOrder,
|
||||
superBlockStages
|
||||
} from '../../../../shared/config/curriculum';
|
||||
import { SuperBlockIcon } from '../../assets/icons/superblock-icon';
|
||||
import LinkButton from '../../assets/icons/link-button';
|
||||
import { Spacer, ButtonLink } from '../helpers';
|
||||
import { getSuperBlockTitleForMap } from '../../utils/superblock-map-titles';
|
||||
import { showUpcomingChanges } from '../../../config/env.json';
|
||||
import {
|
||||
showUpcomingChanges,
|
||||
showNewCurriculum
|
||||
} from '../../../config/env.json';
|
||||
|
||||
import './map.css';
|
||||
|
||||
@@ -49,11 +53,15 @@ const linkSpacingStyle = {
|
||||
gap: '15px'
|
||||
};
|
||||
|
||||
const coreCurriculum = [
|
||||
...superBlockOrder[SuperBlockStages.FrontEnd],
|
||||
...superBlockOrder[SuperBlockStages.Backend],
|
||||
...superBlockOrder[SuperBlockStages.Python]
|
||||
];
|
||||
const superBlockHeadings: { [key in SuperBlockStage]: string } = {
|
||||
[SuperBlockStage.Core]: 'landing.core-certs-heading',
|
||||
[SuperBlockStage.English]: 'landing.learn-english-heading',
|
||||
[SuperBlockStage.Professional]: 'landing.professional-certs-heading',
|
||||
[SuperBlockStage.Extra]: 'landing.interview-prep-heading',
|
||||
[SuperBlockStage.Legacy]: 'landing.legacy-curriculum-heading',
|
||||
[SuperBlockStage.New]: '', // TODO: add translation
|
||||
[SuperBlockStage.Upcoming]: 'landing.upcoming-heading'
|
||||
};
|
||||
|
||||
const mapStateToProps = createSelector(
|
||||
isSignedInSelector,
|
||||
@@ -173,107 +181,28 @@ function Map({
|
||||
|
||||
return (
|
||||
<div className='map-ui' data-test-label='curriculum-map'>
|
||||
<h2 className={forLanding ? 'big-heading' : ''}>
|
||||
{t('landing.core-certs-heading')}
|
||||
</h2>
|
||||
<ul>
|
||||
{coreCurriculum.map((superBlock, i) => (
|
||||
<MapLi
|
||||
key={i}
|
||||
superBlock={superBlock}
|
||||
landing={forLanding}
|
||||
index={i}
|
||||
claimed={isClaimed(superBlock)}
|
||||
showProgressionLines={true}
|
||||
showNumbers={true}
|
||||
completed={allSuperblockChallengesCompleted(superBlock)}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
<Spacer size='medium' />
|
||||
<h2 className={forLanding ? 'big-heading' : ''}>
|
||||
{t('landing.learn-english-heading')}
|
||||
</h2>
|
||||
<ul>
|
||||
{superBlockOrder[SuperBlockStages.English].map((superBlock, i) => (
|
||||
<MapLi
|
||||
key={i}
|
||||
superBlock={superBlock}
|
||||
landing={forLanding}
|
||||
completed={allSuperblockChallengesCompleted(superBlock)}
|
||||
claimed={isClaimed(superBlock)}
|
||||
index={i}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
<Spacer size='medium' />
|
||||
<h2 className={forLanding ? 'big-heading' : ''}>
|
||||
{t('landing.professional-certs-heading')}
|
||||
</h2>
|
||||
<ul>
|
||||
{superBlockOrder[SuperBlockStages.Professional].map((superBlock, i) => (
|
||||
<MapLi
|
||||
key={i}
|
||||
superBlock={superBlock}
|
||||
landing={forLanding}
|
||||
completed={allSuperblockChallengesCompleted(superBlock)}
|
||||
claimed={isClaimed(superBlock)}
|
||||
index={i}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
<Spacer size='medium' />
|
||||
<h2 className={forLanding ? 'big-heading' : ''}>
|
||||
{t('landing.interview-prep-heading')}
|
||||
</h2>
|
||||
<ul>
|
||||
{superBlockOrder[SuperBlockStages.Extra].map((superBlock, i) => (
|
||||
<MapLi
|
||||
key={i}
|
||||
superBlock={superBlock}
|
||||
landing={forLanding}
|
||||
completed={allSuperblockChallengesCompleted(superBlock)}
|
||||
claimed={isClaimed(superBlock)}
|
||||
index={i}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
<Spacer size='medium' />
|
||||
<h2 className={forLanding ? 'big-heading' : ''}>
|
||||
{t('landing.legacy-curriculum-heading')}
|
||||
</h2>
|
||||
<ul>
|
||||
{superBlockOrder[SuperBlockStages.Legacy].map((superBlock, i) => (
|
||||
<MapLi
|
||||
key={i}
|
||||
superBlock={superBlock}
|
||||
landing={forLanding}
|
||||
completed={allSuperblockChallengesCompleted(superBlock)}
|
||||
claimed={isClaimed(superBlock)}
|
||||
index={i}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
{showUpcomingChanges && (
|
||||
{getStageOrder({ showNewCurriculum, showUpcomingChanges }).map(stage => (
|
||||
<>
|
||||
<Spacer size='medium' />
|
||||
<h2 className={forLanding ? 'big-heading' : ''}>
|
||||
{t('landing.upcoming-heading')}
|
||||
{t(superBlockHeadings[stage])}
|
||||
</h2>
|
||||
<ul>
|
||||
{superBlockOrder[SuperBlockStages.Upcoming].map((superBlock, i) => (
|
||||
<ul key={stage}>
|
||||
{superBlockStages[stage].map((superblock, i) => (
|
||||
<MapLi
|
||||
key={i}
|
||||
superBlock={superBlock}
|
||||
key={superblock}
|
||||
superBlock={superblock}
|
||||
landing={forLanding}
|
||||
completed={allSuperblockChallengesCompleted(superBlock)}
|
||||
index={i}
|
||||
claimed={isClaimed(superBlock)}
|
||||
claimed={isClaimed(superblock)}
|
||||
showProgressionLines={stage === SuperBlockStage.Core}
|
||||
showNumbers={stage === SuperBlockStage.Core}
|
||||
completed={allSuperblockChallengesCompleted(superblock)}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
<Spacer size='medium' />
|
||||
</>
|
||||
)}
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user