From 8d111a16234483264883ed38838ee1c7aea96aa6 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 10 Oct 2021 14:27:01 +0100 Subject: [PATCH] :zap: Adds VueX store state for modal open state --- src/store.js | 9 +++++++-- src/utils/StoreMutations.js | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/store.js b/src/store.js index 2229c6ce..8e260a9f 100644 --- a/src/store.js +++ b/src/store.js @@ -4,14 +4,16 @@ import Vuex from 'vuex'; import Keys from '@/utils/StoreMutations'; import ConfigAccumulator from '@/utils/ConfigAccumalator'; import { componentVisibility } from '@/utils/ConfigHelpers'; +import filterUserSections from '@/utils/CheckSectionVisibility'; Vue.use(Vuex); -const { UPDATE_CONFIG } = Keys; +const { UPDATE_CONFIG, SET_MODAL_OPEN } = Keys; const store = new Vuex.Store({ state: { config: {}, + modalOpen: false, // KB shortcut functionality will be disabled when modal is open }, getters: { config(state) { @@ -24,7 +26,7 @@ const store = new Vuex.Store({ return state.config.appConfig || {}; }, sections(state) { - return state.config.sections || []; + return filterUserSections(state.config.sections || []); }, webSearch(state, getters) { return getters.appConfig.webSearch || {}; @@ -37,6 +39,9 @@ const store = new Vuex.Store({ [UPDATE_CONFIG](state, config) { state.config = config; }, + [SET_MODAL_OPEN](state, modalOpen) { + state.modalOpen = modalOpen; + }, }, actions: { initializeConfig({ commit }) { diff --git a/src/utils/StoreMutations.js b/src/utils/StoreMutations.js index 1348ca81..4e220880 100644 --- a/src/utils/StoreMutations.js +++ b/src/utils/StoreMutations.js @@ -1,6 +1,7 @@ // A list of mutation names const KEY_NAMES = [ 'UPDATE_CONFIG', + 'SET_MODAL_OPEN', ]; // Convert array of key names into an object, and export