From a59b8636cb4388e8410450c11febe8c3223238f7 Mon Sep 17 00:00:00 2001 From: Ahmad Abdolsaheb Date: Thu, 29 Aug 2019 18:45:32 +0300 Subject: [PATCH] fix: restore preview background to white (#36714) --- .../src/templates/Challenges/components/preview.css | 1 + .../src/templates/Challenges/rechallenge/builders.js | 12 ++---------- .../templates/Challenges/rechallenge/displayStyle.js | 10 ---------- client/src/templates/Challenges/redux/index.js | 3 --- client/src/templates/Challenges/utils/build.js | 9 ++------- 5 files changed, 5 insertions(+), 30 deletions(-) delete mode 100644 client/src/templates/Challenges/rechallenge/displayStyle.js diff --git a/client/src/templates/Challenges/components/preview.css b/client/src/templates/Challenges/components/preview.css index 3168b7e3cf..4601370abb 100644 --- a/client/src/templates/Challenges/components/preview.css +++ b/client/src/templates/Challenges/components/preview.css @@ -5,6 +5,7 @@ padding: 0; margin: 0; border: none; + background-color: white; } .enable-iframe { diff --git a/client/src/templates/Challenges/rechallenge/builders.js b/client/src/templates/Challenges/rechallenge/builders.js index b11e904a54..6e20ab18bb 100644 --- a/client/src/templates/Challenges/rechallenge/builders.js +++ b/client/src/templates/Challenges/rechallenge/builders.js @@ -9,7 +9,6 @@ import { } from 'lodash'; import { compileHeadTail, setExt, transformContents } from '../utils/polyvinyl'; -import { nightThemeStyle } from './displayStyle.js'; const htmlCatch = '\n\n'; const jsCatch = '\n;/*fcc*/\n'; @@ -57,15 +56,8 @@ export const cssToHtml = cond([ [stubTrue, identity] ]); -export function concatHtml({ - required = [], - template, - files = [], - theme = 'night' -} = {}) { - theme = theme === '' ? 'night' : theme; +export function concatHtml({ required = [], template, files = [] } = {}) { const createBody = template ? _template(template) : defaultTemplate; - const displayTheme = theme === 'night' ? nightThemeStyle : ` `; const head = required .map(({ link, src }) => { if (link && src) { @@ -81,7 +73,7 @@ A required file can not have both a src and a link: src = ${src}, link = ${link} } return ''; }) - .reduce((head, element) => head.concat(element), displayTheme); + .reduce((head, element) => head.concat(element)); const source = files.reduce( (source, file) => source.concat(file.contents, htmlCatch), diff --git a/client/src/templates/Challenges/rechallenge/displayStyle.js b/client/src/templates/Challenges/rechallenge/displayStyle.js deleted file mode 100644 index 0c49520106..0000000000 --- a/client/src/templates/Challenges/rechallenge/displayStyle.js +++ /dev/null @@ -1,10 +0,0 @@ -export const nightThemeStyle = ` - -`; diff --git a/client/src/templates/Challenges/redux/index.js b/client/src/templates/Challenges/redux/index.js index e0ffa12a58..7d427d0085 100644 --- a/client/src/templates/Challenges/redux/index.js +++ b/client/src/templates/Challenges/redux/index.js @@ -15,7 +15,6 @@ import { createIdToNameMapSaga } from './id-to-name-map-saga'; import { createExecuteChallengeSaga } from './execute-challenge-saga'; import { createCurrentChallengeSaga } from './current-challenge-saga'; import { challengeTypes } from '../../../../utils/challengeTypes'; -import { userSelector } from '../../../redux'; export const ns = 'challenge'; export const backendNS = 'backendChallenge'; @@ -183,7 +182,6 @@ export const projectFormValuesSelector = state => state[ns].projectFormValues || {}; export const challengeDataSelector = state => { - const { theme } = userSelector(state); const { challengeType } = challengeMetaSelector(state); let challengeData = { challengeType }; if ( @@ -225,7 +223,6 @@ export const challengeDataSelector = state => { template }; } - challengeData.theme = theme; return challengeData; }; diff --git a/client/src/templates/Challenges/utils/build.js b/client/src/templates/Challenges/utils/build.js index 7d26b52762..46aafdbf37 100644 --- a/client/src/templates/Challenges/utils/build.js +++ b/client/src/templates/Challenges/utils/build.js @@ -108,12 +108,7 @@ async function getDOMTestRunner(buildData, proxyLogger, document) { runTestInTestFrame(document, testString, testTimeout); } -export function buildDOMChallenge({ - files, - required = [], - template = '', - theme = `` -}) { +export function buildDOMChallenge({ files, required = [], template = '' }) { const finalRequires = [...globalRequires, ...required, ...frameRunner]; const loadEnzyme = Object.keys(files).some(key => files[key].ext === 'jsx'); const toHtml = [jsToHtml, cssToHtml]; @@ -125,7 +120,7 @@ export function buildDOMChallenge({ .then(checkFilesErrors) .then(files => ({ challengeType: challengeTypes.html, - build: concatHtml({ required: finalRequires, template, files, theme }), + build: concatHtml({ required: finalRequires, template, files }), sources: buildSourceMap(files), loadEnzyme }));