voting terminology adjusted (closes #66)

highlight currently selected vote option
This commit is contained in:
Steffen 2020-12-02 22:01:16 +01:00
parent a37add61d9
commit f69c7a79c2
3 changed files with 32 additions and 12 deletions

View File

@ -44,15 +44,15 @@
<!-- Overlay icons --> <!-- Overlay icons -->
<div class="overlay"> <div class="overlay">
<font-awesome-icon <font-awesome-icon
icon="skull" icon="hand-paper"
class="vote" class="vote"
title="Voted YES" title="Hand UP"
@click="vote()" @click="vote()"
/> />
<font-awesome-icon <font-awesome-icon
icon="times" icon="times"
class="vote" class="vote"
title="Voted NO" title="Hand DOWN"
@click="vote()" @click="vote()"
/> />
<font-awesome-icon <font-awesome-icon
@ -500,7 +500,7 @@ export default {
fill: url(#default); fill: url(#default);
} }
&:hover *, &:hover *,
&.fa-skull * { &.fa-hand-paper * {
fill: url(#demon); fill: url(#demon);
} }
&.fa-times * { &.fa-times * {
@ -510,14 +510,14 @@ export default {
} }
// other player voted yes, but is not locked yet // other player voted yes, but is not locked yet
#townsquare.vote .player.vote-yes .overlay svg.vote.fa-skull { #townsquare.vote .player.vote-yes .overlay svg.vote.fa-hand-paper {
opacity: 0.5; opacity: 0.5;
transform: scale(1); transform: scale(1);
} }
// you voted yes | a locked vote yes | a locked vote no // you voted yes | a locked vote yes | a locked vote no
#townsquare.vote .player.you.vote-yes .overlay svg.vote.fa-skull, #townsquare.vote .player.you.vote-yes .overlay svg.vote.fa-hand-paper,
#townsquare.vote .player.vote-lock.vote-yes .overlay svg.vote.fa-skull, #townsquare.vote .player.vote-lock.vote-yes .overlay svg.vote.fa-hand-paper,
#townsquare.vote .player.vote-lock:not(.vote-yes) .overlay svg.vote.fa-times { #townsquare.vote .player.vote-lock:not(.vote-yes) .overlay svg.vote.fa-times {
opacity: 1; opacity: 1;
transform: scale(1); transform: scale(1);

View File

@ -24,7 +24,7 @@
<div v-if="session.lockedVote > 1"> <div v-if="session.lockedVote > 1">
<em class="blue" v-if="voters.length">{{ voters.join(", ") }} </em> <em class="blue" v-if="voters.length">{{ voters.join(", ") }} </em>
<span v-else>nobody</span> <span v-else>nobody</span>
voted <em>YES</em> had their hand <em>UP</em>
</div> </div>
<template v-if="!session.isSpectator"> <template v-if="!session.isSpectator">
@ -55,8 +55,20 @@
{{ session.votingSpeed }} seconds between votes {{ session.votingSpeed }} seconds between votes
</div> </div>
<div class="button-group"> <div class="button-group">
<div class="button vote-no" @click="vote(false)">Vote NO</div> <div
<div class="button vote-yes" @click="vote(true)">Vote YES</div> class="button vote-no"
@click="vote(false)"
:class="{ disabled: !currentVote }"
>
Hand DOWN
</div>
<div
class="button vote-yes"
@click="vote(true)"
:class="{ disabled: currentVote }"
>
Hand UP
</div>
</div> </div>
</template> </template>
<div v-else-if="!player"> <div v-else-if="!player">
@ -101,6 +113,10 @@ export default {
player: function() { player: function() {
return this.players.find(p => p.id === this.session.playerId); return this.players.find(p => p.id === this.session.playerId);
}, },
currentVote: function() {
const index = this.players.findIndex(p => p.id === this.session.playerId);
return index >= 0 ? !!this.session.votes[index] : undefined;
},
canVote: function() { canVote: function() {
if (!this.player) return false; if (!this.player) return false;
if (this.player.isVoteless && this.nominee.role.team !== "traveler") if (this.player.isVoteless && this.nominee.role.team !== "traveler")
@ -257,6 +273,10 @@ export default {
} }
} }
.button.disabled {
opacity: 0.75;
}
.button.vote-no { .button.vote-no {
background: radial-gradient( background: radial-gradient(
at 0 -15%, at 0 -15%,
@ -267,7 +287,7 @@ export default {
linear-gradient(#0031ad, rgba(5, 0, 0, 0.22)) content-box, linear-gradient(#0031ad, rgba(5, 0, 0, 0.22)) content-box,
linear-gradient(#292929, #001142) border-box; linear-gradient(#292929, #001142) border-box;
box-shadow: inset 0 1px 1px #002c9c, 0 0 10px #000; box-shadow: inset 0 1px 1px #002c9c, 0 0 10px #000;
&:hover { &:hover:not(.disabled) {
color: #008cf7; color: #008cf7;
} }
} }

View File

@ -20,6 +20,7 @@ const faIcons = [
"Dragon", "Dragon",
"ExchangeAlt", "ExchangeAlt",
"FileUpload", "FileUpload",
"HandPaper",
"HandPointRight", "HandPointRight",
"Heartbeat", "Heartbeat",
"Image", "Image",
@ -32,7 +33,6 @@ const faIcons = [
"RedoAlt", "RedoAlt",
"SearchMinus", "SearchMinus",
"SearchPlus", "SearchPlus",
"Skull",
"Square", "Square",
"Sun", "Sun",
"TheaterMasks", "TheaterMasks",