diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-09-10 21:05:59 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-09-13 20:06:36 +0200 |
commit | 6407378d92eb8880e35e8ee33e1801136a1a44a7 (patch) | |
tree | 9bac140875ba3ba3a29c8fee864b0eca8d922399 /views/head.pug | |
parent | 2da7e775f26043e0d475faf89d1fce03c798b1e3 (diff) | |
download | server-6407378d92eb8880e35e8ee33e1801136a1a44a7.tar.gz |
Set player_count in database for faster and easier logic.
Track ready to start and unjoined games in "active" header.
Diffstat (limited to 'views/head.pug')
-rw-r--r-- | views/head.pug | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/views/head.pug b/views/head.pug index 2322250..fa2b042 100644 --- a/views/head.pug +++ b/views/head.pug @@ -45,10 +45,11 @@ mixin gamelist(list,hide_title=0) let className = "game_item" if (item.your_turn) className += " your_turn" if (item.is_unread) className += " unread" - if (item.status === 0 && !item.is_full) className += " open" - else if (item.status === 0 && item.is_full) className += " ready" - else if (item.status === 1 && !item.is_full) className += " replacement" - else if (item.status === 1 && item.is_full) className += " active" + if (item.status === 0 && item.join_count === 0) className += " open replacement" + else if (item.status === 0 && item.join_count !== item.player_count) className += " open" + else if (item.status === 0 && item.join_count === item.player_count) className += " ready" + else if (item.status === 1 && item.join_count !== item.player_count) className += " replacement" + else if (item.status === 1 && item.join_count === item.player_count) className += " active" else if (item.status === 2) className += " finished" else if (item.status === 3) className += " archived" @@ -63,12 +64,14 @@ mixin gamelist(list,hide_title=0) case item.status when 0 - if item.is_ready && item.your_turn + if item.join_count === item.player_count a(class="command" href=`/join/${item.game_id}`) Start else a(class="command" href=`/join/${item.game_id}`) Join when 1 - if item.is_yours + if item.join_count !== item.player_count + a(class="command" href="/join/"+item.game_id) Join + else if item.is_yours if item.your_role a(class="command" href=`/${item.title_id}/play.html?game=${item.game_id}&role=${encodeURIComponent(item.your_role)}`) Play else |