diff options
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/config.js | 16 | ||||
| -rw-r--r-- | src/modules/users.js | 4 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/modules/config.js b/src/modules/config.js index 9a62905e..2b50655b 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -1,4 +1,4 @@ -import { set } from 'vue' +import { set, delete as del } from 'vue' import StyleSetter from '../services/style_setter/style_setter.js' const defaultState = { @@ -10,7 +10,8 @@ const defaultState = { autoLoad: true, streaming: false, hoverPreview: true, - muteWords: [] + muteWords: [], + highlight: {} } const config = { @@ -18,12 +19,23 @@ const config = { mutations: { setOption (state, { name, value }) { set(state, name, value) + }, + setHighlight (state, { user, color, type }) { + const data = this.state.config.highlight[user] + if (color || type) { + set(state.highlight, user, { color: color || data.color, type: type || data.type }) + } else { + del(state.highlight, user) + } } }, actions: { setPageTitle ({state}, option = '') { document.title = `${option} ${state.name}` }, + setHighlight ({ commit, dispatch }, { user, color, type }) { + commit('setHighlight', {user, color, type}) + }, setOption ({ commit, dispatch }, { name, value }) { commit('setOption', {name, value}) switch (name) { diff --git a/src/modules/users.js b/src/modules/users.js index 8303ecc1..ba548765 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -42,6 +42,10 @@ export const mutations = { }, setUserForStatus (state, status) { status.user = state.usersObject[status.user.id] + }, + setColor (state, { user: {id}, highlighted }) { + const user = state.usersObject[id] + set(user, 'highlight', highlighted) } } |
