diff --git a/client/src/templates/Challenges/classic/show.tsx b/client/src/templates/Challenges/classic/show.tsx index c51e506f30a..8d95496020b 100644 --- a/client/src/templates/Challenges/classic/show.tsx +++ b/client/src/templates/Challenges/classic/show.tsx @@ -63,6 +63,7 @@ import { preloadPage } from '../../../../utils/gatsby/page-loading'; import envData from '../../../../config/env.json'; import ToolPanel from '../components/tool-panel'; import { getChallengePaths } from '../utils/challenge-paths'; +import { isJavaScriptChallenge } from '../utils/build'; import { XtermTerminal } from './xterm'; import MultifileEditor from './multifile-editor'; import DesktopLayout from './desktop-layout'; @@ -240,7 +241,7 @@ function ShowClassic({ `intro:${superBlock}.blocks.${block}.title` )}: ${title}`; const windowTitle = `${blockNameTitle} | freeCodeCamp.org`; - const showConsole = challengeType === challengeTypes.js; + const openConsole = isJavaScriptChallenge({ challengeType }); // TODO: show preview should NOT be computed like this. That determination is // made during the build (at least twice!). It should be either a prop or // computed from challengeType @@ -519,7 +520,7 @@ function ShowClassic({ } windowTitle={windowTitle} - startWithConsoleShown={showConsole} + startWithConsoleShown={openConsole} /> )} diff --git a/client/src/templates/Challenges/utils/build.ts b/client/src/templates/Challenges/utils/build.ts index 6a7f62dfca7..8bbf1b9952a 100644 --- a/client/src/templates/Challenges/utils/build.ts +++ b/client/src/templates/Challenges/utils/build.ts @@ -406,7 +406,9 @@ export function challengeHasPreview({ challengeType }: ChallengeMeta): boolean { export function isJavaScriptChallenge({ challengeType -}: ChallengeMeta): boolean { +}: { + challengeType: number; +}): boolean { return ( challengeType === challengeTypes.js || challengeType === challengeTypes.jsProject