fix: have console open for all JS challenges (#58808)

This commit is contained in:
Oliver Eyton-Williams
2025-02-15 04:43:38 +01:00
committed by GitHub
parent 40958082ce
commit ceb0e60460
2 changed files with 6 additions and 3 deletions

View File

@@ -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({
<Output defaultOutput={defaultOutput} output={output} />
}
windowTitle={windowTitle}
startWithConsoleShown={showConsole}
startWithConsoleShown={openConsole}
/>
)}
<CompletionModal />

View File

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