Skip to content

Commit 9797bcf

Browse files
authored
feat(learn): add blockType to block meta (freeCodeCamp#55568)
1 parent d5f109a commit 9797bcf

File tree

12 files changed

+53
-1
lines changed

12 files changed

+53
-1
lines changed

client/gatsby-node.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ exports.createPages = async function createPages({
7676
node {
7777
challenge {
7878
block
79+
blockType
7980
certification
8081
challengeType
8182
dashedName
@@ -263,6 +264,7 @@ exports.createSchemaCustomization = ({ actions }) => {
263264
challenge: Challenge
264265
}
265266
type Challenge {
267+
blockType: String
266268
challengeFiles: [FileContents]
267269
notes: String
268270
url: String

client/i18n/locales/english/translations.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,14 @@
512512
"link-li-6": "Click \"Link Account\" to link your Microsoft username.",
513513
"transcript-label": "Your Microsoft Transcript Link",
514514
"invalid-transcript": "Your transcript link is not correct, it should have the following form: <1>https://learn.microsoft.com/LOCALE/users/USERNAME/transcript/ID</1> - check the UPPERCASE items in your link are correct."
515+
},
516+
"blockType": {
517+
"lecture": "Lecture",
518+
"workshop": "Workshop",
519+
"lab": "Lab",
520+
"review": "Review",
521+
"quiz": "Quiz",
522+
"exam": "Exam"
515523
}
516524
},
517525
"donate": {

client/src/redux/prop-types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { HandlerProps } from 'react-reflex';
22
import { SuperBlocks } from '../../../shared/config/curriculum';
3+
import { BlockTypes } from '../../../shared/config/blocks';
34
import { Themes } from '../components/settings/theme';
45
import { type CertTitle } from '../../config/cert-and-project-map';
56

@@ -178,6 +179,7 @@ export type ChallengeWithCompletedNode = {
178179
export type ChallengeNode = {
179180
challenge: {
180181
block: string;
182+
blockType: BlockTypes;
181183
certification: string;
182184
challengeOrder: number;
183185
challengeType: number;

curriculum/challenges/_meta/front-end-development-certification-exam/meta.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "Front End Development Certification Exam",
3+
"blockType": "exam",
34
"isUpcomingChange": true,
45
"dashedName": "front-end-development-certification-exam",
56
"helpCategory": "HTML-CSS",
6-
"order": 387,
7+
"order": 386,
78
"superBlock": "front-end-development",
89
"challengeOrder": [
910
{

curriculum/challenges/_meta/lab-recipe-page/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "Recipe Page",
3+
"blockType": "lab",
34
"isUpcomingChange": true,
45
"usesMultifileEditor": true,
56
"dashedName": "lab-recipe-page",

curriculum/challenges/_meta/workshop-blog-page/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "Build a Cat Blog Page",
3+
"blockType": "workshop",
34
"isUpcomingChange": true,
45
"usesMultifileEditor": true,
56
"hasEditableBoundaries": true,

curriculum/challenges/_meta/workshop-cat-photo-app/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "Build a Cat Photo App",
3+
"blockType": "workshop",
34
"isUpcomingChange": true,
45
"usesMultifileEditor": true,
56
"hasEditableBoundaries": true,

curriculum/get-challenges.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ function generateChallengeCreator(lang, englishPath, i18nPath) {
277277
);
278278

279279
challenge.block = meta.dashedName;
280+
challenge.blockType = meta.blockType;
280281
challenge.hasEditableBoundaries = !!meta.hasEditableBoundaries;
281282
challenge.order = meta.order;
282283
// const superOrder = getSuperOrder(meta.superBlock);

curriculum/schema/__snapshots__/challenge-schema.test.js.snap

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ exports[`challenge schema Notify mobile team BEFORE updating snapshot 1`] = `
55
Joi.objectId = require('joi-objectid')(Joi);
66
77
const { challengeTypes } = require('../../shared/config/challenge-types');
8+
const { SuperBlocks } = require('../../shared/config/curriculum');
89
const {
910
availableCharacters,
1011
availableBackgrounds,
@@ -88,6 +89,18 @@ const schema = Joi.object()
8889
.keys({
8990
block: Joi.string().regex(slugRE).required(),
9091
blockId: Joi.objectId(),
92+
blockType: Joi.when('superBlock', {
93+
is: [SuperBlocks.FrontEndDevelopment],
94+
then: Joi.valid(
95+
'workshop',
96+
'lab',
97+
'lecture',
98+
'review',
99+
'quiz',
100+
'exam'
101+
).required(),
102+
otherwise: Joi.valid(null)
103+
}),
91104
challengeOrder: Joi.number(),
92105
certification: Joi.string().regex(slugWithSlashRE),
93106
challengeType: Joi.number().min(0).max(23).required(),

curriculum/schema/challenge-schema.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const Joi = require('joi');
22
Joi.objectId = require('joi-objectid')(Joi);
33

44
const { challengeTypes } = require('../../shared/config/challenge-types');
5+
const { SuperBlocks } = require('../../shared/config/curriculum');
56
const {
67
availableCharacters,
78
availableBackgrounds,
@@ -85,6 +86,18 @@ const schema = Joi.object()
8586
.keys({
8687
block: Joi.string().regex(slugRE).required(),
8788
blockId: Joi.objectId(),
89+
blockType: Joi.when('superBlock', {
90+
is: [SuperBlocks.FrontEndDevelopment],
91+
then: Joi.valid(
92+
'workshop',
93+
'lab',
94+
'lecture',
95+
'review',
96+
'quiz',
97+
'exam'
98+
).required(),
99+
otherwise: Joi.valid(null)
100+
}),
88101
challengeOrder: Joi.number(),
89102
certification: Joi.string().regex(slugWithSlashRE),
90103
challengeType: Joi.number().min(0).max(23).required(),

0 commit comments

Comments
 (0)