feat(client): show demo on demand in labs (#55569)

Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
Oliver Eyton-Williams
2024-08-13 14:56:19 +02:00
committed by GitHub
parent 7b05b89d03
commit b9893bb4d6
51 changed files with 108 additions and 44 deletions
+2 -15
View File
@@ -1,9 +1,6 @@
const path = require('path');
const { sortChallengeFiles } = require('../sort-challengefiles');
const {
challengeTypes,
viewTypes
} = require('../../../shared/config/challenge-types');
const { viewTypes } = require('../../../shared/config/challenge-types');
const backend = path.resolve(
__dirname,
@@ -150,8 +147,7 @@ exports.createChallengePages = function (createPage) {
// it during the curriculum build process and attach it to the first challenge?
// That would remove the need to analyse allChallengeEdges.
function getProjectPreviewConfig(challenge, allChallengeEdges) {
const { block, challengeOrder, challengeType, usesMultifileEditor } =
challenge;
const { block } = challenge;
const challengesInBlock = allChallengeEdges
.filter(({ node: { challenge } }) => challenge.block === block)
@@ -169,15 +165,6 @@ function getProjectPreviewConfig(challenge, allChallengeEdges) {
}));
return {
showProjectPreview:
challengeOrder === 0 &&
usesMultifileEditor &&
// TODO: handle the special cases better. Create a meta property for
// showProjectPreview, maybe? Then we can remove all the following cases
challengeType !== challengeTypes.multifileCertProject &&
challengeType !== challengeTypes.multifilePythonCertProject &&
challengeType !== challengeTypes.python &&
challengeType !== challengeTypes.js,
challengeData: {
challengeType: lastChallenge.challengeType,
challengeFiles: projectPreviewChallengeFiles