add recordVoteHistory & clearVoteHistory to session menu

This commit is contained in:
nicfreeman1209 2021-04-18 15:19:59 +01:00
parent 3c849942fe
commit a2fb33eafe
3 changed files with 34 additions and 6 deletions

View File

@ -60,13 +60,14 @@
</li>
<li @click="toggleNightOrder" v-if="players.length">
Night order
<em
><font-awesome-icon
<em>
<font-awesome-icon
:icon="[
'fas',
grimoire.isNightOrder ? 'check-square' : 'square'
]"
/></em>
/>
</em>
</li>
<li v-if="players.length">
Zoom
@ -134,7 +135,22 @@
v-if="session.voteHistory.length"
@click="toggleModal('voteHistory')"
>
Nomination history<em>[V]</em>
Vote history<em>[V]</em>
</li>
<li @click="toggleRecordVoteHistory" v-if="!session.isSpectator">
Record vote history
<em>
<font-awesome-icon
:icon="[
'fas',
session.recordVoteHistory ? 'check-square' : 'square'
]"
/>
</em>
</li>
<li @click="clearVoteHistory" v-if="!session.isSpectator">
Clear vote history
<em><font-awesome-icon icon="trash-alt"/></em>
</li>
<li @click="leaveSession">
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",

View File

@ -220,7 +220,9 @@ export default {
},
finish() {
clearInterval(this.voteTimer);
if (this.session.recordVoteHistory) {
this.$store.commit("session/addHistory", this.players);
}
this.$store.commit("session/nomination");
},
vote(vote) {

View File

@ -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.