diff --git a/client/src/templates/Challenges/classic/Editor.js b/client/src/templates/Challenges/classic/Editor.js index c3b0416906..58be74c501 100644 --- a/client/src/templates/Challenges/classic/Editor.js +++ b/client/src/templates/Challenges/classic/Editor.js @@ -127,6 +127,10 @@ class Editor extends Component { indexhtml: { model: null, state: null + }, + indexjsx: { + model: null, + state: null } }; @@ -281,6 +285,8 @@ class Editor extends Component { this.data.indexcss.state = currentState; } else if (currentModel === this.data.indexhtml.model) { this.data.indexhtml.state = currentState; + } else if (currentModel === this.data.indexjsx.model) { + this.data.indexjsx.state = currentState; } editor.setModel(this.data[fileKey].model); @@ -310,6 +316,14 @@ class Editor extends Component { }>
+ {challengeFiles['indexjsx'] && ( +
this.changeTab('indexjsx')} + > + script.jsx +
+ )} {challengeFiles['indexhtml'] && (
{ if (a.ext === 'html') return -1; if (b.ext === 'html') return 1; + if (a.ext === 'jsx') return -1; + if (b.ext === 'jsx') return 1; if (a.ext === 'js') return -1; if (b.ext === 'js') return 1; return 0; diff --git a/client/src/templates/Challenges/utils/sort-files.test.js b/client/src/templates/Challenges/utils/sort-files.test.js index 7a3175a235..5fe0c8cbc4 100644 --- a/client/src/templates/Challenges/utils/sort-files.test.js +++ b/client/src/templates/Challenges/utils/sort-files.test.js @@ -19,8 +19,9 @@ describe('sort-files', () => { it('should sort the objects into html, js, css order', () => { const sorted = sortFiles(challengeFiles); const sortedKeys = sorted.map(({ key }) => key); - const expected = ['indexhtml', 'indexjs', 'indexcss']; + const expected = ['indexhtml', 'indexjsx', 'indexjs', 'indexcss']; expect(sortedKeys).toStrictEqual(expected); }); + }); });