From 401a13ff9e7792f0e060ccfb15afdbd3bc5fc557 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 28 Jun 2021 12:38:42 +0200 Subject: Clean up SQL and use table views. --- public/common/client.js | 2 +- public/join.js | 15 +++++++-------- public/style.css | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'public') diff --git a/public/common/client.js b/public/common/client.js index 28b4f8e..670fa07 100644 --- a/public/common/client.js +++ b/public/common/client.js @@ -220,7 +220,7 @@ function init_client(roles) { document.querySelector(".grid_top").classList.add(player); for (let i = 0; i < roles.length; ++i) { let p = players.find(p => p.role == roles[i]); - document.querySelector(USER_SEL[i]).textContent = p ? p.name : "NONE"; + document.querySelector(USER_SEL[i]).textContent = p ? p.user_name : "NONE"; } }); diff --git a/public/join.js b/public/join.js index d2d39ab..5353f11 100644 --- a/public/join.js +++ b/public/join.js @@ -84,24 +84,23 @@ function update() { let element = document.getElementById(role_id); if (player) { if (game.status > 0) { - if (game.active === role || game.active === "Both" || game.active === "All") - element.className = "your_turn"; + if (game.active_role === role || game.active_role === "Both" || game.active_role === "All") + element.className = "is_your_turn"; else element.className = ""; if (player.user_id === user_id) element.innerHTML = `Play`; else - element.innerHTML = player.name; + element.innerHTML = player.user_name; } else { if ((player.user_id === user_id) || (game.owner_id === user_id)) - element.innerHTML = `\u274c ${player.name}`; + element.innerHTML = `\u274c ${player.user_name}`; else - element.innerHTML = player.name; + element.innerHTML = player.user_name; } } else { if (game.status === 0) - //element.innerHTML = `Join`; - element.innerHTML = `Join`; + element.innerHTML = `Join`; else element.innerHTML = "Empty"; } @@ -122,7 +121,7 @@ function update() { if (game.owner_id === user_id) { window.start_button.disabled = !ready; window.start_button.classList = (game.status === 0) ? "" : "hide"; - window.delete_button.classList = (game.status === 0 || solo) ? "" : "hide"; + window.delete_button.classList = (game.status === 0 || game.is_solo) ? "" : "hide"; } if (game.status === 0 && ready) diff --git a/public/style.css b/public/style.css index 0503574..d5c4230 100644 --- a/public/style.css +++ b/public/style.css @@ -39,7 +39,7 @@ input[type="text"], input[type="password"] { padding: 5px; } select { padding-right: 20px; } form { display: inline; } .nowrap { white-space: nowrap; } -.your_turn { background-color: lemonchiffon; } +.is_your_turn { background-color: lemonchiffon; } button, select { margin: 5px 10px 5px 0; padding: 1px 10px; -- cgit v1.2.3