mirror of https://github.com/bra1n/townsquare.git
cleaning up code pulling non edition travellers in to the role modal and fixing spelling of travellers
This commit is contained in:
parent
0df7d8386d
commit
ea574fcc58
|
@ -21,7 +21,7 @@
|
||||||
<Token :role="role" />
|
<Token :role="role" />
|
||||||
</li>
|
</li>
|
||||||
<li
|
<li
|
||||||
v-for="role in extraTravelers"
|
v-for="role in extraTravellers"
|
||||||
:class="[role.team]"
|
:class="[role.team]"
|
||||||
:key="role.id"
|
:key="role.id"
|
||||||
@click="setRole(role)"
|
@click="setRole(role)"
|
||||||
|
@ -41,19 +41,8 @@ export default {
|
||||||
components: { Token, Modal },
|
components: { Token, Modal },
|
||||||
props: ["playerIndex"],
|
props: ["playerIndex"],
|
||||||
computed: {
|
computed: {
|
||||||
extraTravelers() {
|
extraTravellers() {
|
||||||
const extraTravelers = [];
|
return [...this.$store.state.extraTravellers.values()];
|
||||||
const players = this.$store.state.players.players;
|
|
||||||
this.$store.state.extraTravelers.forEach(role => {
|
|
||||||
if (
|
|
||||||
this.playerIndex >= 0 ||
|
|
||||||
(this.playerIndex < 0 &&
|
|
||||||
!players.some(player => player.role.id === role.id))
|
|
||||||
) {
|
|
||||||
extraTravelers.push(role);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return extraTravelers;
|
|
||||||
},
|
},
|
||||||
availableRoles() {
|
availableRoles() {
|
||||||
const availableRoles = [];
|
const availableRoles = [];
|
||||||
|
|
|
@ -25,7 +25,7 @@ const getRolesByEdition = (edition = editionJSON[0]) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getTravelersNotInEdition = (edition = editionJSON[0]) => {
|
const getTravellersNotInEdition = (edition = editionJSON[0]) => {
|
||||||
return new Map(
|
return new Map(
|
||||||
rolesJSON
|
rolesJSON
|
||||||
.filter(r => r.team === "traveler")
|
.filter(r => r.team === "traveler")
|
||||||
|
@ -79,7 +79,7 @@ export default new Vuex.Store({
|
||||||
},
|
},
|
||||||
edition: editionJSONbyId.get("tb"),
|
edition: editionJSONbyId.get("tb"),
|
||||||
roles: getRolesByEdition(),
|
roles: getRolesByEdition(),
|
||||||
extraTravelers: getTravelersNotInEdition(),
|
extraTravellers: getTravellersNotInEdition(),
|
||||||
fabled
|
fabled
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
|
|
Loading…
Reference in New Issue