diff options
| author | Maksim Pechnikov <parallel588@gmail.com> | 2020-09-07 09:47:17 +0300 |
|---|---|---|
| committer | Maksim Pechnikov <parallel588@gmail.com> | 2020-09-07 09:47:17 +0300 |
| commit | fa2b680855c790ba8ed8d7cc0dbf2a3a2e1dbaf6 (patch) | |
| tree | b2868a1c0d2fce025134af4167c824fc8ee49068 /src/modules/interface.js | |
| parent | 12519a54b55140a3e5f76e67ac53914654c2a8b0 (diff) | |
| parent | a73b09c73202117ffa3fecf7a9185981d6696912 (diff) | |
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma-fe into develop
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) } } } |
