feat(learn): add blockType to block meta (#55568)

This commit is contained in:
Tom
2024-08-09 08:40:58 -05:00
committed by GitHub
parent d5f109ac4e
commit 9797bcf89a
12 changed files with 53 additions and 1 deletions

View File

@@ -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

View File

@@ -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</1> - check the UPPERCASE items in your link are correct."
},
"blockType": {
"lecture": "Lecture",
"workshop": "Workshop",
"lab": "Lab",
"review": "Review",
"quiz": "Quiz",
"exam": "Exam"
}
},
"donate": {

View File

@@ -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;

View File

@@ -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": [
{

View File

@@ -1,5 +1,6 @@
{
"name": "Recipe Page",
"blockType": "lab",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"dashedName": "lab-recipe-page",

View File

@@ -1,5 +1,6 @@
{
"name": "Build a Cat Blog Page",
"blockType": "workshop",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"hasEditableBoundaries": true,

View File

@@ -1,5 +1,6 @@
{
"name": "Build a Cat Photo App",
"blockType": "workshop",
"isUpcomingChange": true,
"usesMultifileEditor": true,
"hasEditableBoundaries": true,

View File

@@ -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);

View File

@@ -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(),

View File

@@ -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(),

View File

@@ -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(),

8
shared/config/blocks.ts Normal file
View File

@@ -0,0 +1,8 @@
export enum BlockTypes {
lecture = 'lecture',
workshop = 'workshop',
lab = 'lab',
review = 'review',
quiz = 'quiz',
exam = 'exam'
}