mirror of https://github.com/Lissy93/dashy.git
⚡ Adds VueX store state for modal open state
This commit is contained in:
parent
004bffce18
commit
8d111a1623
|
@ -4,14 +4,16 @@ import Vuex from 'vuex';
|
||||||
import Keys from '@/utils/StoreMutations';
|
import Keys from '@/utils/StoreMutations';
|
||||||
import ConfigAccumulator from '@/utils/ConfigAccumalator';
|
import ConfigAccumulator from '@/utils/ConfigAccumalator';
|
||||||
import { componentVisibility } from '@/utils/ConfigHelpers';
|
import { componentVisibility } from '@/utils/ConfigHelpers';
|
||||||
|
import filterUserSections from '@/utils/CheckSectionVisibility';
|
||||||
|
|
||||||
Vue.use(Vuex);
|
Vue.use(Vuex);
|
||||||
|
|
||||||
const { UPDATE_CONFIG } = Keys;
|
const { UPDATE_CONFIG, SET_MODAL_OPEN } = Keys;
|
||||||
|
|
||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
state: {
|
state: {
|
||||||
config: {},
|
config: {},
|
||||||
|
modalOpen: false, // KB shortcut functionality will be disabled when modal is open
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
config(state) {
|
config(state) {
|
||||||
|
@ -24,7 +26,7 @@ const store = new Vuex.Store({
|
||||||
return state.config.appConfig || {};
|
return state.config.appConfig || {};
|
||||||
},
|
},
|
||||||
sections(state) {
|
sections(state) {
|
||||||
return state.config.sections || [];
|
return filterUserSections(state.config.sections || []);
|
||||||
},
|
},
|
||||||
webSearch(state, getters) {
|
webSearch(state, getters) {
|
||||||
return getters.appConfig.webSearch || {};
|
return getters.appConfig.webSearch || {};
|
||||||
|
@ -37,6 +39,9 @@ const store = new Vuex.Store({
|
||||||
[UPDATE_CONFIG](state, config) {
|
[UPDATE_CONFIG](state, config) {
|
||||||
state.config = config;
|
state.config = config;
|
||||||
},
|
},
|
||||||
|
[SET_MODAL_OPEN](state, modalOpen) {
|
||||||
|
state.modalOpen = modalOpen;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
initializeConfig({ commit }) {
|
initializeConfig({ commit }) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// A list of mutation names
|
// A list of mutation names
|
||||||
const KEY_NAMES = [
|
const KEY_NAMES = [
|
||||||
'UPDATE_CONFIG',
|
'UPDATE_CONFIG',
|
||||||
|
'SET_MODAL_OPEN',
|
||||||
];
|
];
|
||||||
|
|
||||||
// Convert array of key names into an object, and export
|
// Convert array of key names into an object, and export
|
||||||
|
|
Loading…
Reference in New Issue