Skip to content

Prod 2562 certification navigation handle #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion client/src/assets/icons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Icon className={className} />;
};
Expand Down
14 changes: 10 additions & 4 deletions client/src/templates/Challenges/redux/completion-epic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 });
}
})
);
})
Expand All @@ -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`;
}
}
4 changes: 4 additions & 0 deletions client/src/utils/iframe-message.ts
Original file line number Diff line number Diff line change
@@ -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);

Expand Down
12 changes: 6 additions & 6 deletions curriculum-server/source-curriculum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ interface Curriculum {
[key: string]: unknown;
}

const curriculumList: Array<Curriculum> = Object.keys(curriculum as Curriculum)
.map(key => {
const curriculumList: Array<Curriculum> = 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') {
Expand All @@ -17,10 +18,9 @@ const curriculumList: Array<Curriculum> = 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 })
Expand Down
4 changes: 2 additions & 2 deletions curriculum/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

/**
Expand All @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down