Skip to content

Commit cb6d7d6

Browse files
authored
Merge pull request #33 from topcoder-platform/PROD-2562_certification_navigation_handle
Prod 2562 certification navigation handle
2 parents 91fa535 + c8c9b72 commit cb6d7d6

File tree

6 files changed

+26
-14
lines changed

6 files changed

+26
-14
lines changed

client/src/assets/icons/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ const generateIconComponent = (
3535
className: string
3636
): JSX.Element => {
3737
// fallback in case super block doesn't exist and for tests
38-
const Icon = iconMap[superBlock] ? iconMap[superBlock] : ResponsiveDesign;
38+
const Icon = iconMap[superBlock as keyof typeof iconMap]
39+
? iconMap[superBlock as keyof typeof iconMap]
40+
: ResponsiveDesign;
3941

4042
return <Icon className={className} />;
4143
};

client/src/templates/Challenges/redux/completion-epic.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ import {
2323
import postUpdate$ from '../utils/post-update';
2424
import { mapFilesToChallengeFiles } from '../../../utils/ajax';
2525
import { standardizeRequestBody } from '../../../utils/challenge-request-helpers';
26-
import { postChallengeCompletedEvent } from '../../../utils/iframe-message';
26+
import {
27+
postChallengeCompletedEvent,
28+
postNavigationLastChallengeEvent
29+
} from '../../../utils/iframe-message';
2730
import { actionTypes } from './action-types';
2831
import {
2932
projectFormValuesSelector,
@@ -188,7 +191,12 @@ export default function completionEpic(action$, state$) {
188191
filter(Boolean),
189192
finalize(async () => {
190193
postChallengeCompletedEvent({ meta });
191-
return navigate(await pathToNavigateTo());
194+
const nextNavigatePath = await pathToNavigateTo();
195+
if (nextNavigatePath) {
196+
return navigate(nextNavigatePath);
197+
} else {
198+
postNavigationLastChallengeEvent({ meta });
199+
}
192200
})
193201
);
194202
})
@@ -198,7 +206,5 @@ export default function completionEpic(action$, state$) {
198206
async function findPathToNavigateTo(nextChallengePath, superBlock) {
199207
if (nextChallengePath.includes(superBlock)) {
200208
return nextChallengePath;
201-
} else {
202-
return `/learn/${superBlock}/#${superBlock}-projects`;
203209
}
204210
}

client/src/utils/iframe-message.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
export enum PostMessageIframeEvents {
2+
NavigationLastChallenge = 'fcc:nav:last-challenge',
23
ChallengeCompleted = 'fcc:challenge:completed',
34
ChallengeReady = 'fcc:challenge:ready',
45
IncomingUrlUpdate = 'fcc:url:update'
56
}
67

8+
export const postNavigationLastChallengeEvent = (data: unknown) =>
9+
iframeMessage(PostMessageIframeEvents.NavigationLastChallenge, data);
10+
711
export const postChallengeCompletedEvent = (data: unknown) =>
812
iframeMessage(PostMessageIframeEvents.ChallengeCompleted, data);
913

curriculum-server/source-curriculum.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ interface Curriculum {
66
[key: string]: unknown;
77
}
88

9-
const curriculumList: Array<Curriculum> = Object.keys(curriculum as Curriculum)
10-
.map(key => {
9+
const curriculumList: Array<Curriculum> = Object.keys(
10+
curriculum as Curriculum
11+
).map(key => {
1112
if (key === '2022/responsive-web-design') {
1213
return { '2022-responsive-web-design': (curriculum as Curriculum)[key] };
1314
} else if (key === '2022/responsive-web-design-qa') {
@@ -17,10 +18,9 @@ const curriculumList: Array<Curriculum> = Object.keys(curriculum as Curriculum)
1718
}
1819
});
1920

20-
const patchedCurriculum = curriculumList
21-
.reduce((prev, curr) => {
22-
return { ...prev, ...curr };
23-
}, {});
21+
const patchedCurriculum = curriculumList.reduce((prev, curr) => {
22+
return { ...prev, ...curr };
23+
}, {});
2424

2525
void fs
2626
.mkdir('data', { recursive: true })

curriculum/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const superBlockToOrder = {
3737
'coding-interview-prep': 10,
3838
'responsive-web-design': 11,
3939
'relational-database': 12,
40-
'2022/responsive-web-design-qa': 13,
40+
'2022/responsive-web-design-qa': 13
4141
};
4242

4343
/**
@@ -59,7 +59,7 @@ const superBlockNonAuditedOrder = {
5959
'coding-interview-prep': 10,
6060
'2022/responsive-web-design': 11,
6161
'relational-database': 12,
62-
'2022/responsive-web-design-qa': 13,
62+
'2022/responsive-web-design-qa': 13
6363
};
6464

6565
const superBlockToNewOrder = {

utils/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const idToTitle = new Map(
99
'5e6021435ac9d0ecd8b94b00': 'Information Security',
1010
'561abd10cb81ac38a17513bc': 'JavaScript Algorithms and Data Structures',
1111
'561add10cb82ac38a17513bc': 'Responsive Web Design',
12-
'aaaaaaaaaaaaaaaaaaaaaaaa': 'Responsive Web Design QA',
12+
aaaaaaaaaaaaaaaaaaaaaaaa: 'Responsive Web Design QA',
1313
'660add10cb82ac38a17513be': 'Legacy Back End',
1414
'561add10cb82ac39a17513bc': 'Legacy Data Visualization',
1515
'561add10cb82ac38a17513be': 'Legacy Front End',

0 commit comments

Comments
 (0)