aboutsummaryrefslogtreecommitdiff
path: root/src/modules/interface.js
diff options
context:
space:
mode:
authorShpuld Shpuldson <shp@cock.li>2020-07-06 14:01:03 +0300
committerShpuld Shpuldson <shp@cock.li>2020-07-06 14:01:03 +0300
commit87b5f828d769a5b2c34a4ad61f249c314a8bbb23 (patch)
treef09e6fce0c7549470d31d201534040df155c7fd2 /src/modules/interface.js
parent4d25be7cb35f86ba2abe883116dc6442c93a1d9d (diff)
parentb761bcf3334e1f464e63a87de40eb75d0906d545 (diff)
fix conflicts, use file icon instead of link, add support for audio and file icon in cw'd posts
Diffstat (limited to 'src/modules/interface.js')
-rw-r--r--src/modules/interface.js31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/modules/interface.js b/src/modules/interface.js
index eeebd65e..e31630fc 100644
--- a/src/modules/interface.js
+++ b/src/modules/interface.js
@@ -14,7 +14,8 @@ const defaultState = {
window.CSS.supports('-webkit-filter', 'drop-shadow(0 0)')
)
},
- mobileLayout: false
+ mobileLayout: false,
+ globalNotices: []
}
const interfaceMod = {
@@ -58,6 +59,12 @@ const interfaceMod = {
if (!state.settingsModalLoaded) {
state.settingsModalLoaded = true
}
+ },
+ pushGlobalNotice (state, notice) {
+ state.globalNotices.push(notice)
+ },
+ removeGlobalNotice (state, notice) {
+ state.globalNotices = state.globalNotices.filter(n => n !== notice)
}
},
actions: {
@@ -81,6 +88,28 @@ const interfaceMod = {
},
togglePeekSettingsModal ({ commit }) {
commit('togglePeekSettingsModal')
+ },
+ 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)
}
}
}