mirror of
				https://github.com/bra1n/townsquare.git
				synced 2025-10-21 16:55:12 +00:00 
			
		
		
		
	
						commit
						c7b251a4a0
					
				
					 2 changed files with 26 additions and 14 deletions
				
			
		| 
						 | 
					@ -15,31 +15,43 @@
 | 
				
			||||||
    <table>
 | 
					    <table>
 | 
				
			||||||
      <thead>
 | 
					      <thead>
 | 
				
			||||||
        <tr>
 | 
					        <tr>
 | 
				
			||||||
 | 
					          <td>Time</td>
 | 
				
			||||||
          <td>Nominator</td>
 | 
					          <td>Nominator</td>
 | 
				
			||||||
          <td>Nominee</td>
 | 
					          <td>Nominee</td>
 | 
				
			||||||
          <td>Type</td>
 | 
					          <td>Type</td>
 | 
				
			||||||
          <td>Votes</td>
 | 
					          <td>Votes</td>
 | 
				
			||||||
          <td><font-awesome-icon icon="hand-paper" /> Hand up</td>
 | 
					 | 
				
			||||||
          <td>Majority</td>
 | 
					          <td>Majority</td>
 | 
				
			||||||
 | 
					          <td>
 | 
				
			||||||
 | 
					            <font-awesome-icon icon="user-friends" />
 | 
				
			||||||
 | 
					            Voters
 | 
				
			||||||
 | 
					          </td>
 | 
				
			||||||
        </tr>
 | 
					        </tr>
 | 
				
			||||||
      </thead>
 | 
					      </thead>
 | 
				
			||||||
      <tbody>
 | 
					      <tbody>
 | 
				
			||||||
        <tr v-for="(vote, index) in session.voteHistory" :key="index">
 | 
					        <tr v-for="(vote, index) in session.voteHistory" :key="index">
 | 
				
			||||||
 | 
					          <td>
 | 
				
			||||||
 | 
					            {{ vote.timestamp.getHours().toString().padStart(2, "0") }}:{{
 | 
				
			||||||
 | 
					              vote.timestamp.getMinutes().toString().padStart(2, "0")
 | 
				
			||||||
 | 
					            }}
 | 
				
			||||||
 | 
					          </td>
 | 
				
			||||||
          <td>{{ vote.nominator }}</td>
 | 
					          <td>{{ vote.nominator }}</td>
 | 
				
			||||||
          <td>{{ vote.nominee }}</td>
 | 
					          <td>{{ vote.nominee }}</td>
 | 
				
			||||||
          <td>{{ vote.type }}</td>
 | 
					          <td>{{ vote.type }}</td>
 | 
				
			||||||
          <td><strong>{{ vote.votes.length }}</strong></td>
 | 
					 | 
				
			||||||
          <td>
 | 
					          <td>
 | 
				
			||||||
            <font-awesome-icon icon="user-friends" />
 | 
					            {{ vote.votes.length }}
 | 
				
			||||||
            {{ vote.votes.join(", ") }}
 | 
					            <font-awesome-icon icon="hand-paper" />
 | 
				
			||||||
          </td>
 | 
					          </td>
 | 
				
			||||||
          <td>
 | 
					          <td>
 | 
				
			||||||
            <template v-if="vote.votes.length >= vote.majority">
 | 
					            {{ vote.majority }}
 | 
				
			||||||
              <font-awesome-icon icon="check-square" /> ({{ vote.majority }})
 | 
					            <font-awesome-icon
 | 
				
			||||||
            </template>
 | 
					              :icon="[
 | 
				
			||||||
            <template v-else>
 | 
					                'fas',
 | 
				
			||||||
              <font-awesome-icon icon="square" /> ({{ vote.majority }})
 | 
					                vote.votes.length >= vote.majority ? 'check-square' : 'square'
 | 
				
			||||||
            </template>
 | 
					              ]"
 | 
				
			||||||
 | 
					            />
 | 
				
			||||||
 | 
					          </td>
 | 
				
			||||||
 | 
					          <td>
 | 
				
			||||||
 | 
					            {{ vote.votes.join(", ") }}
 | 
				
			||||||
          </td>
 | 
					          </td>
 | 
				
			||||||
        </tr>
 | 
					        </tr>
 | 
				
			||||||
      </tbody>
 | 
					      </tbody>
 | 
				
			||||||
| 
						 | 
					@ -97,13 +109,13 @@ thead td {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tbody {
 | 
					tbody {
 | 
				
			||||||
  td:nth-child(1) {
 | 
					  td:nth-child(2) {
 | 
				
			||||||
    color: $townsfolk;
 | 
					    color: $townsfolk;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  td:nth-child(2) {
 | 
					  td:nth-child(3) {
 | 
				
			||||||
    color: $demon;
 | 
					    color: $demon;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  td:nth-child(4) {
 | 
					  td:nth-child(5) {
 | 
				
			||||||
    text-align: center;
 | 
					    text-align: center;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  td:nth-child(6) {
 | 
					  td:nth-child(6) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -72,8 +72,8 @@ const mutations = {
 | 
				
			||||||
  addHistory(state, players) {
 | 
					  addHistory(state, players) {
 | 
				
			||||||
    if (!state.nomination || state.lockedVote <= players.length) return;
 | 
					    if (!state.nomination || state.lockedVote <= players.length) return;
 | 
				
			||||||
    const isBanishment = players[state.nomination[1]].role.team === "traveler";
 | 
					    const isBanishment = players[state.nomination[1]].role.team === "traveler";
 | 
				
			||||||
    console.log(isBanishment);
 | 
					 | 
				
			||||||
    state.voteHistory.push({
 | 
					    state.voteHistory.push({
 | 
				
			||||||
 | 
					      timestamp: new Date(),
 | 
				
			||||||
      nominator: players[state.nomination[0]].name,
 | 
					      nominator: players[state.nomination[0]].name,
 | 
				
			||||||
      nominee: players[state.nomination[1]].name,
 | 
					      nominee: players[state.nomination[1]].name,
 | 
				
			||||||
      type: isBanishment ? "Banishment" : "Execution",
 | 
					      type: isBanishment ? "Banishment" : "Execution",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue