From a2fb33eafe574d759d580ed5dbcccfa5562777db Mon Sep 17 00:00:00 2001 From: nicfreeman1209 Date: Sun, 18 Apr 2021 15:19:59 +0100 Subject: [PATCH 01/11] 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. From 44a0297be7470e952a29d2c19004f3a2d576feaa Mon Sep 17 00:00:00 2001 From: nicfreeman1209 Date: Sun, 18 Apr 2021 15:25:47 +0100 Subject: [PATCH 02/11] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92c35f0..f3c8e88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Release Notes +- added record vote history toggle to session menu, and clear vote history button + ### Version 2.12.0 - tweak reference sheet to better fit screen in single column layout - add warning icon overlay for setup roles on character assignment modal From 230507a67f16ae1c9d3cf779b64980e27f86decb Mon Sep 17 00:00:00 2001 From: nicfreeman1209 Date: Sun, 18 Apr 2021 17:26:24 +0100 Subject: [PATCH 03/11] socket part of toggle recordVoteHistory analogous to isNight --- src/components/Menu.vue | 4 +--- src/components/Vote.vue | 4 +--- src/store/index.js | 8 ++++++++ src/store/modules/session.js | 4 +--- src/store/socket.js | 21 +++++++++++++++++++++ 5 files changed, 32 insertions(+), 9 deletions(-) diff --git a/src/components/Menu.vue b/src/components/Menu.vue index fc212a9..bbefe27 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -343,9 +343,6 @@ export default { this.$store.dispatch("players/clearRoles"); } }, - toggleRecordVoteHistory() { - this.$store.commit("session/toggleRecordVoteHistory"); - }, clearVoteHistory() { this.$store.commit("session/clearVoteHistory"); }, @@ -355,6 +352,7 @@ export default { "toggleImageOptIn", "toggleMuted", "toggleNight", + "toggleRecordVoteHistory", "toggleNightOrder", "setZoom", "toggleModal" diff --git a/src/components/Vote.vue b/src/components/Vote.vue index 50a8ca8..4bdd242 100644 --- a/src/components/Vote.vue +++ b/src/components/Vote.vue @@ -220,9 +220,7 @@ export default { }, finish() { clearInterval(this.voteTimer); - if (this.session.recordVoteHistory) { - this.$store.commit("session/addHistory", this.players); - } + this.$store.commit("session/addHistory", this.players); this.$store.commit("session/nomination"); }, vote(vote) { diff --git a/src/store/index.js b/src/store/index.js index 06a03be..d607754 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -78,6 +78,7 @@ export default new Vuex.Store({ state: { grimoire: { isNight: false, + recordVoteHistory: true, isNightOrder: true, isPublic: true, isMenuOpen: false, @@ -147,6 +148,13 @@ export default new Vuex.Store({ toggleNight: toggle("isNight"), toggleGrimoire: toggle("isPublic"), toggleImageOptIn: toggle("isImageOptIn"), + toggleRecordVoteHistory(state, param) { + if (param === true || param === false) { + state.session.recordVoteHistory = param; + } else { + state.session.recordVoteHistory = !state.session.recordVoteHistory; + } + }, toggleModal({ modals }, name) { if (name) { modals[name] = !modals[name]; diff --git a/src/store/modules/session.js b/src/store/modules/session.js index 5a79ec5..17aef66 100644 --- a/src/store/modules/session.js +++ b/src/store/modules/session.js @@ -71,6 +71,7 @@ const mutations = { * @param players */ addHistory(state, players) { + if (!state.recordVoteHistory) return; if (!state.nomination || state.lockedVote <= players.length) return; const isBanishment = players[state.nomination[1]].role.team === "traveler"; state.voteHistory.push({ @@ -89,9 +90,6 @@ 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. diff --git a/src/store/socket.js b/src/store/socket.js index e193a08..7c7e199 100644 --- a/src/store/socket.js +++ b/src/store/socket.js @@ -172,6 +172,10 @@ class LiveSession { if (!this._isSpectator) return; this._store.commit("toggleNight", params); break; + case "recordVoteHistory": + if (!this._isSpectator) return; + this._store.commit("toggleRecordVoteHistory", params); + break; case "votingSpeed": if (!this._isSpectator) return; this._store.commit("session/setVotingSpeed", params); @@ -268,6 +272,7 @@ class LiveSession { this._sendDirect(playerId, "gs", { gamestate: this._gamestate, isNight: grimoire.isNight, + recordVoteHistory: session.recordVoteHistory, nomination: session.nomination, votingSpeed: session.votingSpeed, lockedVote: session.lockedVote, @@ -289,6 +294,7 @@ class LiveSession { gamestate, isLightweight, isNight, + recordVoteHistory, nomination, votingSpeed, votes, @@ -340,6 +346,7 @@ class LiveSession { }); if (!isLightweight) { this._store.commit("toggleNight", !!isNight); + this._store.commit("toggleRecordVoteHistory", recordVoteHistory); this._store.commit("session/nomination", { nomination, votes, @@ -686,6 +693,17 @@ class LiveSession { this._send("isNight", this._store.state.grimoire.isNight); } + /** + * Send the recordVoteHistory state. ST only + */ + setRecordVoteHistory() { + if (this._isSpectator) return; + this._send( + "recordVoteHistory", + this._store.state.session.recordVoteHistory + ); + } + /** * Send the voting speed. ST only * @param votingSpeed voting speed in seconds, minimum 1 @@ -843,6 +861,9 @@ export default store => { case "toggleNight": session.setIsNight(); break; + case "toggleRecordVoteHistory": + session.setRecordVoteHistory(); + break; case "setEdition": session.sendEdition(); break; From 654a4d02cd47f089f213d2d7d7abd2555fb0a272 Mon Sep 17 00:00:00 2001 From: nicfreeman1209 Date: Sun, 18 Apr 2021 17:29:20 +0100 Subject: [PATCH 04/11] remove accidental --- src/store/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index d607754..5151e73 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -78,7 +78,6 @@ export default new Vuex.Store({ state: { grimoire: { isNight: false, - recordVoteHistory: true, isNightOrder: true, isPublic: true, isMenuOpen: false, From c39aef622e8e8749586e23bdd052f33369706d02 Mon Sep 17 00:00:00 2001 From: nicfreeman1209 Date: Mon, 3 May 2021 13:33:51 +0100 Subject: [PATCH 05/11] hide rounded corners on maximized modals (barely visible anyway) --- src/components/modals/Modal.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/modals/Modal.vue b/src/components/modals/Modal.vue index fe08b13..d1bd5e6 100644 --- a/src/components/modals/Modal.vue +++ b/src/components/modals/Modal.vue @@ -115,6 +115,7 @@ export default { .maximized { background: rgba(0, 0, 0, 0.95); padding: 0; + border-radius: 0; height: 100%; width: 100%; max-width: 100%; From 5edc476b0850bbdbc7373871bd61a51cbb05cd55 Mon Sep 17 00:00:00 2001 From: nicfreeman1209 Date: Mon, 3 May 2021 14:32:58 +0100 Subject: [PATCH 06/11] ST always sees vote history i.e. toggle affects only players --- src/components/Menu.vue | 2 +- src/store/modules/session.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Menu.vue b/src/components/Menu.vue index bbefe27..0bf2de2 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -138,7 +138,7 @@ Vote history[V]
  • - Record vote history + Permit vote history Date: Mon, 3 May 2021 17:55:11 +0100 Subject: [PATCH 07/11] nlc: toggle within session.js --- src/components/Menu.vue | 4 +++- src/store/index.js | 7 ------- src/store/modules/session.js | 9 +++++++++ src/store/socket.js | 10 +++++----- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/components/Menu.vue b/src/components/Menu.vue index 0bf2de2..d39239a 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -346,13 +346,15 @@ export default { clearVoteHistory() { this.$store.commit("session/clearVoteHistory"); }, + toggleRecordVoteHistory() { + this.$store.commit("session/toggleRecordVoteHistory"); + }, ...mapMutations([ "toggleGrimoire", "toggleMenu", "toggleImageOptIn", "toggleMuted", "toggleNight", - "toggleRecordVoteHistory", "toggleNightOrder", "setZoom", "toggleModal" diff --git a/src/store/index.js b/src/store/index.js index 5151e73..06a03be 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -147,13 +147,6 @@ export default new Vuex.Store({ toggleNight: toggle("isNight"), toggleGrimoire: toggle("isPublic"), toggleImageOptIn: toggle("isImageOptIn"), - toggleRecordVoteHistory(state, param) { - if (param === true || param === false) { - state.session.recordVoteHistory = param; - } else { - state.session.recordVoteHistory = !state.session.recordVoteHistory; - } - }, toggleModal({ modals }, name) { if (name) { modals[name] = !modals[name]; diff --git a/src/store/modules/session.js b/src/store/modules/session.js index ca5cd8b..14a590b 100644 --- a/src/store/modules/session.js +++ b/src/store/modules/session.js @@ -38,6 +38,14 @@ const set = key => (state, val) => { state[key] = val; }; +const toggle = key => (state, val) => { + if (val === true || val === false) { + state[key] = val; + } else { + state[key] = !state[key]; + } +}; + const mutations = { setPlayerId: set("playerId"), setSpectator: set("isSpectator"), @@ -46,6 +54,7 @@ const mutations = { setPing: set("ping"), setVotingSpeed: set("votingSpeed"), setVoteInProgress: set("isVoteInProgress"), + toggleRecordVoteHistory: toggle("recordVoteHistory"), claimSeat: set("claimedSeat"), distributeRoles: set("isRolesDistributed"), setSessionId(state, sessionId) { diff --git a/src/store/socket.js b/src/store/socket.js index 7c7e199..41028e0 100644 --- a/src/store/socket.js +++ b/src/store/socket.js @@ -174,7 +174,7 @@ class LiveSession { break; case "recordVoteHistory": if (!this._isSpectator) return; - this._store.commit("toggleRecordVoteHistory", params); + this._store.commit("session/toggleRecordVoteHistory", params); break; case "votingSpeed": if (!this._isSpectator) return; @@ -346,7 +346,7 @@ class LiveSession { }); if (!isLightweight) { this._store.commit("toggleNight", !!isNight); - this._store.commit("toggleRecordVoteHistory", recordVoteHistory); + this._store.commit("session/toggleRecordVoteHistory", recordVoteHistory); this._store.commit("session/nomination", { nomination, votes, @@ -858,12 +858,12 @@ export default store => { case "session/clearVoteHistory": session.clearVoteHistory(); break; + case "session/toggleRecordVoteHistory": + session.setRecordVoteHistory(); + break; case "toggleNight": session.setIsNight(); break; - case "toggleRecordVoteHistory": - session.setRecordVoteHistory(); - break; case "setEdition": session.sendEdition(); break; From b9b9e59b536068feb78d71b32efe7f05aa736b01 Mon Sep 17 00:00:00 2001 From: nicfreeman1209 Date: Wed, 5 May 2021 07:58:13 +0100 Subject: [PATCH 08/11] requested changes --- src/App.vue | 2 +- src/components/Menu.vue | 23 +---------- src/components/modals/VoteHistoryModal.vue | 45 +++++++++++++++++++++- src/store/modules/session.js | 16 ++------ src/store/socket.js | 25 ++++++------ 5 files changed, 64 insertions(+), 47 deletions(-) diff --git a/src/App.vue b/src/App.vue index bb5bc65..7f17766 100644 --- a/src/App.vue +++ b/src/App.vue @@ -110,7 +110,7 @@ export default { this.$store.commit("toggleModal", "roles"); break; case "v": - if (this.session.voteHistory.length) { + if (this.session.voteHistory.length || !this.session.isSpectator) { this.$store.commit("toggleModal", "voteHistory"); } break; diff --git a/src/components/Menu.vue b/src/components/Menu.vue index d39239a..bf792a1 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -132,26 +132,11 @@
  • Vote history[V]
  • -
  • - Permit vote history - - - -
  • -
  • - Clear vote history - -
  • Leave Session {{ session.sessionId }} @@ -343,12 +328,6 @@ export default { this.$store.dispatch("players/clearRoles"); } }, - clearVoteHistory() { - this.$store.commit("session/clearVoteHistory"); - }, - toggleRecordVoteHistory() { - this.$store.commit("session/toggleRecordVoteHistory"); - }, ...mapMutations([ "toggleGrimoire", "toggleMenu", diff --git a/src/components/modals/VoteHistoryModal.vue b/src/components/modals/VoteHistoryModal.vue index 95eeaa8..ce3b0ef 100644 --- a/src/components/modals/VoteHistoryModal.vue +++ b/src/components/modals/VoteHistoryModal.vue @@ -1,7 +1,7 @@