Skip to content

Commit

Permalink
feat: prep b1 english for release (freeCodeCamp#57543)
Browse files Browse the repository at this point in the history
  • Loading branch information
ojeytonwilliams authored Dec 16, 2024
1 parent 7c98f26 commit c9d2b47
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 10 deletions.
9 changes: 5 additions & 4 deletions client/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,12 @@ exports.createPages = async function createPages({
({ node }) => node
);

const inNextCurriculum = superBlock =>
superBlockStages[SuperBlockStage.Next].includes(superBlock);
const inCurrentCurriculum = superBlock =>
!superBlockStages[SuperBlockStage.Next].includes(superBlock) &&
!superBlockStages[SuperBlockStage.NextEnglish].includes(superBlock);

const currentChallengeNodes = allChallengeNodes.filter(
node => !inNextCurriculum(node.challenge.superBlock)
const currentChallengeNodes = allChallengeNodes.filter(node =>
inCurrentCurriculum(node.challenge.superBlock)
);

const createIdToNextPathMap = nodes =>
Expand Down
1 change: 1 addition & 0 deletions client/i18n/locales/english/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
"interview-prep-heading": "Prepare for the developer interview job search:",
"legacy-curriculum-heading": "Explore our Legacy Curriculum:",
"next-heading": "Try our beta curriculum:",
"next-english-heading": "Try our latest English curriculum:",
"upcoming-heading": "Upcoming curriculum:",
"faq": "Frequently asked questions:",
"faqs": [
Expand Down
1 change: 1 addition & 0 deletions client/src/components/Map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const superBlockHeadings: { [key in SuperBlockStage]: string } = {
[SuperBlockStage.Legacy]: 'landing.legacy-curriculum-heading',
[SuperBlockStage.New]: '', // TODO: add translation
[SuperBlockStage.Next]: 'landing.next-heading',
[SuperBlockStage.NextEnglish]: 'landing.next-english-heading',
[SuperBlockStage.Upcoming]: 'landing.upcoming-heading'
};

Expand Down
1 change: 1 addition & 0 deletions e2e/landing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const superBlocks = [
intro[SuperBlocks.CollegeAlgebraPy].title,
intro[SuperBlocks.FullStackDeveloper].title,
intro[SuperBlocks.A2English].title,
intro[SuperBlocks.B1English].title,
intro[SuperBlocks.FoundationalCSharp].title,
intro[SuperBlocks.TheOdinProject].title,
intro[SuperBlocks.CodingInterviewPrep].title,
Expand Down
1 change: 1 addition & 0 deletions e2e/map.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const superBlocksWithLinks = [
...superBlockStages[SuperBlockStage.Core],
...superBlockStages[SuperBlockStage.Next],
...superBlockStages[SuperBlockStage.English],
...superBlockStages[SuperBlockStage.NextEnglish],
...superBlockStages[SuperBlockStage.Professional],
...superBlockStages[SuperBlockStage.Extra],
...superBlockStages[SuperBlockStage.Legacy]
Expand Down
7 changes: 4 additions & 3 deletions shared/config/curriculum.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ describe('generateSuperBlockList', () => {
tempSuperBlockMap[SuperBlockStage.New] = [];
tempSuperBlockMap[SuperBlockStage.Upcoming] = [];
tempSuperBlockMap[SuperBlockStage.Next] = [];
tempSuperBlockMap[SuperBlockStage.NextEnglish] = [];
expect(result).toHaveLength(Object.values(tempSuperBlockMap).flat().length);
});
});
Expand All @@ -59,19 +60,19 @@ describe('Immutability of superBlockOrder, notAuditedSuperBlocks, and flatSuperB
it('should not allow modification of superBlockOrder', () => {
expect(() => {
superBlockStages[SuperBlockStage.Core] = [];
}).toThrowError(TypeError);
}).toThrow(TypeError);
});

it('should not allow modification of notAuditedSuperBlocks', () => {
expect(() => {
notAuditedSuperBlocks[Languages.English] = [];
}).toThrowError(TypeError);
}).toThrow(TypeError);
});

it('should not allow modification of flatSuperBlockMap', () => {
expect(() => {
notAuditedSuperBlocks[Languages.English] = [];
}).toThrowError(TypeError);
}).toThrow(TypeError);
});
});

Expand Down
12 changes: 9 additions & 3 deletions shared/config/curriculum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ export enum SuperBlockStage {
Legacy,
New,
Upcoming,
Next
Next,
NextEnglish
}

const defaultStageOrder = [
SuperBlockStage.Core,
SuperBlockStage.Next,
SuperBlockStage.English,
SuperBlockStage.NextEnglish,
SuperBlockStage.Professional,
SuperBlockStage.Extra,
SuperBlockStage.Legacy
Expand All @@ -65,9 +67,12 @@ export function getStageOrder({
showUpcomingChanges,
showNextCurriculum
}: Config): SuperBlockStage[] {
const isCurrentStage = (stage: SuperBlockStage) =>
!(stage === SuperBlockStage.Next) &&
!(stage === SuperBlockStage.NextEnglish);
const stageOrder = showNextCurriculum
? [...defaultStageOrder]
: [...defaultStageOrder.filter(stage => stage !== SuperBlockStage.Next)];
: [...defaultStageOrder.filter(isCurrentStage)];

if (showNewCurriculum) stageOrder.push(SuperBlockStage.New);
if (showUpcomingChanges) stageOrder.push(SuperBlockStage.Upcoming);
Expand Down Expand Up @@ -96,6 +101,7 @@ export const superBlockStages: StageMap = {
],
[SuperBlockStage.Next]: [SuperBlocks.FullStackDeveloper],
[SuperBlockStage.English]: [SuperBlocks.A2English],
[SuperBlockStage.NextEnglish]: [SuperBlocks.B1English],
[SuperBlockStage.Professional]: [SuperBlocks.FoundationalCSharp],
[SuperBlockStage.Extra]: [
SuperBlocks.TheOdinProject,
Expand All @@ -109,7 +115,7 @@ export const superBlockStages: StageMap = {
SuperBlocks.PythonForEverybody
],
[SuperBlockStage.New]: [],
[SuperBlockStage.Upcoming]: [SuperBlocks.B1English]
[SuperBlockStage.Upcoming]: []
};

Object.freeze(superBlockStages);
Expand Down

0 comments on commit c9d2b47

Please sign in to comment.