mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-10-24 00:23:36 +00:00
53 lines
1.4 KiB
JavaScript
53 lines
1.4 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="onoffswitch">
|
|
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" checked>
|
|
<label class="onoffswitch-label" for="myonoffswitch">
|
|
<span class="onoffswitch-inner"></span>
|
|
<span class="onoffswitch-switch"></span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
`;
|
|
} else {
|
|
return `
|
|
<div class="action">
|
|
<div class="onoffswitch">
|
|
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" >
|
|
<label class="onoffswitch-label" for="myonoffswitch">
|
|
<span class="onoffswitch-inner"></span>
|
|
<span class="onoffswitch-switch"></span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
`;
|
|
}
|
|
}
|
|
|
|
reloadApp() {
|
|
ipcRenderer.send('forward-message', 'reload-viewer');
|
|
}
|
|
}
|
|
|
|
module.exports = BaseSection;
|