summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/join.js6
-rw-r--r--server.js8
-rw-r--r--views/join.pug10
3 files changed, 17 insertions, 7 deletions
diff --git a/public/join.js b/public/join.js
index 2703f97..f199329 100644
--- a/public/join.js
+++ b/public/join.js
@@ -163,8 +163,12 @@ function update() {
message.innerHTML = `Waiting for ${game.owner_name} to start the game...`
else
message.innerHTML = "Waiting for players to join..."
- } else {
+ } else if (game.status === 1) {
message.innerHTML = `<a href="/${game.title_id}/play:${game.game_id}">Observe</a>`
+ } else if (game.status === 2) {
+ message.innerHTML = `<a href="/${game.title_id}/play:${game.game_id}">Review</a>`
+ } else {
+ message.innerHTML = `<a href="/${game.title_id}/play:${game.game_id}">Enter</a>`
}
if (game.owner_id === user_id) {
diff --git a/server.js b/server.js
index 4c11ed8..342e9a1 100644
--- a/server.js
+++ b/server.js
@@ -1287,7 +1287,13 @@ app.get('/join/:game_id', must_be_logged_in, function (req, res) {
let game = SQL_SELECT_GAME_VIEW.get(game_id)
if (!game)
return res.status(404).send("Invalid game ID.")
- annotate_game(game, req.user.user_id)
+
+ let options = JSON.parse(game.options)
+ if (game.options === '{}')
+ game.human_options = "None"
+ else
+ game.human_options = format_options(options)
+
let roles = get_game_roles(game.title_id, game.scenario, game.options)
let players = SQL_SELECT_PLAYERS_JOIN.all(game_id)
let ready = (game.status === 0) && is_game_ready(game.title_id, game.scenario, game.options, players)
diff --git a/views/join.pug b/views/join.pug
index 39d2ff9..7a929d1 100644
--- a/views/join.pug
+++ b/views/join.pug
@@ -32,15 +32,15 @@ html
div.logo
+gamecover(game.title_id)
- p
+ div
if game.is_private
| Owner: #{game.owner_name} (private)
else
| Owner: #{game.owner_name}
- br
- | Scenario: #{game.scenario}
- br
- | Options: #{game.human_options}
+ div Scenario: #{game.scenario}
+ div Options: #{game.human_options}
+ if game.status === 2
+ div Result: !{game.result}
p= game.description || "No description."