show badge on new messages.

This commit is contained in:
Miroslav Šedivý
2021-07-17 12:38:12 +02:00
parent 429fc7eb68
commit 2cff2a340f
3 changed files with 56 additions and 0 deletions

View File

@ -23,6 +23,7 @@ interface Message {
export const state = () => ({
history: [] as Message[],
emotes: {} as Emotes,
texts: 0,
})
export const getters = getterTree(state, {
@ -31,6 +32,10 @@ export const getters = getterTree(state, {
export const mutations = mutationTree(state, {
addMessage(state, message: Message) {
if (message.type == 'text') {
state.texts++
}
state.history = state.history.concat([message])
},
@ -52,6 +57,7 @@ export const mutations = mutationTree(state, {
reset(state) {
state.emotes = {}
state.history = []
state.texts = 0
},
})