From f642d234d346138552809a9c11357127e15fb0f3 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 10 Oct 2023 18:50:20 +0200 Subject: Handle invites for active games. --- public/join.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'public') diff --git a/public/join.js b/public/join.js index 2774241..704868f 100644 --- a/public/join.js +++ b/public/join.js @@ -184,13 +184,25 @@ function update() { element.innerHTML = user_link(player) break case 1: - element.classList.toggle("is_active", is_active(player, role)) - if (player.user_id === user_id) - element.innerHTML = play_link(player) + action_link(player, "part", "red", "\u274c") - else if (game.owner_id === user_id) - element.innerHTML = user_link(player) + action_link(player, "kick", "red", "\u274c") - else - element.innerHTML = user_link(player) + if (player.is_invite) { + element.classList.add("is_invite") + if (player.user_id === user_id) + element.innerHTML = player.name + " ?" + + action_link(player, "part", "red", "\u274c") + + action_link(player, "accept", "green", "\u2714") + else if (game.owner_id === user_id) + element.innerHTML = user_link(player) + " ?" + action_link(player, "kick", "red", "\u274c") + else + element.innerHTML = user_link(player) + " ?" + } else { + element.classList.toggle("is_active", is_active(player, role)) + if (player.user_id === user_id) + element.innerHTML = play_link(player) + action_link(player, "part", "red", "\u274c") + else if (game.owner_id === user_id) + element.innerHTML = user_link(player) + action_link(player, "kick", "red", "\u274c") + else + element.innerHTML = user_link(player) + } break case 0: if (player.is_invite) { @@ -204,7 +216,6 @@ function update() { else element.innerHTML = user_link(player) + " ?" } else { - element.classList.remove("is_invite") if (player.user_id === user_id) element.innerHTML = player.name + action_link(player, "part", "red", "\u274c") else if (game.owner_id === user_id) -- cgit v1.2.3