Fixes, theming & deploy files

This commit is contained in:
Thomas
2020-08-01 18:19:39 +02:00
parent 76c6b45e2b
commit 1990ff0f04
23 changed files with 552 additions and 403 deletions

View File

@@ -38,10 +38,11 @@ const actions = {
setTimeCode ({ commit }, timeCode) {
commit('SET_TIMECODE', timeCode)
},
vote ({ commit, dispatch, state }, { link, linkID, isPositive, voterName }) {
vote ({ commit, dispatch, state }, { title, link, linkID, isPositive, voterName }) {
console.log('vote on ' + link + ' | ' + linkID + ' (' + isPositive + ') by ' + voterName)
if (isPositive) {
commit('ADD_VOTE', {
title: title,
linkID: linkID,
link: link,
voterName: voterName
@@ -54,6 +55,10 @@ const actions = {
}
dispatch('rtc/broadcast', { message: state.roomStatus, type: 'status' }, { root: true })
},
removePlay ({ commit, dispatch, state }, linkID) {
commit('REMOVE_PLAY', linkID)
dispatch('rtc/broadcast', { message: state.roomStatus, type: 'status' }, { root: true })
},
setCurrent ({ commit, dispatch }, { playerStatus, timeCode, timeLength, title }) {
switch (playerStatus) {
case 0:
@@ -114,10 +119,11 @@ const mutations = {
SET_CURRENTTITLE (state, title) {
state.roomStatus.current.title = title
},
ADD_VOTE (state, { link, linkID, voterName }) {
ADD_VOTE (state, { title, link, linkID, voterName }) {
var play = state.roomStatus.playlist.find(play => play.linkID === linkID)
if (play === undefined) {
play = {
title: title,
link: link,
linkID: linkID,
votes: 1,
@@ -131,6 +137,10 @@ const mutations = {
play.votes++
play.voters.push(voterName)
}
state.roomStatus.playlist.sort((a, b) => {
return b.votes - a.votes
})
},
REMOVE_VOTE (state, { linkID, voterName }) {
var play = state.roomStatus.playlist.find(play => play.linkID === linkID)
@@ -140,12 +150,23 @@ const mutations = {
play.voters.splice(index, 1)
}
if (play.vote === 0) {
if (play.votes === 0) {
const index = state.roomStatus.playlist.indexOf(play)
if (index > -1) {
state.roomStatus.playlist.splice(index, 1)
}
}
state.roomStatus.playlist.sort((a, b) => {
return b.votes - a.votes
})
},
REMOVE_PLAY (state, linkID) {
var play = state.roomStatus.playlist.find(play => play.linkID === linkID)
const index = state.roomStatus.playlist.indexOf(play)
if (index > -1) {
state.roomStatus.playlist.splice(index, 1)
}
},
CURRENT_END (state) {
if (state.roomStatus.playlist.length === 0) {