diff --git a/apps/remix-ide/src/app/tabs/settings-tab.js b/apps/remix-ide/src/app/tabs/settings-tab.js index dd3af33346..a3f5645bb0 100644 --- a/apps/remix-ide/src/app/tabs/settings-tab.js +++ b/apps/remix-ide/src/app/tabs/settings-tab.js @@ -34,12 +34,17 @@ module.exports = class SettingsTab extends ViewPlugin { this._view = { /* eslint-disable */ el: null, optionVM: null, + optionVMLabel: null, personal: null, + personalLabel: null, warnPersonalMode: null, generateContractMetadata: null, + generateContractMetadataLabel: null, config: { general: null, themes: null - } + }, + textWrap: null, + textWrapLabel: null } /* eslint-enable */ this.event = new EventManager() } @@ -53,8 +58,8 @@ module.exports = class SettingsTab extends ViewPlugin { return yo`
${themes.map((aTheme) => { let el = yo`
- { onswitchTheme(event, aTheme.name) }} class="align-middle form-check-input" name="theme" id="${aTheme.name}" data-id="settingsTabTheme${aTheme.name}" > - + { onswitchTheme(event, aTheme.name) }} class="align-middle form-check-input custom-control-input" name="theme" id="${aTheme.name}" data-id="settingsTabTheme${aTheme.name}" > +
` if (this._deps.themeModule.active === aTheme.name) el.querySelector('input').setAttribute('checked', 'checked') return el @@ -73,28 +78,48 @@ module.exports = class SettingsTab extends ViewPlugin { if (token) gistAccessToken.value = token const removeToken = () => { self.config.set('settings/gist-access-token', ''); gistAccessToken.value = ''; tooltip('Access token removed') } const saveToken = () => { this.config.set('settings/gist-access-token', gistAccessToken.value); tooltip('Access token saved') } - const gistAddToken = yo` saveToken()} value="Save" type="button">` - const gistRemoveToken = yo`` - this._view.gistToken = yo`
${gistAccessToken}
${copyToClipboard(() => gistAccessToken.value)}${gistAddToken}${gistRemoveToken}
` + const gistAddToken = yo` saveToken()} value="Save" type="button">` + const gistRemoveToken = yo`` + this._view.gistToken = yo`
${gistAccessToken}
${copyToClipboard(() => gistAccessToken.value)}${gistAddToken}${gistRemoveToken}
` this._view.optionVM = yo`` + this._view.optionVMLabel = yo`` if (this.config.get('settings/always-use-vm') === undefined) this.config.set('settings/always-use-vm', true) - if (this.config.get('settings/always-use-vm')) this._view.optionVM.setAttribute('checked', '') - this._view.personal = yo`` - if (this.config.get('settings/personal-mode')) this._view.personal.setAttribute('checked', '') - this._view.generateContractMetadata = yo`` - - if (this.config.get('settings/generate-contract-metadata')) this._view.generateContractMetadata.setAttribute('checked', '') - - this._view.pluginInput = yo`` + if (this.config.get('settings/always-use-vm')) { + this._view.optionVM.setAttribute('checked', '') + this._view.optionVMLabel.classList.remove("text-dark") + } else this._view.optionVMLabel.classList.add("text-dark") - this._view.themes = this._deps.themeModule.getThemes() - this._view.themesCheckBoxes = this.createThemeCheckies() + this._view.textWrap = yo`` + this._view.textWrapLabel = yo`` + if (this.config.get('settings/text-wrap')) { + this._view.textWrap.setAttribute('checked', '') + this._view.textWrapLabel.classList.remove("text-dark") + } else this._view.textWrapLabel.classList.add("text-dark") const warnText = `Transaction sent over Web3 will use the web3.personal API - be sure the endpoint is opened before enabling it. This mode allows to provide the passphrase in the Remix interface without having to unlock the account. Although this is very convenient, you should completely trust the backend you are connected to (Geth, Parity, ...). Remix never persist any passphrase.`.split('\n').map(s => s.trim()).join(' ') + + this._view.personal = yo`` this._view.warnPersonalMode = yo`` + this._view.personalLabel = yo`` + if (this.config.get('settings/personal-mode')) { + this._view.personal.setAttribute('checked', '') + this._view.personalLabel.classList.remove("text-dark") + } else this._view.personalLabel.classList.add("text-dark") + + this._view.generateContractMetadata = yo`` + this._view.generateContractMetadataLabel = yo`` + if (this.config.get('settings/generate-contract-metadata')) { + this._view.generateContractMetadata.setAttribute('checked', '') + this._view.generateContractMetadataLabel.classList.remove("text-dark") + } else this._view.generateContractMetadataLabel.classList.add("text-dark") + + this._view.pluginInput = yo`` + + this._view.themes = this._deps.themeModule.getThemes() + this._view.themesCheckBoxes = this.createThemeCheckies() this._view.config.general = yo`
@@ -102,19 +127,19 @@ module.exports = class SettingsTab extends ViewPlugin {
General settings
${this._view.generateContractMetadata} - + ${this._view.generateContractMetadataLabel}
${this._view.optionVM} - + ${this._view.optionVMLabel}
- - + ${this._view.textWrap} + ${this._view.textWrapLabel}
${this._view.personal}> - + ${this._view.personalLabel}
@@ -144,13 +169,29 @@ module.exports = class SettingsTab extends ViewPlugin { ` function onchangeGenerateContractMetadata (event) { - self.config.set('settings/generate-contract-metadata', !self.config.get('settings/generate-contract-metadata')) + const isChecked = self.config.get('settings/generate-contract-metadata') + + self.config.set('settings/generate-contract-metadata', !isChecked) + isChecked ? self._view.generateContractMetadataLabel.classList.add("text-dark") : self._view.generateContractMetadataLabel.classList.remove("text-dark") } function onchangeOption (event) { - self.config.set('settings/always-use-vm', !self.config.get('settings/always-use-vm')) + const isChecked = self.config.get('settings/always-use-vm') + + self.config.set('settings/always-use-vm', !isChecked) + isChecked ? self._view.optionVMLabel.classList.add("text-dark") : self._view.optionVMLabel.classList.remove("text-dark") + } + function textWrapEvent (event) { + const isChecked = self.config.get('settings/text-wrap') + + self.config.set('settings/text-wrap', !isChecked) + isChecked ? self._view.textWrapLabel.classList.add("text-dark") : self._view.textWrapLabel.classList.remove("text-dark") + self.editor.resize(!isChecked) } function onchangePersonal (event) { - self.config.set('settings/personal-mode', !self.config.get('settings/personal-mode')) + const isChecked = self.config.get('settings/personal-mode') + + self.config.set('settings/personal-mode', !isChecked) + isChecked ? self._view.personalLabel.classList.add("text-dark") : self._view.personalLabel.classList.remove("text-dark") } this._deps.themeModule.switchTheme() diff --git a/apps/remix-ide/src/app/tabs/styles/settings-tab-styles.js b/apps/remix-ide/src/app/tabs/styles/settings-tab-styles.js index 2ba10f7a29..1c5ac85870 100644 --- a/apps/remix-ide/src/app/tabs/styles/settings-tab-styles.js +++ b/apps/remix-ide/src/app/tabs/styles/settings-tab-styles.js @@ -73,7 +73,12 @@ const css = csjs` .customCheckBox::before, .customCheckBox::after { top: .7em } - .text { + .customRadio::before, .customRadio::after { + -moz-border-radius: 50%; + -webkit-border-radius: 50%; + border-radius: 50%; + } + .text, .text:hover { text-decoration: none; } ` diff --git a/apps/remix-ide/src/app/tabs/theme-module.js b/apps/remix-ide/src/app/tabs/theme-module.js index e6adedbc32..e7ba82541c 100644 --- a/apps/remix-ide/src/app/tabs/theme-module.js +++ b/apps/remix-ide/src/app/tabs/theme-module.js @@ -5,7 +5,7 @@ import * as packageJson from '../../../../../package.json' import yo from 'yo-yo' const themes = [ - {name: 'Dark', quality: 'dark', url: 'https://res.cloudinary.com/dvtmp0niu/raw/upload/v1584965247/remix-dark_tmkdla.css'}, + {name: 'Dark', quality: 'dark', url: './assets/css/dark.css'}, {name: 'Light', quality: 'light', url: 'https://res.cloudinary.com/remix/raw/upload/v1594059208/remix-themes/remix-light_csxus2.css'}, {name: 'Cerulean', quality: 'light', url: 'https://bootswatch.com/4/cerulean/bootstrap.min.css'},