diff options
-rw-r--r-- | public/join.js | 27 | ||||
-rw-r--r-- | views/head.pug | 6 |
2 files changed, 24 insertions, 9 deletions
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) diff --git a/views/head.pug b/views/head.pug index d9a1364..cffc55a 100644 --- a/views/head.pug +++ b/views/head.pug @@ -59,6 +59,10 @@ mixin gamelist(list,hide_title=0) else if (item.pace === 1) pace_icon = EMOJI_LIVE, pace_text = "Live!" else if (item.pace === 2) pace_icon = EMOJI_FAST, pace_text = "Fast - many moves per day" else if (item.pace === 3) pace_icon = EMOJI_SLOW, pace_text = "Slow - one move per day" + let invite_count = 0 + for (let p of item.players) + if (p.is_invite) + invite_count++ div(class=className) div.game_head @@ -76,7 +80,7 @@ mixin gamelist(list,hide_title=0) else a(class="command" href=`/join/${item.game_id}`) Join when 1 - if item.join_count !== item.player_count + if item.join_count !== item.player_count || invite_count > 0 a(class="command" href="/join/"+item.game_id) Join else if item.is_yours if item.your_role |