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>
<li @click="toggleNightOrder" v-if="players.length"> <li @click="toggleNightOrder" v-if="players.length">
Night order Night order
<em <em>
><font-awesome-icon <font-awesome-icon
:icon="[ :icon="[
'fas', 'fas',
grimoire.isNightOrder ? 'check-square' : 'square' grimoire.isNightOrder ? 'check-square' : 'square'
]" ]"
/></em> />
</em>
</li> </li>
<li v-if="players.length"> <li v-if="players.length">
Zoom Zoom
@ -134,7 +135,22 @@
v-if="session.voteHistory.length" v-if="session.voteHistory.length"
@click="toggleModal('voteHistory')" @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>
<li @click="leaveSession"> <li @click="leaveSession">
Leave Session Leave Session
@ -327,6 +343,12 @@ export default {
this.$store.dispatch("players/clearRoles"); this.$store.dispatch("players/clearRoles");
} }
}, },
toggleRecordVoteHistory() {
this.$store.commit("session/toggleRecordVoteHistory");
},
clearVoteHistory() {
this.$store.commit("session/clearVoteHistory");
},
...mapMutations([ ...mapMutations([
"toggleGrimoire", "toggleGrimoire",
"toggleMenu", "toggleMenu",

View File

@ -220,7 +220,9 @@ export default {
}, },
finish() { finish() {
clearInterval(this.voteTimer); 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"); this.$store.commit("session/nomination");
}, },
vote(vote) { vote(vote) {

View File

@ -22,9 +22,10 @@ const state = () => ({
nomination: false, nomination: false,
votes: [], votes: [],
lockedVote: 0, lockedVote: 0,
votingSpeed: 3000, votingSpeed: 1000,
isVoteInProgress: false, isVoteInProgress: false,
voteHistory: [], voteHistory: [],
recordVoteHistory: true,
isRolesDistributed: false isRolesDistributed: false
}); });
@ -88,6 +89,9 @@ const mutations = {
clearVoteHistory(state) { clearVoteHistory(state) {
state.voteHistory = []; state.voteHistory = [];
}, },
toggleRecordVoteHistory(state) {
state.recordVoteHistory = !state.recordVoteHistory;
},
/** /**
* Store a vote with and without syncing it to the live session. * Store a vote with and without syncing it to the live session.
* This is necessary in order to prevent infinite voting loops. * This is necessary in order to prevent infinite voting loops.