mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-02-19 04:00:51 -05:00
refactor: remove release code (#57957)
This commit is contained in:
committed by
GitHub
parent
be6736f5df
commit
d68cbdb2c4
@@ -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
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
@@ -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({
|
||||
<div className='map-ui' data-test-label='curriculum-map'>
|
||||
{getStageOrder({
|
||||
showNewCurriculum,
|
||||
showUpcomingChanges,
|
||||
showNextCurriculum
|
||||
showUpcomingChanges
|
||||
}).map(stage => (
|
||||
<Fragment key={stage}>
|
||||
<h2 className={forLanding ? 'big-heading' : ''}>
|
||||
|
||||
@@ -21,7 +21,6 @@ import {
|
||||
ChallengeMeta,
|
||||
ChallengeNode,
|
||||
CompletedChallenge,
|
||||
NavigationPaths,
|
||||
ResizeProps,
|
||||
SavedChallengeFiles,
|
||||
Test
|
||||
@@ -113,7 +112,6 @@ interface ShowClassicProps extends Pick<PreviewProps, 'previewMounted'> {
|
||||
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({
|
||||
|
||||
@@ -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<HTMLElement>(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,
|
||||
|
||||
@@ -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<HTMLElement>(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,
|
||||
|
||||
@@ -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<HTMLElement | null>(null);
|
||||
const showNextCurriculum = useFeature('fcc-10').on;
|
||||
|
||||
useEffect(() => {
|
||||
initTests(tests);
|
||||
const challengePaths = getChallengePaths({
|
||||
showNextCurriculum,
|
||||
currentCurriculumPaths: challengeMeta,
|
||||
nextCurriculumPaths
|
||||
currentCurriculumPaths: challengeMeta
|
||||
});
|
||||
updateChallengeMeta({
|
||||
...challengeMeta,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<HTMLElement>(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,
|
||||
|
||||
@@ -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<HTMLElement>(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,
|
||||
|
||||
@@ -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<HTMLElement>(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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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 =>
|
||||
|
||||
Reference in New Issue
Block a user