correcting pronoun to pronouns in all occurances

This commit is contained in:
Dave 2021-02-28 11:23:16 +00:00
parent 0ffde84188
commit 769c891a67
4 changed files with 27 additions and 24 deletions

View File

@ -104,8 +104,8 @@
:class="{ active: isMenuOpen }" :class="{ active: isMenuOpen }"
> >
{{ player.name }} {{ player.name }}
<div class="pronouns" v-if="player.pronoun && player.pronoun !== ''"> <div class="pronouns" v-if="player.pronouns && player.pronouns !== ''">
{{ player.pronoun }} {{ player.pronouns }}
</div> </div>
</div> </div>
@ -154,7 +154,7 @@
<template v-else> Seat occupied</template> <template v-else> Seat occupied</template>
</li> </li>
<li <li
@click="changePronoun" @click="changePronouns"
v-if="session.isSpectator && player.id === session.playerId" v-if="session.isSpectator && player.id === session.playerId"
> >
<font-awesome-icon icon="transgender" />Change Pronouns <font-awesome-icon icon="transgender" />Change Pronouns
@ -241,13 +241,16 @@ export default {
}; };
}, },
methods: { methods: {
changePronoun() { changePronouns() {
if (!this.session.isSpectator || this.player.id !== this.session.playerId) if (!this.session.isSpectator || this.player.id !== this.session.playerId)
return; return;
const pronoun = prompt("Player preffered pronouns", this.player.pronoun); const pronouns = prompt(
this.$store.commit("players/setPronoun", { "Player preffered pronouns",
this.player.pronouns
);
this.$store.commit("players/setPronouns", {
player: this.player, player: this.player,
pronoun pronouns
}); });
this.isMenuOpen = false; this.isMenuOpen = false;
}, },

View File

@ -107,10 +107,10 @@ const mutations = {
state.players[index][property] = value; state.players[index][property] = value;
} }
}, },
setPronoun(state, { player, pronoun }) { setPronouns(state, { player, pronouns }) {
const index = state.players.indexOf(player); const index = state.players.indexOf(player);
if (index >= 0) { if (index >= 0) {
state.players[index].pronoun = pronoun; state.players[index].pronouns = pronouns;
} }
}, },
add(state, name) { add(state, name) {

View File

@ -137,7 +137,7 @@ module.exports = store => {
case "players/set": case "players/set":
case "players/swap": case "players/swap":
case "players/move": case "players/move":
case "players/setPronoun": case "players/setPronouns":
if (state.players.players.length) { if (state.players.players.length) {
localStorage.setItem( localStorage.setItem(
"players", "players",

View File

@ -189,8 +189,8 @@ class LiveSession {
case "bye": case "bye":
this._handleBye(params); this._handleBye(params);
break; break;
case "pronoun": case "pronouns":
this._updatePlayerPronoun(params); this._updatePlayerPronouns(params);
break; break;
} }
} }
@ -247,7 +247,7 @@ class LiveSession {
id: player.id, id: player.id,
isDead: player.isDead, isDead: player.isDead,
isVoteless: player.isVoteless, isVoteless: player.isVoteless,
pronoun: player.pronoun, pronouns: player.pronouns,
...(player.role && player.role.team === "traveler" ...(player.role && player.role.team === "traveler"
? { roleId: player.role.id } ? { roleId: player.role.id }
: {}) : {})
@ -308,7 +308,7 @@ class LiveSession {
const player = players[x]; const player = players[x];
const { roleId } = state; const { roleId } = state;
// update relevant properties // update relevant properties
["name", "id", "isDead", "isVoteless", "pronoun"].forEach(property => { ["name", "id", "isDead", "isVoteless", "pronouns"].forEach(property => {
const value = state[property]; const value = state[property];
if (player[property] !== value) { if (player[property] !== value) {
this._store.commit("players/update", { player, property, value }); this._store.commit("players/update", { player, property, value });
@ -486,26 +486,26 @@ class LiveSession {
} }
/** /**
* Publish a player pronoun update * Publish a player pronouns update
* @param player * @param player
* @param pronoun * @param pronouns
*/ */
sendPlayerPronoun({ player, pronoun }) { sendPlayerPronouns({ player, pronouns }) {
if (!this._isSpectator) return; if (!this._isSpectator) return;
const index = this._store.state.players.players.indexOf(player); const index = this._store.state.players.players.indexOf(player);
this._send("pronoun", { index, pronoun }); this._send("pronouns", { index, pronouns });
} }
/** /**
* Update a pronoun based on incoming data. Player only. * Update a pronouns based on incoming data. Player only.
* @param index * @param index
* @param pronoun * @param pronouns
* @private * @private
*/ */
_updatePlayerPronoun({ index, pronoun }) { _updatePlayerPronouns({ index, pronouns }) {
const player = this._store.state.players.players[index]; const player = this._store.state.players.players[index];
if (!player) return; if (!player) return;
this._store.commit("players/setPronoun", { player, pronoun }); this._store.commit("players/setPronouns", { player, pronouns });
} }
/** /**
@ -839,8 +839,8 @@ export default store => {
case "players/update": case "players/update":
session.sendPlayer(payload); session.sendPlayer(payload);
break; break;
case "players/setPronoun": case "players/setPronouns":
session.sendPlayerPronoun(payload); session.sendPlayerPronouns(payload);
break; break;
} }
}); });