townsquare/src/components/TownInfo.vue

181 lines
4.1 KiB
Vue
Raw Permalink Normal View History

<template>
<ul class="info">
<li
class="edition"
2020-12-20 21:01:56 +00:00
:class="['edition-' + edition.id]"
:style="{
2021-02-03 21:12:38 +00:00
backgroundImage: `url(${
edition.logo && grimoire.isImageOptIn
? edition.logo
: require('../assets/editions/' + edition.id + '.png')
})`
}"
></li>
2020-04-28 19:47:28 +00:00
<li v-if="players.length - teams.traveler < 5">
Please add more players!
</li>
<li>
2020-12-20 21:01:56 +00:00
<span class="meta" v-if="!edition.isOfficial">
{{ edition.name }}
{{ edition.author ? "by " + edition.author : "" }}
</span>
<span>
{{ players.length }} <font-awesome-icon class="players" icon="users" />
</span>
<span>
{{ teams.alive }}
<font-awesome-icon class="alive" icon="heartbeat" />
</span>
<span>
{{ teams.votes }} <font-awesome-icon class="votes" icon="vote-yea" />
</span>
</li>
2020-04-11 20:55:37 +00:00
<li v-if="players.length - teams.traveler >= 5">
2020-12-20 21:01:56 +00:00
<span>
{{ teams.townsfolk }}
<font-awesome-icon class="townsfolk" icon="user-friends" />
</span>
<span>
{{ teams.outsider }}
<font-awesome-icon
class="outsider"
:icon="teams.outsider > 1 ? 'user-friends' : 'user'"
/>
</span>
<span>
{{ teams.minion }}
<font-awesome-icon
class="minion"
:icon="teams.minion > 1 ? 'user-friends' : 'user'"
/>
</span>
<span>
{{ teams.demon }}
<font-awesome-icon
class="demon"
:icon="teams.demon > 1 ? 'user-friends' : 'user'"
/>
</span>
<span v-if="teams.traveler">
2020-04-11 20:55:37 +00:00
{{ teams.traveler }}
<font-awesome-icon
class="traveler"
:icon="teams.traveler > 1 ? 'user-friends' : 'user'"
/>
2020-12-20 21:01:56 +00:00
</span>
<span v-if="grimoire.isNight">
2020-12-02 19:39:12 +00:00
Night phase
<font-awesome-icon :icon="['fas', 'cloud-moon']" />
2020-12-20 21:01:56 +00:00
</span>
</li>
</ul>
</template>
<script>
import gameJSON from "./../game";
2020-05-02 19:33:44 +00:00
import { mapState } from "vuex";
export default {
computed: {
teams: function() {
2020-05-03 21:05:17 +00:00
const { players } = this.$store.state.players;
const nonTravelers = this.$store.getters["players/nonTravelers"];
const alive = players.filter(player => player.isDead !== true).length;
return {
2020-05-03 21:05:17 +00:00
...gameJSON[nonTravelers - 5],
traveler: players.length - nonTravelers,
alive,
votes:
alive +
2020-05-03 21:05:17 +00:00
players.filter(
player => player.isDead === true && player.isVoteless !== true
).length
};
2020-05-02 19:33:44 +00:00
},
2020-12-02 19:39:12 +00:00
...mapState(["edition", "grimoire"]),
2020-05-31 21:42:08 +00:00
...mapState("players", ["players"])
}
};
</script>
2020-05-31 21:42:08 +00:00
<style lang="scss" scoped>
@import "../vars.scss";
.info {
position: absolute;
display: flex;
width: 20%;
height: 20%;
2020-04-10 09:21:27 +00:00
padding: 50px 0 0;
align-items: center;
align-content: center;
justify-content: center;
flex-wrap: wrap;
background: url("../assets/demon-head.png") center center no-repeat;
background-size: auto 100%;
li {
font-weight: bold;
width: 100%;
filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.7));
2020-12-20 21:01:56 +00:00
display: flex;
flex-wrap: wrap;
justify-content: center;
text-shadow: 0 2px 1px black, 0 -2px 1px black, 2px 0 1px black,
-2px 0 1px black;
span {
white-space: nowrap;
}
.meta {
text-align: center;
flex-basis: 100%;
font-family: PiratesBay, sans-serif;
font-weight: normal;
}
svg {
margin-right: 10px;
}
.players {
color: #00f700;
}
.alive {
color: #ff4a50;
}
.votes {
2020-05-05 18:51:40 +00:00
color: #fff;
}
.townsfolk {
color: $townsfolk;
}
.outsider {
color: $outsider;
}
.minion {
color: $minion;
}
.demon {
color: $demon;
}
.traveler {
color: $traveler;
}
}
2020-04-10 08:59:32 +00:00
2020-04-10 09:37:06 +00:00
li.edition {
2020-04-10 08:59:32 +00:00
width: 220px;
height: 200px;
2020-06-10 22:37:17 +00:00
max-width: 100%;
max-height: 100%;
background-position: 0 center;
background-repeat: no-repeat;
2020-04-10 08:59:32 +00:00
background-size: 100% auto;
position: absolute;
2020-06-10 22:37:17 +00:00
top: -25%;
2020-04-10 08:59:32 +00:00
}
}
</style>