diff --git a/client/gatsby-node.js b/client/gatsby-node.js index 02667be7a4c..22697616d9e 100644 --- a/client/gatsby-node.js +++ b/client/gatsby-node.js @@ -76,6 +76,7 @@ exports.createPages = async function createPages({ node { challenge { block + blockType certification challengeType dashedName @@ -263,6 +264,7 @@ exports.createSchemaCustomization = ({ actions }) => { challenge: Challenge } type Challenge { + blockType: String challengeFiles: [FileContents] notes: String url: String diff --git a/client/i18n/locales/english/translations.json b/client/i18n/locales/english/translations.json index bb6971e6e4b..f4c9dea4336 100644 --- a/client/i18n/locales/english/translations.json +++ b/client/i18n/locales/english/translations.json @@ -512,6 +512,14 @@ "link-li-6": "Click \"Link Account\" to link your Microsoft username.", "transcript-label": "Your Microsoft Transcript Link", "invalid-transcript": "Your transcript link is not correct, it should have the following form: <1>https://learn.microsoft.com/LOCALE/users/USERNAME/transcript/ID - check the UPPERCASE items in your link are correct." + }, + "blockType": { + "lecture": "Lecture", + "workshop": "Workshop", + "lab": "Lab", + "review": "Review", + "quiz": "Quiz", + "exam": "Exam" } }, "donate": { diff --git a/client/src/redux/prop-types.ts b/client/src/redux/prop-types.ts index 72b5f053ed1..e3582b66d68 100644 --- a/client/src/redux/prop-types.ts +++ b/client/src/redux/prop-types.ts @@ -1,5 +1,6 @@ import { HandlerProps } from 'react-reflex'; import { SuperBlocks } from '../../../shared/config/curriculum'; +import { BlockTypes } from '../../../shared/config/blocks'; import { Themes } from '../components/settings/theme'; import { type CertTitle } from '../../config/cert-and-project-map'; @@ -178,6 +179,7 @@ export type ChallengeWithCompletedNode = { export type ChallengeNode = { challenge: { block: string; + blockType: BlockTypes; certification: string; challengeOrder: number; challengeType: number; diff --git a/curriculum/challenges/_meta/front-end-development-certification-exam/meta.json b/curriculum/challenges/_meta/front-end-development-certification-exam/meta.json index b71f85efce9..8394154babe 100644 --- a/curriculum/challenges/_meta/front-end-development-certification-exam/meta.json +++ b/curriculum/challenges/_meta/front-end-development-certification-exam/meta.json @@ -1,9 +1,10 @@ { "name": "Front End Development Certification Exam", + "blockType": "exam", "isUpcomingChange": true, "dashedName": "front-end-development-certification-exam", "helpCategory": "HTML-CSS", - "order": 387, + "order": 386, "superBlock": "front-end-development", "challengeOrder": [ { diff --git a/curriculum/challenges/_meta/lab-recipe-page/meta.json b/curriculum/challenges/_meta/lab-recipe-page/meta.json index 119e1cf0712..983c0cb84d9 100644 --- a/curriculum/challenges/_meta/lab-recipe-page/meta.json +++ b/curriculum/challenges/_meta/lab-recipe-page/meta.json @@ -1,5 +1,6 @@ { "name": "Recipe Page", + "blockType": "lab", "isUpcomingChange": true, "usesMultifileEditor": true, "dashedName": "lab-recipe-page", diff --git a/curriculum/challenges/_meta/workshop-blog-page/meta.json b/curriculum/challenges/_meta/workshop-blog-page/meta.json index 7778bfaf6f3..359061d1cf8 100644 --- a/curriculum/challenges/_meta/workshop-blog-page/meta.json +++ b/curriculum/challenges/_meta/workshop-blog-page/meta.json @@ -1,5 +1,6 @@ { "name": "Build a Cat Blog Page", + "blockType": "workshop", "isUpcomingChange": true, "usesMultifileEditor": true, "hasEditableBoundaries": true, diff --git a/curriculum/challenges/_meta/workshop-cat-photo-app/meta.json b/curriculum/challenges/_meta/workshop-cat-photo-app/meta.json index a1639ff221d..7d7c71bcbf8 100644 --- a/curriculum/challenges/_meta/workshop-cat-photo-app/meta.json +++ b/curriculum/challenges/_meta/workshop-cat-photo-app/meta.json @@ -1,5 +1,6 @@ { "name": "Build a Cat Photo App", + "blockType": "workshop", "isUpcomingChange": true, "usesMultifileEditor": true, "hasEditableBoundaries": true, diff --git a/curriculum/get-challenges.js b/curriculum/get-challenges.js index 22fc608a84a..6fb95c80892 100644 --- a/curriculum/get-challenges.js +++ b/curriculum/get-challenges.js @@ -277,6 +277,7 @@ function generateChallengeCreator(lang, englishPath, i18nPath) { ); challenge.block = meta.dashedName; + challenge.blockType = meta.blockType; challenge.hasEditableBoundaries = !!meta.hasEditableBoundaries; challenge.order = meta.order; // const superOrder = getSuperOrder(meta.superBlock); diff --git a/curriculum/schema/__snapshots__/challenge-schema.test.js.snap b/curriculum/schema/__snapshots__/challenge-schema.test.js.snap index b6d946fb0b4..2dbc7870cdd 100644 --- a/curriculum/schema/__snapshots__/challenge-schema.test.js.snap +++ b/curriculum/schema/__snapshots__/challenge-schema.test.js.snap @@ -5,6 +5,7 @@ exports[`challenge schema Notify mobile team BEFORE updating snapshot 1`] = ` Joi.objectId = require('joi-objectid')(Joi); const { challengeTypes } = require('../../shared/config/challenge-types'); +const { SuperBlocks } = require('../../shared/config/curriculum'); const { availableCharacters, availableBackgrounds, @@ -88,6 +89,18 @@ const schema = Joi.object() .keys({ block: Joi.string().regex(slugRE).required(), blockId: Joi.objectId(), + blockType: Joi.when('superBlock', { + is: [SuperBlocks.FrontEndDevelopment], + then: Joi.valid( + 'workshop', + 'lab', + 'lecture', + 'review', + 'quiz', + 'exam' + ).required(), + otherwise: Joi.valid(null) + }), challengeOrder: Joi.number(), certification: Joi.string().regex(slugWithSlashRE), challengeType: Joi.number().min(0).max(23).required(), diff --git a/curriculum/schema/challenge-schema.js b/curriculum/schema/challenge-schema.js index e78a2eaffee..1b302632dfb 100644 --- a/curriculum/schema/challenge-schema.js +++ b/curriculum/schema/challenge-schema.js @@ -2,6 +2,7 @@ const Joi = require('joi'); Joi.objectId = require('joi-objectid')(Joi); const { challengeTypes } = require('../../shared/config/challenge-types'); +const { SuperBlocks } = require('../../shared/config/curriculum'); const { availableCharacters, availableBackgrounds, @@ -85,6 +86,18 @@ const schema = Joi.object() .keys({ block: Joi.string().regex(slugRE).required(), blockId: Joi.objectId(), + blockType: Joi.when('superBlock', { + is: [SuperBlocks.FrontEndDevelopment], + then: Joi.valid( + 'workshop', + 'lab', + 'lecture', + 'review', + 'quiz', + 'exam' + ).required(), + otherwise: Joi.valid(null) + }), challengeOrder: Joi.number(), certification: Joi.string().regex(slugWithSlashRE), challengeType: Joi.number().min(0).max(23).required(), diff --git a/curriculum/schema/meta-schema.js b/curriculum/schema/meta-schema.js index 17ab40b32fc..0be69d53776 100644 --- a/curriculum/schema/meta-schema.js +++ b/curriculum/schema/meta-schema.js @@ -6,6 +6,7 @@ const slugWithSlashRE = new RegExp('^[a-z0-9-/]+$'); const schema = Joi.object() .keys({ name: Joi.string().required(), + blockType: Joi.valid('workshop', 'lab', 'lecture', 'quiz', 'exam'), isUpcomingChange: Joi.boolean().required(), dashedName: Joi.string().regex(slugRE).required(), superBlock: Joi.string().regex(slugWithSlashRE).required(), diff --git a/shared/config/blocks.ts b/shared/config/blocks.ts new file mode 100644 index 00000000000..15b61094b6e --- /dev/null +++ b/shared/config/blocks.ts @@ -0,0 +1,8 @@ +export enum BlockTypes { + lecture = 'lecture', + workshop = 'workshop', + lab = 'lab', + review = 'review', + quiz = 'quiz', + exam = 'exam' +}