chore: use new c-sharp help category (#51417)

Co-authored-by: mot01 <tmondloch01@gmail.com>
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Naomi Carrigan
2023-09-11 10:46:51 -07:00
committed by GitHub
co-authored by mot01 Oliver Eyton-Williams
parent 3c6189ace0
commit e32a88a6db
13 changed files with 86 additions and 17 deletions
+2 -1
View File
@@ -27,6 +27,7 @@
"HTML-CSS": "HTML-CSS",
"JavaScript": "JavaScript",
"Python": "Python",
"Backend Development": "Backend Development"
"Backend Development": "Backend Development",
"C-Sharp": "C-Sharp"
}
}
@@ -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<MsTrophyProps> {
challengeMounted,
data: {
challengeNode: {
challenge: { title, challengeType }
challenge: { title, challengeType, helpCategory }
}
},
pageContext: { challengeMeta },
@@ -101,7 +104,8 @@ class MsTrophy extends Component<MsTrophyProps> {
updateChallengeMeta({
...challengeMeta,
title,
challengeType
challengeType,
helpCategory
});
challengeMounted(challengeMeta.id);
this._container?.focus();
@@ -119,7 +123,7 @@ class MsTrophy extends Component<MsTrophyProps> {
challengeMounted,
data: {
challengeNode: {
challenge: { title: currentTitle, challengeType }
challenge: { title: currentTitle, challengeType, helpCategory }
}
},
pageContext: { challengeMeta },
@@ -129,7 +133,8 @@ class MsTrophy extends Component<MsTrophyProps> {
updateChallengeMeta({
...challengeMeta,
title: currentTitle,
challengeType
challengeType,
helpCategory
});
challengeMounted(challengeMeta.id);
}
@@ -152,13 +157,15 @@ class MsTrophy extends Component<MsTrophyProps> {
instructions,
superBlock,
block,
translationPending
translationPending,
fields: { blockName }
}
}
},
isChallengeCompleted,
isProcessing,
msUsername,
openHelpModal,
pageContext: {
challengeMeta: { nextChallengePath, prevChallengePath }
},
@@ -204,10 +211,19 @@ class MsTrophy extends Component<MsTrophyProps> {
>
{t('buttons.verify-trophy')}
</Button>
<Button
block={true}
bsStyle='primary'
className='btn-invert'
onClick={openHelpModal}
>
{t('buttons.ask-for-help')}
</Button>
<br />
<Spacer size='medium' />
</Col>
<CompletionModal />
<HelpModal challengeTitle={title} challengeBlock={blockName} />
</Row>
</Container>
</LearnLayout>
@@ -231,9 +247,13 @@ export const query = graphql`
description
instructions
challengeType
helpCategory
superBlock
block
translationPending
fields {
blockName
}
}
}
}
+16 -2
View File
@@ -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<ShowVideoProps, ShowVideoState> {
videoId,
videoLocaleIds,
bilibiliIds,
fields: { blockName },
question: { text, answers, solution }
}
}
},
openCompletionModal,
openHelpModal,
pageContext: {
challengeMeta: { nextChallengePath, prevChallengePath }
},
@@ -293,7 +298,6 @@ class ShowVideo extends Component<ShowVideoProps, ShowVideoState> {
<Spacer size='medium' />
<Button
block={true}
bsSize='large'
bsStyle='primary'
onClick={() =>
this.handleSubmit(solution, openCompletionModal)
@@ -301,9 +305,18 @@ class ShowVideo extends Component<ShowVideoProps, ShowVideoState> {
>
{t('buttons.check-answer')}
</Button>
<Button
block={true}
bsStyle='primary'
className='btn-invert'
onClick={openHelpModal}
>
{t('buttons.ask-for-help')}
</Button>
<Spacer size='large' />
</Col>
<CompletionModal />
<HelpModal challengeTitle={title} challengeBlock={blockName} />
</Row>
</Container>
</LearnLayout>
@@ -341,6 +354,7 @@ export const query = graphql`
superBlock
block
fields {
blockName
slug
}
question {
@@ -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": "",
@@ -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": "",
@@ -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": "",
@@ -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": "",
@@ -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": "",
@@ -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": "",
@@ -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": "",
+2 -1
View File
@@ -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(),
@@ -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');
});
});
+2 -1
View File
@@ -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(''),