From 29725026eea8c96c0703cc06c3c593ff9533b634 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Mon, 12 Nov 2018 18:22:31 +0530 Subject: [PATCH] Fix settings updation for switches --- src/components/Settings.jsx | 474 +++++++++++++++++++----------------- src/components/Switch.jsx | 7 +- src/components/Tabs.jsx | 1 + src/components/app.jsx | 11 +- src/style.css | 6 +- 5 files changed, 261 insertions(+), 238 deletions(-) diff --git a/src/components/Settings.jsx b/src/components/Settings.jsx index 10fb298..5c918a8 100644 --- a/src/components/Settings.jsx +++ b/src/components/Settings.jsx @@ -4,33 +4,22 @@ import Switch from './Switch'; import Tabs, { TabPanel } from './Tabs'; import { Divider } from './common'; -function CheckboxSetting({ - title, - label, - onChange, - pref, - name, - showWhenExtension -}) { +function CheckboxSetting({ label, onChange, pref }) { return ( - // - {label} + + {label} + ); } export default class Settings extends Component { - updateSetting(e) { - this.props.onChange(e); + updateSetting(e, settingName) { + const value = + e.target.type === 'checkbox' ? e.target.checked : e.target.value; + this.props.onChange(settingName, value); } shouldComponentUpdate() { // TODO: add check on prefs @@ -45,295 +34,322 @@ export default class Settings extends Component { this.updateSetting(e, 'preserveLastCode')} /> +

+ Loads the last open creation when app starts +

this.updateSetting(e, 'lightVersion')} /> +

+ Switch to lighter version for better performance. Removes things + like blur etc. +

this.updateSetting(e, 'autoPreview')} /> +

+ Refreshes the preview as you code. Otherwise use the Run button +

this.updateSetting(e, 'autoSave')} /> +

+ Auto-save keeps saving your code at regular intervals after you + hit the first save manually +

this.updateSetting(e, 'refreshOnResize')} /> +

+ Preview will refresh when you resize the preview pane +

+ +
+ this.updateSetting(e, 'replaceNewTab')} + showWhenExtension + /> +

+ Turning this on will start showing Web Maker in every new tab + you open +

+
this.updateSetting(e, 'preserveConsoleLogs')} /> +

+ Preserves the console logs across your preview refreshes +

-
- - +
+
+ + +
- -
- - - +
+ Default Preprocessors +
+ + + +
+ + + + + + +
Key bindings - - +
+ + +
+ +
this.updateSetting(e, 'lineWrap')} /> + - - this.updateSetting(e, 'autoComplete')} />
this.updateSetting(e, 'isCodeBlastOn')} /> +

+ Enjoy wonderful particle blasts while you type +

this.updateSetting(e, 'isJs13kModeOn')} /> +

+ Make the app ready to build some games for{' '} + + Js13kGames + . +

-

-

+ -
+

If any loop iteration takes more than the defined time, it is detected as a potential infinite loop and further iterations are stopped. -

-

+

+
+ -

+

-

+
diff --git a/src/components/Switch.jsx b/src/components/Switch.jsx index d9a3ebb..b56c282 100644 --- a/src/components/Switch.jsx +++ b/src/components/Switch.jsx @@ -4,7 +4,12 @@ export default class Switch extends Component { render() { return (