Cleanup settings-web (#280)

This commit is contained in:
Alaric von Teplitz
2019-09-09 04:47:18 -07:00
committed by Bartosz Sosnowski
parent 5f5402aa0a
commit ffa1b1e6a3
10 changed files with 35 additions and 64 deletions

View File

@@ -1,25 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<script>
window.output_from_webview = function(arg) {
if (typeof (window.external) !== 'undefined' && ('notify' in window.external)) {
window.external.notify(arg);
}
}
function receive_from_settings_app(arg) {
window.react_app_component.receive_config_msg(JSON.parse(arg));
return "";
}
function exit_settings_app() {
window.react_app_component.receive_exit_request();
return "";
}
</script>
<title>PowerToys Settings</title>
</head>
<body>
<div id="app"></div>
<script src="dist/bundle.js" charset="UTF-8"></script>
</body>
</html>

View File

@@ -2,21 +2,21 @@
<html> <html>
<head> <head>
<script> <script>
window.output_from_webview = function(arg) { window.output_from_webview = function(arg) {
if (typeof (window.external) !== 'undefined' && ('notify' in window.external)) { if (typeof (window.external) !== 'undefined' && ('notify' in window.external)) {
window.external.notify(arg); window.external.notify(arg);
}
} }
function receive_from_settings_app(arg) { }
window.react_app_component.receive_config_msg(JSON.parse(arg)); function receive_from_settings_app(arg) {
return ""; window.react_app_component.receive_config_msg(JSON.parse(arg));
} return '';
function exit_settings_app() { }
window.react_app_component.receive_exit_request(); function exit_settings_app() {
return ""; window.react_app_component.receive_exit_request();
} return '';
</script> }
<title>PowerToys Settings</title> </script>
<title>PowerToys Settings</title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View File

@@ -10,4 +10,3 @@ export class BaseSettingsControl extends React.Component <any, any> {
return null; return null;
} }
} }

View File

@@ -17,7 +17,6 @@ export class BoolToggleSettingsControl extends BaseSettingsControl {
this.setState({ property_values: props.setting }) this.setState({ property_values: props.setting })
} }
public get_value() : any { public get_value() : any {
return {value: this.toggleref.checked}; return {value: this.toggleref.checked};
} }
@@ -45,5 +44,4 @@ export class BoolToggleSettingsControl extends BaseSettingsControl {
/> />
); );
} }
} }

View File

@@ -41,5 +41,4 @@ export class ColorPickerSettingsControl extends BaseSettingsControl {
</Stack> </Stack>
); );
} }
} }

View File

@@ -19,12 +19,13 @@ export class CustomSettingsScreen extends React.Component <any, any> {
powertoy: props.powertoy, powertoy: props.powertoy,
} }
} }
shouldComponentUpdate(nextProps:any, nextState:any)
{ shouldComponentUpdate(nextProps:any, nextState:any) {
// This component and its children manage their state. // This component and its children manage their state.
// React only to state changes when forceUpdate is called by the App component. // React only to state changes when forceUpdate is called by the App component.
return false; return false;
} }
componentWillReceiveProps(props: any) { componentWillReceiveProps(props: any) {
this.setState({ powertoy: props.powertoy }) this.setState({ powertoy: props.powertoy })
} }
@@ -99,7 +100,7 @@ export class CustomSettingsScreen extends React.Component <any, any> {
(power_toys_properties[b].order || 0) (power_toys_properties[b].order || 0)
) )
}). }).
map( (key) => { map((key) => {
switch(power_toys_properties[key].editor_type) { switch(power_toys_properties[key].editor_type) {
case 'bool_toggle': case 'bool_toggle':
return <BoolToggleSettingsControl return <BoolToggleSettingsControl

View File

@@ -17,12 +17,13 @@ export class GeneralSettings extends React.Component <any, any> {
settings: props.settings, settings: props.settings,
} }
} }
shouldComponentUpdate(nextProps:any, nextState:any)
{ shouldComponentUpdate(nextProps:any, nextState:any) {
// This component and its children manage their state. // This component and its children manage their state.
// React only to state changes when forceUpdate is called by the App component. // React only to state changes when forceUpdate is called by the App component.
return false; return false;
} }
componentWillReceiveProps(props: any) { componentWillReceiveProps(props: any) {
this.setState({ settings: props.settings }) this.setState({ settings: props.settings })
} }

View File

@@ -95,5 +95,4 @@ export class IntSpinnerSettingsControl extends BaseSettingsControl {
/> />
); );
} }
} }

View File

@@ -26,4 +26,3 @@ if (root && root.hasChildNodes()) {
/>, />,
root); root);
} }