diff --git a/client/i18n/locales/english/links.json b/client/i18n/locales/english/links.json index 13a52d2231d..0a728ef1797 100644 --- a/client/i18n/locales/english/links.json +++ b/client/i18n/locales/english/links.json @@ -27,6 +27,7 @@ "HTML-CSS": "HTML-CSS", "JavaScript": "JavaScript", "Python": "Python", - "Backend Development": "Backend Development" + "Backend Development": "Backend Development", + "C-Sharp": "C-Sharp" } } diff --git a/client/src/templates/Challenges/ms-trophy/show.tsx b/client/src/templates/Challenges/ms-trophy/show.tsx index 8ed3689bbd9..41c767f67f2 100644 --- a/client/src/templates/Challenges/ms-trophy/show.tsx +++ b/client/src/templates/Challenges/ms-trophy/show.tsx @@ -17,6 +17,7 @@ import ChallengeDescription from '../components/challenge-description'; import Hotkeys from '../components/hotkeys'; import ChallengeTitle from '../components/challenge-title'; import CompletionModal from '../components/completion-modal'; +import HelpModal from '../components/help-modal'; import { challengeMounted, updateChallengeMeta, @@ -55,6 +56,7 @@ const mapDispatchToProps = (dispatch: Dispatch) => challengeMounted, updateSolutionFormValues, openCompletionModal: () => openModal('completion'), + openHelpModal: () => openModal('help'), setIsProcessing, submitChallenge }, @@ -70,6 +72,7 @@ interface MsTrophyProps { setIsProcessing: (arg0: boolean) => void; msUsername: string | undefined | null; openCompletionModal: () => void; + openHelpModal: () => void; pageContext: { challengeMeta: ChallengeMeta; }; @@ -92,7 +95,7 @@ class MsTrophy extends Component { challengeMounted, data: { challengeNode: { - challenge: { title, challengeType } + challenge: { title, challengeType, helpCategory } } }, pageContext: { challengeMeta }, @@ -101,7 +104,8 @@ class MsTrophy extends Component { updateChallengeMeta({ ...challengeMeta, title, - challengeType + challengeType, + helpCategory }); challengeMounted(challengeMeta.id); this._container?.focus(); @@ -119,7 +123,7 @@ class MsTrophy extends Component { challengeMounted, data: { challengeNode: { - challenge: { title: currentTitle, challengeType } + challenge: { title: currentTitle, challengeType, helpCategory } } }, pageContext: { challengeMeta }, @@ -129,7 +133,8 @@ class MsTrophy extends Component { updateChallengeMeta({ ...challengeMeta, title: currentTitle, - challengeType + challengeType, + helpCategory }); challengeMounted(challengeMeta.id); } @@ -152,13 +157,15 @@ class MsTrophy extends Component { instructions, superBlock, block, - translationPending + translationPending, + fields: { blockName } } } }, isChallengeCompleted, isProcessing, msUsername, + openHelpModal, pageContext: { challengeMeta: { nextChallengePath, prevChallengePath } }, @@ -204,10 +211,19 @@ class MsTrophy extends Component { > {t('buttons.verify-trophy')} +
+ @@ -231,9 +247,13 @@ export const query = graphql` description instructions challengeType + helpCategory superBlock block translationPending + fields { + blockName + } } } } diff --git a/client/src/templates/Challenges/video/show.tsx b/client/src/templates/Challenges/video/show.tsx index ef559818af6..dc1e33a185a 100644 --- a/client/src/templates/Challenges/video/show.tsx +++ b/client/src/templates/Challenges/video/show.tsx @@ -23,6 +23,7 @@ import Hotkeys from '../components/hotkeys'; import VideoPlayer from '../components/video-player'; import ChallengeTitle from '../components/challenge-title'; import CompletionModal from '../components/completion-modal'; +import HelpModal from '../components/help-modal'; import PrismFormatted from '../components/prism-formatted'; import { challengeMounted, @@ -48,7 +49,8 @@ const mapDispatchToProps = (dispatch: Dispatch) => updateChallengeMeta, challengeMounted, updateSolutionFormValues, - openCompletionModal: () => openModal('completion') + openCompletionModal: () => openModal('completion'), + openHelpModal: () => openModal('help') }, dispatch ); @@ -60,6 +62,7 @@ interface ShowVideoProps { description: string; isChallengeCompleted: boolean; openCompletionModal: () => void; + openHelpModal: () => void; pageContext: { challengeMeta: ChallengeMeta; }; @@ -188,11 +191,13 @@ class ShowVideo extends Component { videoId, videoLocaleIds, bilibiliIds, + fields: { blockName }, question: { text, answers, solution } } } }, openCompletionModal, + openHelpModal, pageContext: { challengeMeta: { nextChallengePath, prevChallengePath } }, @@ -293,7 +298,6 @@ class ShowVideo extends Component { + + @@ -341,6 +354,7 @@ export const query = graphql` superBlock block fields { + blockName slug } question { diff --git a/curriculum/challenges/_meta/add-logic-to-c-sharp-console-applications/meta.json b/curriculum/challenges/_meta/add-logic-to-c-sharp-console-applications/meta.json index 541848efa81..ed6cc15af54 100644 --- a/curriculum/challenges/_meta/add-logic-to-c-sharp-console-applications/meta.json +++ b/curriculum/challenges/_meta/add-logic-to-c-sharp-console-applications/meta.json @@ -2,7 +2,7 @@ "name": "Add Logic to C# Console Applications", "isUpcomingChange": false, "dashedName": "add-logic-to-c-sharp-console-applications", - "helpCategory": "HTML-CSS", + "helpCategory": "C-Sharp", "order": 2, "time": "", "template": "", diff --git a/curriculum/challenges/_meta/create-and-run-simple-c-sharp-console-applications/meta.json b/curriculum/challenges/_meta/create-and-run-simple-c-sharp-console-applications/meta.json index 8a4b03c65ef..995eae4f0b7 100644 --- a/curriculum/challenges/_meta/create-and-run-simple-c-sharp-console-applications/meta.json +++ b/curriculum/challenges/_meta/create-and-run-simple-c-sharp-console-applications/meta.json @@ -2,7 +2,7 @@ "name": "Create and Run Simple C# Console Applications", "isUpcomingChange": false, "dashedName": "create-and-run-simple-c-sharp-console-applications", - "helpCategory": "HTML-CSS", + "helpCategory": "C-Sharp", "order": 1, "time": "", "template": "", diff --git a/curriculum/challenges/_meta/create-methods-in-c-sharp-console-applications/meta.json b/curriculum/challenges/_meta/create-methods-in-c-sharp-console-applications/meta.json index 3c4ea737ffd..f5e3c32e87d 100644 --- a/curriculum/challenges/_meta/create-methods-in-c-sharp-console-applications/meta.json +++ b/curriculum/challenges/_meta/create-methods-in-c-sharp-console-applications/meta.json @@ -2,7 +2,7 @@ "name": "Create Methods in C# Console Applications", "isUpcomingChange": false, "dashedName": "create-methods-in-c-sharp-console-applications", - "helpCategory": "HTML-CSS", + "helpCategory": "C-Sharp", "order": 4, "time": "", "template": "", diff --git a/curriculum/challenges/_meta/debug-c-sharp-console-applications/meta.json b/curriculum/challenges/_meta/debug-c-sharp-console-applications/meta.json index 631090dc68a..c01f44dbeea 100644 --- a/curriculum/challenges/_meta/debug-c-sharp-console-applications/meta.json +++ b/curriculum/challenges/_meta/debug-c-sharp-console-applications/meta.json @@ -2,7 +2,7 @@ "name": "Debug C# Console Applications", "isUpcomingChange": false, "dashedName": "debug-c-sharp-console-applications", - "helpCategory": "HTML-CSS", + "helpCategory": "C-Sharp", "order": 5, "time": "", "template": "", diff --git a/curriculum/challenges/_meta/foundational-c-sharp-with-microsoft-certification-exam/meta.json b/curriculum/challenges/_meta/foundational-c-sharp-with-microsoft-certification-exam/meta.json index a62c0181866..160325726ce 100644 --- a/curriculum/challenges/_meta/foundational-c-sharp-with-microsoft-certification-exam/meta.json +++ b/curriculum/challenges/_meta/foundational-c-sharp-with-microsoft-certification-exam/meta.json @@ -2,7 +2,7 @@ "name": "Foundational C# with Microsoft Certification Exam", "isUpcomingChange": false, "dashedName": "foundational-c-sharp-with-microsoft-certification-exam", - "helpCategory": "HTML-CSS", + "helpCategory": "C-Sharp", "order": 6, "time": "", "template": "", diff --git a/curriculum/challenges/_meta/work-with-variable-data-in-c-sharp-console-applications/meta.json b/curriculum/challenges/_meta/work-with-variable-data-in-c-sharp-console-applications/meta.json index 319525aca59..c1053e27dbe 100644 --- a/curriculum/challenges/_meta/work-with-variable-data-in-c-sharp-console-applications/meta.json +++ b/curriculum/challenges/_meta/work-with-variable-data-in-c-sharp-console-applications/meta.json @@ -2,7 +2,7 @@ "name": "Work with Variable Data in C# Console Applications", "isUpcomingChange": false, "dashedName": "work-with-variable-data-in-c-sharp-console-applications", - "helpCategory": "HTML-CSS", + "helpCategory": "C-Sharp", "order": 3, "time": "", "template": "", diff --git a/curriculum/challenges/_meta/write-your-first-code-using-c-sharp/meta.json b/curriculum/challenges/_meta/write-your-first-code-using-c-sharp/meta.json index d74e30157da..29f9e888d52 100644 --- a/curriculum/challenges/_meta/write-your-first-code-using-c-sharp/meta.json +++ b/curriculum/challenges/_meta/write-your-first-code-using-c-sharp/meta.json @@ -2,7 +2,7 @@ "name": "Write Your First Code Using C#", "isUpcomingChange": false, "dashedName": "write-your-first-code-using-c-sharp", - "helpCategory": "HTML-CSS", + "helpCategory": "C-Sharp", "order": 0, "time": "", "template": "", diff --git a/curriculum/schema/challenge-schema.js b/curriculum/schema/challenge-schema.js index e72ca583afd..877356d3aa0 100644 --- a/curriculum/schema/challenge-schema.js +++ b/curriculum/schema/challenge-schema.js @@ -49,7 +49,8 @@ const schema = Joi.object() 'JavaScript', 'HTML-CSS', 'Python', - 'Backend Development' + 'Backend Development', + 'C-Sharp' ), videoUrl: Joi.string().allow(''), forumTopicId: Joi.number(), diff --git a/cypress/e2e/default/learn/challenges/c-sharp.ts b/cypress/e2e/default/learn/challenges/c-sharp.ts new file mode 100644 index 00000000000..b9b04fe49d5 --- /dev/null +++ b/cypress/e2e/default/learn/challenges/c-sharp.ts @@ -0,0 +1,32 @@ +const cSharpLocations = { + challenge: + '/learn/foundational-c-sharp-with-microsoft/write-your-first-code-using-c-sharp/write-your-first-c-sharp-code', + trophy: + '/learn/foundational-c-sharp-with-microsoft/write-your-first-code-using-c-sharp/trophy-write-your-first-code-using-c-sharp' +}; + +describe('C Sharp Challenges', () => { + before(() => { + cy.visit(cSharpLocations.challenge); + }); + + it('renders the correct buttons', () => { + cy.get('.btn-primary').should('have.length', 2); + cy.contains('.btn-primary', 'Check your answer').should('be.visible'); + cy.contains('.btn-primary', 'Ask for Help').should('be.visible'); + }); +}); + +describe('C Sharp Trophy Challenges', () => { + before(() => { + cy.login(); + cy.visit(cSharpLocations.trophy); + }); + + it('renders the correct buttons', () => { + cy.get('.btn-primary').should('have.length', 3); + cy.contains('.btn-primary', 'Link Account').should('be.visible'); + cy.contains('.btn-primary', 'Verify Trophy').should('be.visible'); + cy.contains('.btn-primary', 'Ask for Help').should('be.visible'); + }); +}); diff --git a/tools/scripts/build/external-data-schema.js b/tools/scripts/build/external-data-schema.js index 8cc1b2e260b..0462e89ff2a 100644 --- a/tools/scripts/build/external-data-schema.js +++ b/tools/scripts/build/external-data-schema.js @@ -13,7 +13,8 @@ const blockSchema = Joi.object({}).keys({ 'JavaScript', 'HTML-CSS', 'Python', - 'Backend Development' + 'Backend Development', + 'C-Sharp' ), order: Joi.number(), time: Joi.string().allow(''),