diff --git a/client/src/assets/icons/index.tsx b/client/src/assets/icons/index.tsx index 4adcec517a36d4..45f29522fd6003 100644 --- a/client/src/assets/icons/index.tsx +++ b/client/src/assets/icons/index.tsx @@ -35,7 +35,9 @@ const generateIconComponent = ( className: string ): JSX.Element => { // fallback in case super block doesn't exist and for tests - const Icon = iconMap[superBlock] ? iconMap[superBlock] : ResponsiveDesign; + const Icon = iconMap[superBlock as keyof typeof iconMap] + ? iconMap[superBlock as keyof typeof iconMap] + : ResponsiveDesign; return ; }; diff --git a/client/src/templates/Challenges/redux/completion-epic.js b/client/src/templates/Challenges/redux/completion-epic.js index f150c4ae99b78f..80ccbf82ce9a97 100644 --- a/client/src/templates/Challenges/redux/completion-epic.js +++ b/client/src/templates/Challenges/redux/completion-epic.js @@ -23,7 +23,10 @@ import { import postUpdate$ from '../utils/post-update'; import { mapFilesToChallengeFiles } from '../../../utils/ajax'; import { standardizeRequestBody } from '../../../utils/challenge-request-helpers'; -import { postChallengeCompletedEvent } from '../../../utils/iframe-message'; +import { + postChallengeCompletedEvent, + postNavigationLastChallengeEvent +} from '../../../utils/iframe-message'; import { actionTypes } from './action-types'; import { projectFormValuesSelector, @@ -188,7 +191,12 @@ export default function completionEpic(action$, state$) { filter(Boolean), finalize(async () => { postChallengeCompletedEvent({ meta }); - return navigate(await pathToNavigateTo()); + const nextNavigatePath = await pathToNavigateTo(); + if (nextNavigatePath) { + return navigate(nextNavigatePath); + } else { + postNavigationLastChallengeEvent({ meta }); + } }) ); }) @@ -198,7 +206,5 @@ export default function completionEpic(action$, state$) { async function findPathToNavigateTo(nextChallengePath, superBlock) { if (nextChallengePath.includes(superBlock)) { return nextChallengePath; - } else { - return `/learn/${superBlock}/#${superBlock}-projects`; } } diff --git a/client/src/utils/iframe-message.ts b/client/src/utils/iframe-message.ts index 8940790fa21a0a..0fcbff8cb1c27f 100755 --- a/client/src/utils/iframe-message.ts +++ b/client/src/utils/iframe-message.ts @@ -1,9 +1,13 @@ export enum PostMessageIframeEvents { + NavigationLastChallenge = 'fcc:nav:last-challenge', ChallengeCompleted = 'fcc:challenge:completed', ChallengeReady = 'fcc:challenge:ready', IncomingUrlUpdate = 'fcc:url:update' } +export const postNavigationLastChallengeEvent = (data: unknown) => + iframeMessage(PostMessageIframeEvents.NavigationLastChallenge, data); + export const postChallengeCompletedEvent = (data: unknown) => iframeMessage(PostMessageIframeEvents.ChallengeCompleted, data); diff --git a/curriculum-server/source-curriculum.ts b/curriculum-server/source-curriculum.ts index 0912ad62f8e965..a505e1e12d79d3 100644 --- a/curriculum-server/source-curriculum.ts +++ b/curriculum-server/source-curriculum.ts @@ -6,8 +6,9 @@ interface Curriculum { [key: string]: unknown; } -const curriculumList: Array = Object.keys(curriculum as Curriculum) -.map(key => { +const curriculumList: Array = Object.keys( + curriculum as Curriculum +).map(key => { if (key === '2022/responsive-web-design') { return { '2022-responsive-web-design': (curriculum as Curriculum)[key] }; } else if (key === '2022/responsive-web-design-qa') { @@ -17,10 +18,9 @@ const curriculumList: Array = Object.keys(curriculum as Curriculum) } }); -const patchedCurriculum = curriculumList - .reduce((prev, curr) => { - return { ...prev, ...curr }; - }, {}); +const patchedCurriculum = curriculumList.reduce((prev, curr) => { + return { ...prev, ...curr }; +}, {}); void fs .mkdir('data', { recursive: true }) diff --git a/curriculum/utils.js b/curriculum/utils.js index 04f3073e34c5fd..fa592a606be5d4 100644 --- a/curriculum/utils.js +++ b/curriculum/utils.js @@ -37,7 +37,7 @@ const superBlockToOrder = { 'coding-interview-prep': 10, 'responsive-web-design': 11, 'relational-database': 12, - '2022/responsive-web-design-qa': 13, + '2022/responsive-web-design-qa': 13 }; /** @@ -59,7 +59,7 @@ const superBlockNonAuditedOrder = { 'coding-interview-prep': 10, '2022/responsive-web-design': 11, 'relational-database': 12, - '2022/responsive-web-design-qa': 13, + '2022/responsive-web-design-qa': 13 }; const superBlockToNewOrder = { diff --git a/utils/index.js b/utils/index.js index 4c5a31cbfe6e39..0135b7bef7c637 100644 --- a/utils/index.js +++ b/utils/index.js @@ -9,7 +9,7 @@ const idToTitle = new Map( '5e6021435ac9d0ecd8b94b00': 'Information Security', '561abd10cb81ac38a17513bc': 'JavaScript Algorithms and Data Structures', '561add10cb82ac38a17513bc': 'Responsive Web Design', - 'aaaaaaaaaaaaaaaaaaaaaaaa': 'Responsive Web Design QA', + aaaaaaaaaaaaaaaaaaaaaaaa: 'Responsive Web Design QA', '660add10cb82ac38a17513be': 'Legacy Back End', '561add10cb82ac39a17513bc': 'Legacy Data Visualization', '561add10cb82ac38a17513be': 'Legacy Front End',