diff --git a/client/gatsby-node.js b/client/gatsby-node.js index a484bfdc84b..b68ccccd970 100644 --- a/client/gatsby-node.js +++ b/client/gatsby-node.js @@ -5,10 +5,6 @@ const uniq = require('lodash/uniq'); const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); const webpack = require('webpack'); -const { - superBlockStages, - SuperBlockStage -} = require('../shared/config/curriculum'); const env = require('./config/env.json'); const { createChallengePages, @@ -143,14 +139,6 @@ exports.createPages = async function createPages({ ({ node }) => node ); - const inCurrentCurriculum = superBlock => - !superBlockStages[SuperBlockStage.Next].includes(superBlock) && - !superBlockStages[SuperBlockStage.NextEnglish].includes(superBlock); - - const currentChallengeNodes = allChallengeNodes.filter(node => - inCurrentCurriculum(node.challenge.superBlock) - ); - const createIdToNextPathMap = nodes => nodes.reduce((map, node, index) => { const nextNode = nodes[index + 1]; @@ -167,25 +155,17 @@ exports.createPages = async function createPages({ return map; }, {}); - const idToNextPathCurrentCurriculum = createIdToNextPathMap( - currentChallengeNodes - ); + const idToNextPathCurrentCurriculum = + createIdToNextPathMap(allChallengeNodes); - const idToPrevPathCurrentCurriculum = createIdToPrevPathMap( - currentChallengeNodes - ); - - const idToNextPathNextCurriculum = createIdToNextPathMap(allChallengeNodes); - - const idToPrevPathNextCurriculum = createIdToPrevPathMap(allChallengeNodes); + const idToPrevPathCurrentCurriculum = + createIdToPrevPathMap(allChallengeNodes); // Create challenge pages. result.data.allChallengeNode.edges.forEach( createChallengePages(createPage, { idToNextPathCurrentCurriculum, - idToPrevPathCurrentCurriculum, - idToNextPathNextCurriculum, - idToPrevPathNextCurriculum + idToPrevPathCurrentCurriculum }) ); diff --git a/client/src/components/Map/index.tsx b/client/src/components/Map/index.tsx index 8a057106858..ef43db38524 100644 --- a/client/src/components/Map/index.tsx +++ b/client/src/components/Map/index.tsx @@ -3,7 +3,6 @@ import { useTranslation } from 'react-i18next'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import { Spacer } from '@freecodecamp/ui'; -import { useFeature } from '@growthbook/growthbook-react'; import { type SuperBlocks, @@ -139,7 +138,6 @@ function Map({ allChallenges }: MapProps): React.ReactElement { const { t } = useTranslation(); - const showNextCurriculum = useFeature('fcc-10').on; const allSuperblockChallengesCompleted = (superblock: SuperBlocks) => { // array of all challenge ID's in the superblock @@ -168,8 +166,7 @@ function Map({
{getStageOrder({ showNewCurriculum, - showUpcomingChanges, - showNextCurriculum + showUpcomingChanges }).map(stage => (

diff --git a/client/src/templates/Challenges/classic/show.tsx b/client/src/templates/Challenges/classic/show.tsx index 9d478a58dc2..e8729155a28 100644 --- a/client/src/templates/Challenges/classic/show.tsx +++ b/client/src/templates/Challenges/classic/show.tsx @@ -21,7 +21,6 @@ import { ChallengeMeta, ChallengeNode, CompletedChallenge, - NavigationPaths, ResizeProps, SavedChallengeFiles, Test @@ -113,7 +112,6 @@ interface ShowClassicProps extends Pick { output: string[]; pageContext: { challengeMeta: ChallengeMeta; - nextCurriculumPaths: NavigationPaths; projectPreview: { challengeData: CompletedChallenge; }; @@ -208,7 +206,6 @@ function ShowClassic({ pageContext: { challengeMeta, challengeMeta: { isFirstStep, nextChallengePath }, - nextCurriculumPaths, projectPreview: { challengeData } }, createFiles, @@ -236,7 +233,6 @@ function ShowClassic({ const isMobile = useMediaQuery({ query: `(max-width: ${MAX_MOBILE_WIDTH}px)` }); - const showNextCurriculum = useFeature('fcc-10').on; const guideUrl = getGuideUrl({ forumTopicId, title }); @@ -378,9 +374,7 @@ function ShowClassic({ // freeform, so the preview is shown on demand. if (demoType === 'onLoad') openModal('projectPreview'); const challengePaths = getChallengePaths({ - showNextCurriculum, - currentCurriculumPaths: challengeMeta, - nextCurriculumPaths + currentCurriculumPaths: challengeMeta }); updateChallengeMeta({ diff --git a/client/src/templates/Challenges/codeally/show.tsx b/client/src/templates/Challenges/codeally/show.tsx index 41f6fd573ab..04a3549e4f4 100644 --- a/client/src/templates/Challenges/codeally/show.tsx +++ b/client/src/templates/Challenges/codeally/show.tsx @@ -9,7 +9,6 @@ import { bindActionCreators } from 'redux'; import type { Dispatch } from 'redux'; import { createSelector } from 'reselect'; import { Container, Col, Row, Alert, Spacer } from '@freecodecamp/ui'; -import { useFeature } from '@growthbook/growthbook-react'; // Local Utilities import LearnLayout from '../../../components/layouts/learn'; @@ -40,7 +39,6 @@ import { ChallengeNode, ChallengeMeta, CompletedChallenge, - NavigationPaths, Test } from '../../../redux/prop-types'; import ProjectToolPanel from '../projects/tool-panel'; @@ -102,7 +100,6 @@ interface ShowCodeAllyProps { openCompletionModal: () => void; pageContext: { challengeMeta: ChallengeMeta; - nextCurriculumPaths: NavigationPaths; }; partiallyCompletedChallenges: CompletedChallenge[]; t: TFunction; @@ -115,8 +112,6 @@ interface ShowCodeAllyProps { function ShowCodeAlly(props: ShowCodeAllyProps) { const container = useRef(null); - const showNextCurriculum = useFeature('fcc-10').on; - const { completedChallenges, data: { @@ -136,7 +131,6 @@ function ShowCodeAlly(props: ShowCodeAllyProps) { }, isChallengeCompleted, isSignedIn, - pageContext: { nextCurriculumPaths }, partiallyCompletedChallenges, t, updateSolutionFormValues @@ -174,9 +168,7 @@ function ShowCodeAlly(props: ShowCodeAllyProps) { } = props; initTests(tests); const challengePaths = getChallengePaths({ - showNextCurriculum, - currentCurriculumPaths: challengeMeta, - nextCurriculumPaths + currentCurriculumPaths: challengeMeta }); updateChallengeMeta({ ...challengeMeta, diff --git a/client/src/templates/Challenges/exam/show.tsx b/client/src/templates/Challenges/exam/show.tsx index 63743f9cdee..7c58fad2597 100644 --- a/client/src/templates/Challenges/exam/show.tsx +++ b/client/src/templates/Challenges/exam/show.tsx @@ -11,7 +11,6 @@ import type { Dispatch } from 'redux'; import { createSelector } from 'reselect'; import { Container, Col, Alert, Row, Button, Spacer } from '@freecodecamp/ui'; import { micromark } from 'micromark'; -import { useFeature } from '@growthbook/growthbook-react'; // Local Utilities import LearnLayout from '../../../components/layouts/learn'; @@ -47,7 +46,6 @@ import { CompletedChallenge, UserExamQuestion, UserExam, - NavigationPaths, GeneratedExamResults, GeneratedExamQuestion, PrerequisiteChallenge, @@ -130,7 +128,6 @@ interface ShowExamProps { closeFinishExamModal: () => void; pageContext: { challengeMeta: ChallengeMeta; - nextCurriculumPaths: NavigationPaths; }; t: TFunction; startExam: () => void; @@ -168,13 +165,11 @@ function ShowExam(props: ShowExamProps) { isChallengeCompleted, openExitExamModal, openFinishExamModal, - pageContext: { nextCurriculumPaths }, t } = props; let timerInterval: NodeJS.Timeout; - const showNextCurriculum = useFeature('fcc-10').on; const container = useRef(null); const [examTimeInSeconds, setExamTimeInSeconds] = useState(0); @@ -205,9 +200,7 @@ function ShowExam(props: ShowExamProps) { } = props; initTests(tests); const challengePaths = getChallengePaths({ - showNextCurriculum, - currentCurriculumPaths: challengeMeta, - nextCurriculumPaths + currentCurriculumPaths: challengeMeta }); updateChallengeMeta({ ...challengeMeta, diff --git a/client/src/templates/Challenges/fill-in-the-blank/show.tsx b/client/src/templates/Challenges/fill-in-the-blank/show.tsx index d8c00667fa2..df9291a16a2 100644 --- a/client/src/templates/Challenges/fill-in-the-blank/show.tsx +++ b/client/src/templates/Challenges/fill-in-the-blank/show.tsx @@ -1,7 +1,6 @@ // Package Utilities import { graphql } from 'gatsby'; import React, { useEffect, useRef, useState } from 'react'; -import { useFeature } from '@growthbook/growthbook-react'; import Helmet from 'react-helmet'; import { ObserveKeys } from 'react-hotkeys'; import type { TFunction } from 'i18next'; @@ -15,12 +14,7 @@ import ShortcutsModal from '../components/shortcuts-modal'; // Local Utilities import LearnLayout from '../../../components/layouts/learn'; -import { - ChallengeNode, - ChallengeMeta, - NavigationPaths, - Test -} from '../../../redux/prop-types'; +import { ChallengeNode, ChallengeMeta, Test } from '../../../redux/prop-types'; import Hotkeys from '../components/hotkeys'; import ChallengeTitle from '../components/challenge-title'; import ChallegeExplanation from '../components/challenge-explanation'; @@ -72,7 +66,6 @@ interface ShowFillInTheBlankProps { openHelpModal: () => void; pageContext: { challengeMeta: ChallengeMeta; - nextCurriculumPaths: NavigationPaths; }; t: TFunction; updateChallengeMeta: (arg0: ChallengeMeta) => void; @@ -102,7 +95,7 @@ const ShowFillInTheBlank = ({ openHelpModal, updateChallengeMeta, openCompletionModal, - pageContext: { challengeMeta, nextCurriculumPaths }, + pageContext: { challengeMeta }, isChallengeCompleted }: ShowFillInTheBlankProps) => { const { t } = useTranslation(); @@ -117,14 +110,11 @@ const ShowFillInTheBlank = ({ const [showFeedback, setShowFeedback] = useState(false); const container = useRef(null); - const showNextCurriculum = useFeature('fcc-10').on; useEffect(() => { initTests(tests); const challengePaths = getChallengePaths({ - showNextCurriculum, - currentCurriculumPaths: challengeMeta, - nextCurriculumPaths + currentCurriculumPaths: challengeMeta }); updateChallengeMeta({ ...challengeMeta, diff --git a/client/src/templates/Challenges/generic/show.tsx b/client/src/templates/Challenges/generic/show.tsx index 0ab656de4ed..3640eff1151 100644 --- a/client/src/templates/Challenges/generic/show.tsx +++ b/client/src/templates/Challenges/generic/show.tsx @@ -1,6 +1,5 @@ import { graphql } from 'gatsby'; import React, { useEffect, useRef, useState } from 'react'; -import { useFeature } from '@growthbook/growthbook-react'; import Helmet from 'react-helmet'; import { useTranslation } from 'react-i18next'; import { connect } from 'react-redux'; @@ -9,12 +8,7 @@ import { isEqual } from 'lodash'; // Local Utilities import LearnLayout from '../../../components/layouts/learn'; -import { - ChallengeNode, - ChallengeMeta, - NavigationPaths, - Test -} from '../../../redux/prop-types'; +import { ChallengeNode, ChallengeMeta, Test } from '../../../redux/prop-types'; import ChallengeDescription from '../components/challenge-description'; import Hotkeys from '../components/hotkeys'; import ChallengeTitle from '../components/challenge-title'; @@ -66,7 +60,6 @@ interface ShowQuizProps { openHelpModal: () => void; pageContext: { challengeMeta: ChallengeMeta; - nextCurriculumPaths: NavigationPaths; }; updateChallengeMeta: (arg0: ChallengeMeta) => void; updateSolutionFormValues: () => void; @@ -97,7 +90,7 @@ const ShowGeneric = ({ } } }, - pageContext: { challengeMeta, nextCurriculumPaths }, + pageContext: { challengeMeta }, initTests, updateChallengeMeta, openCompletionModal, @@ -114,9 +107,7 @@ const ShowGeneric = ({ useEffect(() => { initTests(tests); const challengePaths = getChallengePaths({ - showNextCurriculum, - currentCurriculumPaths: challengeMeta, - nextCurriculumPaths + currentCurriculumPaths: challengeMeta }); updateChallengeMeta({ ...challengeMeta, @@ -161,8 +152,6 @@ const ShowGeneric = ({ const [showFeedback, setShowFeedback] = useState(false); - const showNextCurriculum = useFeature('fcc-10').on; - const handleMcqOptionChange = ( questionIndex: number, answerIndex: number diff --git a/client/src/templates/Challenges/ms-trophy/show.tsx b/client/src/templates/Challenges/ms-trophy/show.tsx index 4ee7cdf940b..6141d2357b5 100644 --- a/client/src/templates/Challenges/ms-trophy/show.tsx +++ b/client/src/templates/Challenges/ms-trophy/show.tsx @@ -7,16 +7,10 @@ import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import type { Dispatch } from 'redux'; import { createSelector } from 'reselect'; -import { useFeature } from '@growthbook/growthbook-react'; import { Container, Col, Row, Button, Spacer } from '@freecodecamp/ui'; import LearnLayout from '../../../components/layouts/learn'; -import { - ChallengeNode, - ChallengeMeta, - NavigationPaths, - Test -} from '../../../redux/prop-types'; +import { ChallengeNode, ChallengeMeta, Test } from '../../../redux/prop-types'; import ChallengeDescription from '../components/challenge-description'; import Hotkeys from '../components/hotkeys'; import ChallengeTitle from '../components/challenge-title'; @@ -83,7 +77,6 @@ interface MsTrophyProps { openHelpModal: () => void; pageContext: { challengeMeta: ChallengeMeta; - nextCurriculumPaths: NavigationPaths; }; submitChallenge: () => void; t: TFunction; @@ -91,7 +84,6 @@ interface MsTrophyProps { } function MsTrophy(props: MsTrophyProps) { - const showNextCurriculum = useFeature('fcc-10').on; const container = useRef(null); const { data: { @@ -113,15 +105,13 @@ function MsTrophy(props: MsTrophyProps) { } } }, - pageContext: { challengeMeta, nextCurriculumPaths }, + pageContext: { challengeMeta }, initTests, updateChallengeMeta } = props; initTests(tests); const challengePaths = getChallengePaths({ - showNextCurriculum, - currentCurriculumPaths: challengeMeta, - nextCurriculumPaths + currentCurriculumPaths: challengeMeta }); updateChallengeMeta({ ...challengeMeta, diff --git a/client/src/templates/Challenges/projects/backend/show.tsx b/client/src/templates/Challenges/projects/backend/show.tsx index ed053d076b5..1b365e29cac 100644 --- a/client/src/templates/Challenges/projects/backend/show.tsx +++ b/client/src/templates/Challenges/projects/backend/show.tsx @@ -6,14 +6,12 @@ import type { TFunction } from 'i18next'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import { Container, Col, Row, Spacer } from '@freecodecamp/ui'; -import { useFeature } from '@growthbook/growthbook-react'; import LearnLayout from '../../../../components/layouts/learn'; import { isSignedInSelector } from '../../../../redux/selectors'; import { ChallengeMeta, ChallengeNode, - NavigationPaths, Test } from '../../../../redux/prop-types'; import ChallengeDescription from '../../components/challenge-description'; @@ -87,7 +85,6 @@ interface BackEndProps { output: string[]; pageContext: { challengeMeta: ChallengeMeta; - nextCurriculumPaths: NavigationPaths; }; t: TFunction; tests: Test[]; @@ -97,7 +94,6 @@ interface BackEndProps { } const ShowBackEnd = (props: BackEndProps) => { - const showNextCurriculum = useFeature('fcc-10').on; const container = useRef(null); const handleSubmit = ({ @@ -124,14 +120,12 @@ const ShowBackEnd = (props: BackEndProps) => { } } }, - pageContext: { challengeMeta, nextCurriculumPaths } + pageContext: { challengeMeta } } = props; initConsole(); initTests(tests); const challengePaths = getChallengePaths({ - showNextCurriculum, - currentCurriculumPaths: challengeMeta, - nextCurriculumPaths + currentCurriculumPaths: challengeMeta }); updateChallengeMeta({ ...challengeMeta, diff --git a/client/src/templates/Challenges/projects/frontend/show.tsx b/client/src/templates/Challenges/projects/frontend/show.tsx index f27ee706d7d..070f0f7d1a0 100644 --- a/client/src/templates/Challenges/projects/frontend/show.tsx +++ b/client/src/templates/Challenges/projects/frontend/show.tsx @@ -8,13 +8,11 @@ import { bindActionCreators } from 'redux'; import type { Dispatch } from 'redux'; import { createSelector } from 'reselect'; import { Container, Col, Row, Spacer } from '@freecodecamp/ui'; -import { useFeature } from '@growthbook/growthbook-react'; import LearnLayout from '../../../../components/layouts/learn'; import { ChallengeNode, ChallengeMeta, - NavigationPaths, Test } from '../../../../redux/prop-types'; import ChallengeDescription from '../../components/challenge-description'; @@ -64,7 +62,6 @@ interface ProjectProps { openCompletionModal: () => void; pageContext: { challengeMeta: ChallengeMeta; - nextCurriculumPaths: NavigationPaths; }; t: TFunction; updateChallengeMeta: (arg0: ChallengeMeta) => void; @@ -82,7 +79,6 @@ const ShowFrontEndProject = (props: ProjectProps) => { } }; - const showNextCurriculum = useFeature('fcc-10').on; const container = useRef(null); useEffect(() => { @@ -93,15 +89,13 @@ const ShowFrontEndProject = (props: ProjectProps) => { challenge: { fields, title, challengeType, helpCategory } } }, - pageContext: { challengeMeta, nextCurriculumPaths }, + pageContext: { challengeMeta }, initTests, updateChallengeMeta } = props; initTests(fields.tests); const challengePaths = getChallengePaths({ - showNextCurriculum, - currentCurriculumPaths: challengeMeta, - nextCurriculumPaths + currentCurriculumPaths: challengeMeta }); updateChallengeMeta({ ...challengeMeta, diff --git a/client/src/templates/Challenges/quiz/show.tsx b/client/src/templates/Challenges/quiz/show.tsx index 098612c6c99..5fd0cec5199 100644 --- a/client/src/templates/Challenges/quiz/show.tsx +++ b/client/src/templates/Challenges/quiz/show.tsx @@ -17,17 +17,11 @@ import { useQuiz, Spacer } from '@freecodecamp/ui'; -import { useFeature } from '@growthbook/growthbook-react'; // Local Utilities import { shuffleArray } from '../../../../../shared/utils/shuffle-array'; import LearnLayout from '../../../components/layouts/learn'; -import { - ChallengeNode, - ChallengeMeta, - NavigationPaths, - Test -} from '../../../redux/prop-types'; +import { ChallengeNode, ChallengeMeta, Test } from '../../../redux/prop-types'; import ChallengeDescription from '../components/challenge-description'; import Hotkeys from '../components/hotkeys'; import ChallengeTitle from '../components/challenge-title'; @@ -81,7 +75,6 @@ interface ShowQuizProps { isChallengeCompleted: boolean; pageContext: { challengeMeta: ChallengeMeta; - nextCurriculumPaths: NavigationPaths; }; updateChallengeMeta: (arg0: ChallengeMeta) => void; updateSolutionFormValues: () => void; @@ -109,7 +102,7 @@ const ShowQuiz = ({ } } }, - pageContext: { challengeMeta, nextCurriculumPaths }, + pageContext: { challengeMeta }, initTests, updateChallengeMeta, isChallengeCompleted, @@ -134,7 +127,6 @@ const ShowQuiz = ({ const [showUnanswered, setShowUnanswered] = useState(false); const [exitConfirmed, setExitConfirmed] = useState(false); - const showNextCurriculum = useFeature('fcc-10').on; const blockNameTitle = `${t( `intro:${superBlock}.blocks.${block}.title` @@ -199,9 +191,7 @@ const ShowQuiz = ({ useEffect(() => { initTests(tests); const challengePaths = getChallengePaths({ - showNextCurriculum, - currentCurriculumPaths: challengeMeta, - nextCurriculumPaths + currentCurriculumPaths: challengeMeta }); updateChallengeMeta({ ...challengeMeta, diff --git a/client/src/templates/Challenges/utils/challenge-paths.ts b/client/src/templates/Challenges/utils/challenge-paths.ts index d5382e08e06..48e51a2fb98 100644 --- a/client/src/templates/Challenges/utils/challenge-paths.ts +++ b/client/src/templates/Challenges/utils/challenge-paths.ts @@ -1,23 +1,12 @@ import { NavigationPaths } from '../../../redux/prop-types'; export const getChallengePaths = ({ - showNextCurriculum, - currentCurriculumPaths, - nextCurriculumPaths + currentCurriculumPaths }: { - showNextCurriculum: boolean; currentCurriculumPaths: NavigationPaths; - nextCurriculumPaths: NavigationPaths; }): NavigationPaths => { - const nextChallengePath = showNextCurriculum - ? nextCurriculumPaths.nextChallengePath - : currentCurriculumPaths.nextChallengePath; - - const prevChallengePath = showNextCurriculum - ? nextCurriculumPaths.prevChallengePath - : currentCurriculumPaths.prevChallengePath; return { - nextChallengePath, - prevChallengePath + nextChallengePath: currentCurriculumPaths.nextChallengePath, + prevChallengePath: currentCurriculumPaths.prevChallengePath }; }; diff --git a/client/utils/gatsby/challenge-page-creator.js b/client/utils/gatsby/challenge-page-creator.js index c4d28218a5e..42544bec07f 100644 --- a/client/utils/gatsby/challenge-page-creator.js +++ b/client/utils/gatsby/challenge-page-creator.js @@ -78,12 +78,7 @@ function getTemplateComponent(challengeType) { exports.createChallengePages = function ( createPage, - { - idToNextPathCurrentCurriculum, - idToPrevPathCurrentCurriculum, - idToNextPathNextCurriculum, - idToPrevPathNextCurriculum - } + { idToNextPathCurrentCurriculum, idToPrevPathCurrentCurriculum } ) { return function ({ node }, index, allChallengeEdges) { const { @@ -123,10 +118,6 @@ exports.createChallengePages = function ( prevChallengePath: idToPrevPathCurrentCurriculum[node.id], id }, - nextCurriculumPaths: { - nextChallengePath: idToNextPathNextCurriculum[node.id], - prevChallengePath: idToPrevPathNextCurriculum[node.id] - }, projectPreview: getProjectPreviewConfig( node.challenge, allChallengeEdges diff --git a/curriculum/utils.js b/curriculum/utils.js index 1b6d95347f5..cd80b423e23 100644 --- a/curriculum/utils.js +++ b/curriculum/utils.js @@ -44,8 +44,7 @@ function createSuperOrder(superBlocks) { const flatSuperBlockMap = generateSuperBlockList({ showNewCurriculum: process.env.SHOW_NEW_CURRICULUM === 'true', - showUpcomingChanges: process.env.SHOW_UPCOMING_CHANGES === 'true', - showNextCurriculum: true + showUpcomingChanges: process.env.SHOW_UPCOMING_CHANGES === 'true' }); const superOrder = createSuperOrder(flatSuperBlockMap); diff --git a/shared/config/curriculum.test.ts b/shared/config/curriculum.test.ts index e3bef69c190..43ce3dee6b8 100644 --- a/shared/config/curriculum.test.ts +++ b/shared/config/curriculum.test.ts @@ -23,8 +23,7 @@ describe('generateSuperBlockList', () => { it('should return an array of SuperBlocks object with all elements when if all configs are true', () => { const result = generateSuperBlockList({ showNewCurriculum: true, - showUpcomingChanges: true, - showNextCurriculum: true + showUpcomingChanges: true }); expect(result).toHaveLength(Object.values(superBlockStages).flat().length); }); @@ -32,28 +31,13 @@ describe('generateSuperBlockList', () => { it('should return an array of SuperBlocks without New and Upcoming when { showNewCurriculum: false, showUpcomingChanges: false }', () => { const result = generateSuperBlockList({ showNewCurriculum: false, - showUpcomingChanges: false, - showNextCurriculum: true + showUpcomingChanges: false }); const tempSuperBlockMap = { ...superBlockStages }; tempSuperBlockMap[SuperBlockStage.New] = []; tempSuperBlockMap[SuperBlockStage.Upcoming] = []; expect(result).toHaveLength(Object.values(tempSuperBlockMap).flat().length); }); - - it('should exclude the Next SuperBlocks when { showNextCurriculum: false }', () => { - const result = generateSuperBlockList({ - showNewCurriculum: false, - showUpcomingChanges: false, - showNextCurriculum: false - }); - const tempSuperBlockMap = { ...superBlockStages }; - tempSuperBlockMap[SuperBlockStage.New] = []; - tempSuperBlockMap[SuperBlockStage.Upcoming] = []; - tempSuperBlockMap[SuperBlockStage.Next] = []; - tempSuperBlockMap[SuperBlockStage.NextEnglish] = []; - expect(result).toHaveLength(Object.values(tempSuperBlockMap).flat().length); - }); }); describe('Immutability of superBlockOrder, notAuditedSuperBlocks, and flatSuperBlockMap', () => { diff --git a/shared/config/curriculum.ts b/shared/config/curriculum.ts index 4d91fe1cc97..942e2d26e06 100644 --- a/shared/config/curriculum.ts +++ b/shared/config/curriculum.ts @@ -64,15 +64,9 @@ const defaultStageOrder = [ export function getStageOrder({ showNewCurriculum, - showUpcomingChanges, - showNextCurriculum + showUpcomingChanges }: Config): SuperBlockStage[] { - const isCurrentStage = (stage: SuperBlockStage) => - !(stage === SuperBlockStage.Next) && - !(stage === SuperBlockStage.NextEnglish); - const stageOrder = showNextCurriculum - ? [...defaultStageOrder] - : [...defaultStageOrder.filter(isCurrentStage)]; + const stageOrder = [...defaultStageOrder]; if (showNewCurriculum) stageOrder.push(SuperBlockStage.New); if (showUpcomingChanges) stageOrder.push(SuperBlockStage.Upcoming); @@ -259,7 +253,6 @@ Object.freeze(notAuditedSuperBlocks); type Config = { showNewCurriculum: boolean; showUpcomingChanges: boolean; - showNextCurriculum: boolean; }; export function generateSuperBlockList(config: Config): SuperBlocks[] { @@ -280,8 +273,7 @@ export function getAuditedSuperBlocks({ // To find the audited superblocks, we need to start with all superblocks. const flatSuperBlockMap = generateSuperBlockList({ showNewCurriculum: true, - showUpcomingChanges: true, - showNextCurriculum: true + showUpcomingChanges: true }); const auditedSuperBlocks = flatSuperBlockMap.filter( superBlock =>