From a2fb33eafe574d759d580ed5dbcccfa5562777db Mon Sep 17 00:00:00 2001 From: nicfreeman1209 Date: Sun, 18 Apr 2021 15:19:59 +0100 Subject: [PATCH] add recordVoteHistory & clearVoteHistory to session menu --- src/components/Menu.vue | 30 ++++++++++++++++++++++++++---- src/components/Vote.vue | 4 +++- src/store/modules/session.js | 6 +++++- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/components/Menu.vue b/src/components/Menu.vue index 40abc72..fc212a9 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -60,13 +60,14 @@
  • Night order - + + /> +
  • Zoom @@ -134,7 +135,22 @@ v-if="session.voteHistory.length" @click="toggleModal('voteHistory')" > - Nomination history[V] + Vote history[V] +
  • +
  • + Record vote history + + + +
  • +
  • + Clear vote history +
  • Leave Session @@ -327,6 +343,12 @@ export default { this.$store.dispatch("players/clearRoles"); } }, + toggleRecordVoteHistory() { + this.$store.commit("session/toggleRecordVoteHistory"); + }, + clearVoteHistory() { + this.$store.commit("session/clearVoteHistory"); + }, ...mapMutations([ "toggleGrimoire", "toggleMenu", diff --git a/src/components/Vote.vue b/src/components/Vote.vue index 4bdd242..50a8ca8 100644 --- a/src/components/Vote.vue +++ b/src/components/Vote.vue @@ -220,7 +220,9 @@ export default { }, finish() { clearInterval(this.voteTimer); - this.$store.commit("session/addHistory", this.players); + if (this.session.recordVoteHistory) { + this.$store.commit("session/addHistory", this.players); + } this.$store.commit("session/nomination"); }, vote(vote) { diff --git a/src/store/modules/session.js b/src/store/modules/session.js index 80d4aaf..5a79ec5 100644 --- a/src/store/modules/session.js +++ b/src/store/modules/session.js @@ -22,9 +22,10 @@ const state = () => ({ nomination: false, votes: [], lockedVote: 0, - votingSpeed: 3000, + votingSpeed: 1000, isVoteInProgress: false, voteHistory: [], + recordVoteHistory: true, isRolesDistributed: false }); @@ -88,6 +89,9 @@ const mutations = { clearVoteHistory(state) { state.voteHistory = []; }, + toggleRecordVoteHistory(state) { + state.recordVoteHistory = !state.recordVoteHistory; + }, /** * Store a vote with and without syncing it to the live session. * This is necessary in order to prevent infinite voting loops.