mirror of https://github.com/bra1n/townsquare.git
nlc: toggle within session.js
This commit is contained in:
parent
5edc476b08
commit
e762e89485
|
@ -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"
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue