mirror of
				https://github.com/zulip/zulip-desktop.git
				synced 2025-11-04 05:53:21 +00:00 
			
		
		
		
	And enable the import/unambiguous ESLint rule as a check on our
partition between scripts and modules.  After this commit, if you add
a new file and get this error:
  ✖  1:1  This module could be parsed as a valid script.  import/unambiguous
* For a module, add an `import` or `export` declaration to make the
  file unambiguously a module (the empty `export {};` declaration
  suffices).
* For a script, add the file to the xo overrides section of
  package.json that marks it "sourceType": "script", and add a 'use
  strict' declaration.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
		
	
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { ipcRenderer } from 'electron';
 | 
						|
 | 
						|
import BaseComponent from '../../components/base';
 | 
						|
 | 
						|
export default class BaseSection extends BaseComponent {
 | 
						|
	// TODO: TypeScript - Here props should be object type
 | 
						|
	generateSettingOption(props: any): void {
 | 
						|
		const {$element, disabled, value, clickHandler} = props;
 | 
						|
 | 
						|
		$element.innerHTML = '';
 | 
						|
 | 
						|
		const $optionControl = this.generateNodeFromTemplate(this.generateOptionTemplate(value, disabled));
 | 
						|
		$element.append($optionControl);
 | 
						|
 | 
						|
		if (!disabled) {
 | 
						|
			$optionControl.addEventListener('click', clickHandler);
 | 
						|
		}
 | 
						|
	}
 | 
						|
 | 
						|
	generateOptionTemplate(settingOption: boolean, disabled: boolean): string {
 | 
						|
		const label = disabled ? '<label class="disallowed" title="Setting locked by system administrator."/>' : '<label/>';
 | 
						|
		if (settingOption) {
 | 
						|
			return `
 | 
						|
				<div class="action">
 | 
						|
					<div class="switch">
 | 
						|
					  <input class="toggle toggle-round" type="checkbox" checked disabled>
 | 
						|
					  ${label}
 | 
						|
					</div>
 | 
						|
				</div>
 | 
						|
			`;
 | 
						|
		} else {
 | 
						|
			return `
 | 
						|
				<div class="action">
 | 
						|
					<div class="switch">
 | 
						|
					  <input class="toggle toggle-round" type="checkbox">
 | 
						|
					  ${label}
 | 
						|
					</div>
 | 
						|
				</div>
 | 
						|
			`;
 | 
						|
		}
 | 
						|
	}
 | 
						|
 | 
						|
	reloadApp(): void {
 | 
						|
		ipcRenderer.send('forward-message', 'reload-viewer');
 | 
						|
	}
 | 
						|
}
 |