diff options
Diffstat (limited to 'src/modules/interface.js')
| -rw-r--r-- | src/modules/interface.js | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/src/modules/interface.js b/src/modules/interface.js index eeebd65e..d6db32fd 100644 --- a/src/modules/interface.js +++ b/src/modules/interface.js @@ -3,6 +3,7 @@ import { set, delete as del } from 'vue' const defaultState = { settingsModalState: 'hidden', settingsModalLoaded: false, + settingsModalTargetTab: null, settings: { currentSaveStateNotice: null, noticeClearTimeout: null, @@ -14,7 +15,10 @@ const defaultState = { window.CSS.supports('-webkit-filter', 'drop-shadow(0 0)') ) }, - mobileLayout: false + mobileLayout: false, + globalNotices: [], + layoutHeight: 0, + lastTimeline: null } const interfaceMod = { @@ -58,6 +62,21 @@ const interfaceMod = { if (!state.settingsModalLoaded) { state.settingsModalLoaded = true } + }, + setSettingsModalTargetTab (state, value) { + state.settingsModalTargetTab = value + }, + pushGlobalNotice (state, notice) { + state.globalNotices.push(notice) + }, + removeGlobalNotice (state, notice) { + state.globalNotices = state.globalNotices.filter(n => n !== notice) + }, + setLayoutHeight (state, value) { + state.layoutHeight = value + }, + setLastTimeline (state, value) { + state.lastTimeline = value } }, actions: { @@ -81,6 +100,41 @@ const interfaceMod = { }, togglePeekSettingsModal ({ commit }) { commit('togglePeekSettingsModal') + }, + clearSettingsModalTargetTab ({ commit }) { + commit('setSettingsModalTargetTab', null) + }, + openSettingsModalTab ({ commit }, value) { + commit('setSettingsModalTargetTab', value) + commit('openSettingsModal') + }, + pushGlobalNotice ( + { commit, dispatch }, + { + messageKey, + messageArgs = {}, + level = 'error', + timeout = 0 + }) { + const notice = { + messageKey, + messageArgs, + level + } + if (timeout) { + setTimeout(() => dispatch('removeGlobalNotice', notice), timeout) + } + commit('pushGlobalNotice', notice) + return notice + }, + removeGlobalNotice ({ commit }, notice) { + commit('removeGlobalNotice', notice) + }, + setLayoutHeight ({ commit }, value) { + commit('setLayoutHeight', value) + }, + setLastTimeline ({ commit }, value) { + commit('setLastTimeline', value) } } } |
