mirror of
https://github.com/AlecM33/Werewolf.git
synced 2026-01-01 16:59:29 +01:00
some improvements to the lobby view
This commit is contained in:
@@ -11,7 +11,10 @@ export class GameStateRenderer {
|
||||
document.querySelectorAll('.lobby-player').forEach((el) => el.remove())
|
||||
let lobbyPlayersContainer = document.getElementById("lobby-players");
|
||||
if (this.gameState.userType !== globals.USER_TYPES.MODERATOR) {
|
||||
renderClient(this.gameState.client, lobbyPlayersContainer);
|
||||
let modEl = document.createElement("div");
|
||||
modEl.innerText = this.gameState.moderator.name;
|
||||
modEl.classList.add('lobby-player');
|
||||
lobbyPlayersContainer.appendChild(modEl);
|
||||
}
|
||||
for (let person of this.gameState.people) {
|
||||
let personEl = document.createElement("div");
|
||||
@@ -26,7 +29,7 @@ export class GameStateRenderer {
|
||||
playerCount = 1 + this.gameState.people.length;
|
||||
}
|
||||
document.querySelector("label[for='lobby-players']").innerText =
|
||||
"Players ( " + playerCount + " / " + getGameSize(this.gameState.deck) + " )";
|
||||
"Other People ( " + playerCount + " )";
|
||||
}
|
||||
|
||||
renderLobbyHeader() {
|
||||
@@ -47,15 +50,6 @@ export class GameStateRenderer {
|
||||
let copyImg = document.createElement("img");
|
||||
copyImg.setAttribute("src", "../images/copy.svg");
|
||||
gameLinkContainer.appendChild(copyImg);
|
||||
|
||||
let moderatorContainer = document.getElementById("moderator");
|
||||
let text, modClass;
|
||||
if (this.gameState.userType === globals.USER_TYPES.MODERATOR || this.gameState.userType === globals.USER_TYPES.TEMPORARY_MODERATOR) {
|
||||
moderatorContainer.innerText = this.gameState.moderator.name + " (you)";
|
||||
moderatorContainer.classList.add('moderator-client');
|
||||
} else {
|
||||
moderatorContainer.innerText = this.gameState.moderator.name;
|
||||
}
|
||||
}
|
||||
|
||||
renderLobbyFooter() {
|
||||
@@ -105,8 +99,9 @@ export class GameStateRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
function renderClient(client, container) {
|
||||
let clientEl = document.createElement("div");
|
||||
function renderLobbyPlayer(name, userType) {
|
||||
let el = document.createElement("div");
|
||||
el.innerHTML = ""
|
||||
clientEl.innerText = client.name + ' (you)';
|
||||
clientEl.classList.add('lobby-player');
|
||||
clientEl.classList.add('lobby-player-client');
|
||||
|
||||
@@ -7,14 +7,10 @@ export const templates = {
|
||||
"</div>" +
|
||||
"<div id='game-time'></div>" +
|
||||
"<div id='game-player-count'></div>" +
|
||||
"<div>" +
|
||||
"<label for='moderator'>Moderator</label>" +
|
||||
"<div id='moderator'></div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"<div>" +
|
||||
"<div>" +
|
||||
"<label for='lobby-players'>Players</label>" +
|
||||
"<label for='lobby-players'>Other People</label>" +
|
||||
"<div id='lobby-players'></div>" +
|
||||
"</div>" +
|
||||
"<div id='lobby-footer'>" +
|
||||
|
||||
Reference in New Issue
Block a user