Rename ConfigComponent -> Widget

This commit is contained in:
Ingvar Stepanyan
2021-07-19 16:39:36 +00:00
parent b12949ee98
commit e3aee15676

16
ui.js
View File

@@ -49,12 +49,12 @@ const scheduleOp = (() => {
* *
* @extends Component<{ config: Config }> * @extends Component<{ config: Config }>
*/ */
class ConfigComponent extends Component { class Widget extends Component {
state = { inProgress: false }; state = { inProgress: false };
shouldComponentUpdate( shouldComponentUpdate(
/** @type {ConfigComponent['props']} */ nextProps, /** @type {Widget['props']} */ nextProps,
/** @type {ConfigComponent['state']} */ nextState /** @type {Widget['state']} */ nextState
) { ) {
return !(this.state.inProgress && nextState.inProgress); return !(this.state.inProgress && nextState.inProgress);
} }
@@ -97,8 +97,8 @@ class ConfigComponent extends Component {
}; };
render( render(
/** @type {ConfigComponent['props']} */ { config }, /** @type {Widget['props']} */ { config },
/** @type {ConfigComponent['state']} */ { inProgress } /** @type {Widget['state']} */ { inProgress }
) { ) {
let { label, name } = config; let { label, name } = config;
let id = `config-${name}`; let id = `config-${name}`;
@@ -108,7 +108,7 @@ class ConfigComponent extends Component {
{ id }, { id },
h('legend', {}, label), h('legend', {}, label),
Object.values(config.children).map(config => Object.values(config.children).map(config =>
h(ConfigComponent, { key: config.name, config }) h(Widget, { key: config.name, config })
) )
); );
} }
@@ -243,7 +243,7 @@ class CaptureButton extends Component {
/** @extends Component<null, { config: string | Config }> */ /** @extends Component<null, { config: string | Config }> */
class Settings extends Component { class Settings extends Component {
state = { config: 'Connecting...' }; state = { config: '' };
constructor() { constructor() {
super(); super();
@@ -277,7 +277,7 @@ class Settings extends Component {
'form', 'form',
{ class: 'pure-form pure-form-aligned' }, { class: 'pure-form pure-form-aligned' },
h(CaptureButton, null), h(CaptureButton, null),
h(ConfigComponent, { config: state.config }) h(Widget, { config: state.config })
); );
} }
} }