refactor(editor): put editor theme behind local storage flag (#4498)

set theme
This commit is contained in:
Mutasem Aldmour 2022-11-02 11:37:09 +01:00 committed by GitHub
parent 3a1fa09108
commit 3c9ad02ce3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -30,7 +30,7 @@
import Modals from './components/Modals.vue';
import LoadingView from './views/LoadingView.vue';
import Telemetry from './components/Telemetry.vue';
import { HIRING_BANNER, VIEWS } from './constants';
import { HIRING_BANNER, LOCAL_STORAGE_THEME, VIEWS } from './constants';
import mixins from 'vue-typed-mixins';
import { showMessage } from './components/mixins/showMessage';
@ -159,8 +159,15 @@ export default mixins(
this.$router.replace(redirect);
}
},
setTheme() {
const theme = window.localStorage.getItem(LOCAL_STORAGE_THEME);
if (theme) {
window.document.body.classList.add(`theme-${theme}`);
}
},
},
async mounted() {
this.setTheme();
await this.initialize();
this.logHiringBanner();
this.authenticate();

View file

@ -249,6 +249,7 @@ export const LOCAL_STORAGE_PIN_DATA_DISCOVERY_NDV_FLAG = 'N8N_PIN_DATA_DISCOVERY
export const LOCAL_STORAGE_PIN_DATA_DISCOVERY_CANVAS_FLAG = 'N8N_PIN_DATA_DISCOVERY_CANVAS';
export const LOCAL_STORAGE_MAPPING_FLAG = 'N8N_MAPPING_ONBOARDED';
export const LOCAL_STORAGE_MAIN_PANEL_RELATIVE_WIDTH = 'N8N_MAIN_PANEL_RELATIVE_WIDTH';
export const LOCAL_STORAGE_THEME = 'N8N_THEME';
export const BASE_NODE_SURVEY_URL = 'https://n8n-community.typeform.com/to/BvmzxqYv#nodename=';
export const HIRING_BANNER = `