mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-10-23 16:13:37 +00:00
47 lines
1.0 KiB
JavaScript
47 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
const {ipcRenderer} = require('electron');
|
|
|
|
const BaseComponent = require(__dirname + '/../../components/base.js');
|
|
|
|
class BaseSection extends BaseComponent {
|
|
generateSettingOption(props) {
|
|
const {$element, value, clickHandler} = props;
|
|
|
|
$element.innerHTML = '';
|
|
|
|
const $optionControl = this.generateNodeFromTemplate(this.generateOptionTemplate(value));
|
|
$element.appendChild($optionControl);
|
|
|
|
$optionControl.addEventListener('click', clickHandler);
|
|
}
|
|
|
|
generateOptionTemplate(settingOption) {
|
|
if (settingOption) {
|
|
return `
|
|
<div class="action">
|
|
<div class="switch">
|
|
<input class="toggle toggle-round" type="checkbox" checked>
|
|
<label></label>
|
|
</div>
|
|
</div>
|
|
`;
|
|
} else {
|
|
return `
|
|
<div class="action">
|
|
<div class="switch">
|
|
<input class="toggle toggle-round" type="checkbox">
|
|
<label></label>
|
|
</div>
|
|
</div>
|
|
`;
|
|
}
|
|
}
|
|
|
|
reloadApp() {
|
|
ipcRenderer.send('forward-message', 'reload-viewer');
|
|
}
|
|
}
|
|
|
|
module.exports = BaseSection;
|