diff --git a/src/app.js b/src/app.js index 046fc5a640..a7056d11be 100644 --- a/src/app.js +++ b/src/app.js @@ -444,7 +444,11 @@ Please make a backup of your contracts and start using http://remix.ethereum.org registry.get('pluginmanager').api, registry.get('compilersartefacts').api ) - let settings = new SettingsTab(self._components.registry) + let settings = new SettingsTab( + registry.get('config').api, + registry.get('editor').api, + appManager + ) let analysis = new AnalysisTab(registry) let debug = new DebuggerTab() const landingPage = new LandingPage(appManager, appStore) diff --git a/src/app/tabs/settings-tab.js b/src/app/tabs/settings-tab.js index 6e3c7128a0..3b929841d7 100644 --- a/src/app/tabs/settings-tab.js +++ b/src/app/tabs/settings-tab.js @@ -1,7 +1,6 @@ var yo = require('yo-yo') var remixLib = require('remix-lib') -var globalRegistry = require('../../global/registry') var tooltip = require('../ui/tooltip') var copyToClipboard = require('../ui/copy-to-clipboard') var styleGuide = require('../ui/styles-guide/theme-chooser') @@ -11,34 +10,25 @@ var css = require('./styles/settings-tab-styles') import { ApiFactory } from 'remix-plugin' module.exports = class SettingsTab extends ApiFactory { - constructor (localRegistry) { + constructor (config, editor, appManager) { super() - const self = this - self._components = {} - self._components.registry = localRegistry || globalRegistry - // dependencies - self._deps = { - config: self._components.registry.get('config').api, - editorPanel: self._components.registry.get('editorpanel').api, - editor: self._components.registry.get('editor').api, - appManager: self._components.registry.get('appmanager').api - } - self._view = { /* eslint-disable */ + this.config = config + this.editor = editor + this.appManager = appManager + this._components = {} + this._view = { /* eslint-disable */ el: null, optionVM: null, personal: null, warnPersonalMode: null, generateContractMetadata: null, - pluginInput: null, versionSelector: null, version: null, theme: { dark: null, light: null, clean: null }, - plugins: {}, config: { - general: null, themes: null, - plugin: null + general: null, themes: null } } /* eslint-enable */ - self.data = {} - self.event = new EventManager() - self._components.themeStorage = new Storage('style:') - self.data.currentTheme = self._components.themeStorage.get('theme') || 'light' + this.event = new EventManager() + const themeStorage = new Storage('style:') + this.currentTheme = themeStorage.get('theme') || 'light' } + get profile () { return { displayName: 'settings', @@ -58,16 +48,16 @@ module.exports = class SettingsTab extends ApiFactory { // Gist settings var gistAccessToken = yo`` - var token = self._deps.config.get('settings/gist-access-token') + var token = self.config.get('settings/gist-access-token') if (token) gistAccessToken.value = token - var gistAddToken = yo` { self._deps.config.set('settings/gist-access-token', gistAccessToken.value); tooltip('Access token saved') }} value="Save" type="button">` - var gistRemoveToken = yo` { gistAccessToken.value = ''; self._deps.config.set('settings/gist-access-token', ''); tooltip('Access token removed') }} value="Remove" type="button">` - self._view.gistToken = yo`