From f04fbba22d3a90b7a6ae0fc718106cd8019d5fab Mon Sep 17 00:00:00 2001 From: Tom <20648924+moT01@users.noreply.github.com> Date: Thu, 5 May 2022 03:58:14 -0500 Subject: [PATCH] feat: convert RWD cert projects (#44564) * feat: convert RWD cert projects * feat: convert original projects * fix: add usesMultiFileEditor to meta * feat: add cypress tests for saving and loading to/from database * fix: broken cypress tests * fix: inconsistent variable naming * fix: missed variable name * fix: more cypress * feat: add solutions for english * fix: ctrl+s to database only if signed in * fix: prioritize code from db * refactor: expand the comments slightly --- api-server/src/server/boot/challenge.js | 6 +- client/src/redux/save-challenge-saga.js | 4 +- .../Challenges/classic/action-row.tsx | 6 +- .../Challenges/classic/desktop-layout.tsx | 12 +- .../templates/Challenges/classic/editor.tsx | 10 +- .../src/templates/Challenges/classic/show.tsx | 4 +- .../Challenges/components/tool-panel.tsx | 5 +- .../Challenges/redux/code-storage-epic.js | 16 +- .../Challenges/redux/completion-epic.js | 2 +- .../redux/execute-challenge-saga.js | 4 +- .../src/templates/Challenges/redux/index.js | 2 +- .../src/templates/Challenges/utils/build.js | 12 +- client/src/utils/challenge-request-helpers.ts | 2 +- client/src/utils/solution-display-type.ts | 2 +- client/utils/challenge-types.js | 8 +- client/utils/gatsby/challenge-page-creator.js | 2 +- .../meta.json | 1 + .../meta.json | 1 + .../build-a-survey-form-project/meta.json | 1 + .../meta.json | 1 + .../build-a-tribute-page-project/meta.json | 1 + .../responsive-web-design-projects/meta.json | 1 + .../build-a-personal-portfolio-webpage.md | 268 ++++++++- .../build-a-product-landing-page.md | 415 +++++++++++++- .../build-a-survey-form.md | 507 ++++++++++++++++- .../build-a-technical-documentation-page.md | 516 +++++++++++++++++- .../build-a-tribute-page.md | 318 ++++++++++- .../build-a-personal-portfolio-webpage.md | 268 ++++++++- .../build-a-product-landing-page.md | 415 +++++++++++++- .../build-a-survey-form.md | 507 ++++++++++++++++- .../build-a-technical-documentation-page.md | 516 +++++++++++++++++- .../build-a-tribute-page.md | 318 ++++++++++- .../integration/learn/challenge-hot-keys.js | 6 +- .../learn/challenges/multifileCertProject.js | 56 ++ .../donate/donation-block-completion-modal.js | 14 +- .../show-cert-from-superblock.js | 20 +- cypress/support/commands.js | 9 + 37 files changed, 3985 insertions(+), 271 deletions(-) create mode 100644 cypress/integration/learn/challenges/multifileCertProject.js diff --git a/api-server/src/server/boot/challenge.js b/api-server/src/server/boot/challenge.js index 4b734adbeb5..1c47b85718e 100644 --- a/api-server/src/server/boot/challenge.js +++ b/api-server/src/server/boot/challenge.js @@ -91,7 +91,7 @@ const jsCertProjectIds = [ 'aa2e6f85cab2ab736c9a9b24' ]; -const multiFileCertProjectIds = getChallenges() +const multifileCertProjectIds = getChallenges() .filter(challenge => challenge.challengeType === 14) .map(challenge => challenge.id); @@ -132,7 +132,7 @@ export function buildUserUpdate( let completedChallenge = {}; if ( jsCertProjectIds.includes(challengeId) || - multiFileCertProjectIds.includes(challengeId) + multifileCertProjectIds.includes(challengeId) ) { completedChallenge = { ..._completedChallenge, @@ -315,7 +315,7 @@ export function modernChallengeCompleted(req, res, next) { // step or normal challenge we can avoid storing in the database. if ( jsCertProjectIds.includes(id) || - multiFileCertProjectIds.includes(id) + multifileCertProjectIds.includes(id) ) { completedChallenge.challengeType = challengeType; } diff --git a/client/src/redux/save-challenge-saga.js b/client/src/redux/save-challenge-saga.js index 9b081245deb..0c87196bb26 100644 --- a/client/src/redux/save-challenge-saga.js +++ b/client/src/redux/save-challenge-saga.js @@ -31,8 +31,8 @@ export function* saveChallengeSaga() { ); } - // only allow saving of multiFileCertProject's - if (challengeType === challengeTypes.multiFileCertProject) { + // only allow saving of multifileCertProject's + if (challengeType === challengeTypes.multifileCertProject) { const body = standardizeRequestBody({ id, challengeFiles, challengeType }); const bodySizeInBytes = getStringSizeInBytes(body); diff --git a/client/src/templates/Challenges/classic/action-row.tsx b/client/src/templates/Challenges/classic/action-row.tsx index 3e2bcbc5587..f1d6067e233 100644 --- a/client/src/templates/Challenges/classic/action-row.tsx +++ b/client/src/templates/Challenges/classic/action-row.tsx @@ -8,7 +8,7 @@ import EditorTabs from './editor-tabs'; interface ActionRowProps { block: string; hasNotes: boolean; - isMultiFileCertProject: boolean; + isMultifileCertProject: boolean; showConsole: boolean; showNotes: boolean; showPreview: boolean; @@ -23,7 +23,7 @@ const mapDispatchToProps = { const ActionRow = ({ hasNotes, - isMultiFileCertProject, + isMultifileCertProject, togglePane, showNotes, showPreview, @@ -40,7 +40,7 @@ const ActionRow = ({