quick fixes

pull/1/head
Grandschtroumpf 6 years ago committed by yann300
parent 46bca1096c
commit 669761464e
  1. 6
      src/app.js
  2. 2
      src/app/editor/editor.js
  3. 2
      src/app/tabs/settings-tab.js
  4. 10
      src/app/tabs/theme-module.js

@ -388,6 +388,10 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
var fileManager = self._components.fileManager var fileManager = self._components.fileManager
registry.put({api: fileManager, name: 'filemanager'}) registry.put({api: fileManager, name: 'filemanager'})
// ----------------- theme module ----------------------------
const themeModule = new ThemeModule()
registry.put({api: themeModule, name: 'themeModule'})
// ----------------- editor panel ---------------------- // ----------------- editor panel ----------------------
self._components.editorpanel = new EditorPanel(appStore, appManager, mainPanelComponent) self._components.editorpanel = new EditorPanel(appStore, appManager, mainPanelComponent)
registry.put({ api: self._components.editorpanel, name: 'editorpanel' }) registry.put({ api: self._components.editorpanel, name: 'editorpanel' })
@ -413,11 +417,9 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const swapPanelApi = new SwapPanelApi(swapPanelComponent, verticalIconsComponent) // eslint-disable-line const swapPanelApi = new SwapPanelApi(swapPanelComponent, verticalIconsComponent) // eslint-disable-line
const mainPanelApi = new SwapPanelApi(mainPanelComponent, verticalIconsComponent) // eslint-disable-line const mainPanelApi = new SwapPanelApi(mainPanelComponent, verticalIconsComponent) // eslint-disable-line
const verticalIconsApi = new VerticalIconsApi(verticalIconsComponent) // eslint-disable-line const verticalIconsApi = new VerticalIconsApi(verticalIconsComponent) // eslint-disable-line
const themeModule = new ThemeModule()
registry.put({api: appManager.proxy(), name: 'pluginmanager'}) registry.put({api: appManager.proxy(), name: 'pluginmanager'})
registry.put({api: verticalIconsApi, name: 'verticalicon'}) registry.put({api: verticalIconsApi, name: 'verticalicon'})
registry.put({api: themeModule, name: 'themeModule'})
pluginManagerComponent.setApp(appManager) pluginManagerComponent.setApp(appManager)
pluginManagerComponent.setStore(appStore) pluginManagerComponent.setStore(appStore)

@ -71,7 +71,7 @@ class Editor {
'light': 'chrome', 'light': 'chrome',
'dark': 'chaos' 'dark': 'chaos'
} }
this._deps.themeModule.events.on('switchTheme', (type) => { this._deps.themeModule.events.on('themeChanged', (type) => {
this.setTheme(type) this.setTheme(type)
}) })

@ -44,7 +44,7 @@ module.exports = class SettingsTab extends ApiFactory {
} }
createThemeCheckies () { createThemeCheckies () {
let themes = this._deps.themeModule.getThemes() let themes = this._deps.themeModule.getThemes()
function onswitchTheme (event, name) { const onswitchTheme = (event, name) => {
this._deps.themeModule.switchTheme(name) this._deps.themeModule.switchTheme(name)
} }
if (themes) { if (themes) {

@ -23,7 +23,7 @@ export class ThemeModule extends ApiFactory {
super() super()
this.events = new EventEmitter() this.events = new EventEmitter()
this.storage = new Storage('style:') this.storage = new Storage('style:')
this.themes = themes.reduce(theme => ({ [theme.name]: theme }), {}) this.themes = themes.reduce((acc, theme) => ({ ...acc, [theme.name]: theme }), {})
this.active = this.storage.exists('theme') ? this.storage.get('theme') : 'Cerulean' this.active = this.storage.exists('theme') ? this.storage.get('theme') : 'Cerulean'
} }
@ -37,17 +37,17 @@ export class ThemeModule extends ApiFactory {
/** Return the active theme */ /** Return the active theme */
currentTheme () { currentTheme () {
return this.theme[this.active] return this.themes[this.active]
} }
/** Returns all themes as an array */ /** Returns all themes as an array */
getThemes () { getThemes () {
return Object.keys(this.themes).map(key => this.themes(key)) return Object.keys(this.themes).map(key => this.themes[key])
} }
/** /**
* Change the current theme * Change the current theme
* @param {string} [themeName] - The name of the theme * @param {string} [themeName] - The name of the theme
*/ */
switchTheme (themeName) { switchTheme (themeName) {
if (themeName && !Object.keys(this.themes).includes(themeName)) { if (themeName && !Object.keys(this.themes).includes(themeName)) {
@ -58,6 +58,6 @@ export class ThemeModule extends ApiFactory {
this.storage.set('theme', next) this.storage.set('theme', next)
document.getElementById('theme-link').setAttribute('href', nextTheme.url) document.getElementById('theme-link').setAttribute('href', nextTheme.url)
document.documentElement.style.setProperty('--theme', nextTheme.quality) document.documentElement.style.setProperty('--theme', nextTheme.quality)
this.event.emit('switchTheme', nextTheme.quality) this.events.emit('themeChanged', nextTheme.quality)
} }
} }

Loading…
Cancel
Save