some recategorization of options...
This commit is contained in:
parent
f1c16327b6
commit
2db991fc7f
8 changed files with 78 additions and 47 deletions
|
@ -4,7 +4,6 @@ import StyleSetter from '../services/style_setter/style_setter.js'
|
|||
const browserLocale = (window.navigator.language || 'en').split('-')[0]
|
||||
|
||||
const defaultState = {
|
||||
name: 'Pleroma FE',
|
||||
colors: {},
|
||||
collapseMessageWithSubject: false,
|
||||
hideAttachments: false,
|
||||
|
@ -26,11 +25,7 @@ const defaultState = {
|
|||
},
|
||||
muteWords: [],
|
||||
highlight: {},
|
||||
interfaceLanguage: browserLocale,
|
||||
_internal: {
|
||||
currentSaveStateNotice: {},
|
||||
noticeClearTimeout: null
|
||||
}
|
||||
interfaceLanguage: browserLocale
|
||||
}
|
||||
|
||||
const config = {
|
||||
|
@ -46,36 +41,15 @@ const config = {
|
|||
} else {
|
||||
del(state.highlight, user)
|
||||
}
|
||||
},
|
||||
settingsSaved (state, { success, error }) {
|
||||
if (success) {
|
||||
if (state.noticeClearTimeout) {
|
||||
clearTimeout(state.noticeClearTimeout)
|
||||
}
|
||||
set(state._internal, 'currentSaveStateNotice', { error: false, data: success })
|
||||
set(state._internal, 'noticeClearTimeout',
|
||||
setTimeout(() => del(state._internal, 'currentSaveStateNotice'), 2000))
|
||||
} else {
|
||||
set(state._internal, 'currentSaveStateNotice', { error: true, errorData: error })
|
||||
}
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
setPageTitle ({state}, option = '') {
|
||||
document.title = `${option} ${state.name}`
|
||||
},
|
||||
setHighlight ({ commit, dispatch }, { user, color, type }) {
|
||||
commit('setHighlight', {user, color, type})
|
||||
},
|
||||
settingsSaved ({ commit, dispatch }, { success, error }) {
|
||||
commit('settingsSaved', { success, error })
|
||||
},
|
||||
setOption ({ commit, dispatch }, { name, value }) {
|
||||
commit('setOption', {name, value})
|
||||
switch (name) {
|
||||
case 'name':
|
||||
dispatch('setPageTitle')
|
||||
break
|
||||
case 'theme':
|
||||
StyleSetter.setPreset(value, commit)
|
||||
break
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue