no storage theme fallback

pull/2113/head
filip mertens 3 years ago
parent a08a7ff0ef
commit b94b2cdc7d
  1. 4
      apps/remix-ide/src/app/tabs/theme-module.js
  2. 8
      apps/remix-ide/src/index.tsx
  3. 2
      package.json

@ -31,7 +31,7 @@ export class ThemeModule extends Plugin {
super(profile) super(profile)
this.events = new EventEmitter() this.events = new EventEmitter()
this._deps = { this._deps = {
config: Registry.getInstance().get('config').api config: Registry.getInstance().get('config') && Registry.getInstance().get('config').api
} }
this.themes = {} this.themes = {}
themes.map((theme) => { themes.map((theme) => {
@ -44,7 +44,7 @@ export class ThemeModule extends Plugin {
let queryTheme = (new QueryParams()).get().theme let queryTheme = (new QueryParams()).get().theme
queryTheme = queryTheme && queryTheme.toLocaleLowerCase() queryTheme = queryTheme && queryTheme.toLocaleLowerCase()
queryTheme = this.themes[queryTheme] ? queryTheme : null queryTheme = this.themes[queryTheme] ? queryTheme : null
let currentTheme = this._deps.config.get('settings/theme') let currentTheme = (this._deps.config && this._deps.config.get('settings/theme')) || null
currentTheme = currentTheme && currentTheme.toLocaleLowerCase() currentTheme = currentTheme && currentTheme.toLocaleLowerCase()
currentTheme = this.themes[currentTheme] ? currentTheme : null currentTheme = this.themes[currentTheme] ? currentTheme : null
this.currentThemeState = { queryTheme, currentTheme } this.currentThemeState = { queryTheme, currentTheme }

@ -9,15 +9,14 @@ import Registry from './app/state/registry'
import { Storage } from '@remix-project/remix-lib' import { Storage } from '@remix-project/remix-lib'
(async function() { (async function() {
// load current theme befor anything else // load current theme befor anything else
try { try {
const configStorage = new Storage('config-v0.8:') const configStorage = new Storage('config-v0.8:')
const config = new Config(configStorage) const config = new Config(configStorage);
Registry.getInstance().put({ api: config, name: 'config' }) Registry.getInstance().put({ api: config, name: 'config' })
} catch (e) {}
const theme = new ThemeModule() const theme = new ThemeModule()
theme.initTheme() theme.initTheme()
} catch (e) { }
render( render(
<React.StrictMode> <React.StrictMode>
@ -25,7 +24,4 @@ import { Storage } from '@remix-project/remix-lib'
</React.StrictMode>, </React.StrictMode>,
document.getElementById('root') document.getElementById('root')
) )
})() })()

@ -161,7 +161,6 @@
"async": "^2.6.2", "async": "^2.6.2",
"axios": ">=0.21.1", "axios": ">=0.21.1",
"brace": "^0.8.0", "brace": "^0.8.0",
"browserfs": "^1.4.3",
"change-case": "^4.1.1", "change-case": "^4.1.1",
"chokidar": "^2.1.8", "chokidar": "^2.1.8",
"color-support": "^1.1.3", "color-support": "^1.1.3",
@ -187,7 +186,6 @@
"merge": "^2.1.1", "merge": "^2.1.1",
"monaco-editor": "^0.30.1", "monaco-editor": "^0.30.1",
"npm-install-version": "^6.0.2", "npm-install-version": "^6.0.2",
"object-hash": "^3.0.0",
"react": "^17.0.2", "react": "^17.0.2",
"react-beautiful-dnd": "^13.1.0", "react-beautiful-dnd": "^13.1.0",
"react-bootstrap": "^1.6.4", "react-bootstrap": "^1.6.4",

Loading…
Cancel
Save