From ad4a4ea757cce61cde102be2aea2d07fe55aaa2c Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 25 Jun 2021 17:41:05 +0200 Subject: New and improved join page with server sent events. --- views/join.ejs | 93 ++++++++++++++++------------------------------------------ 1 file changed, 25 insertions(+), 68 deletions(-) (limited to 'views/join.ejs') diff --git a/views/join.ejs b/views/join.ejs index 2da5f03..46c1e56 100644 --- a/views/join.ejs +++ b/views/join.ejs @@ -1,14 +1,23 @@ -<%- include('header', { title: game.title_name, refresh: game.status == 0 ? 15 : 0 }) %> +<%- include('header', { title: game.title_name }) -%> + + +

+

Owner: <%= game.owner_name %>
@@ -17,74 +26,22 @@ Private: <%= game.private ? "yes" : "no" %> Scenario: <%= game.scenario %>
Description: <%= game.description || "No description." %> +
+Status: +
+Result:
-

-<% - roles.forEach((role) => { - %><% }); %> + +<% roles.forEach((role) => { %><% }); %> -<% - roles.forEach((role) => { - if (game.active == role || game.active == "Both" || game.active == "All") { - %>
<%= role %><% - }); -%> +<% roles.forEach((role) => { %><%= role %>
-
<% - } else { - %><% - } - let p = players.find(p => p.role == role); - if (game.status == 0) { - if (p) { - if ((p.user_id == user.user_id) || (game.owner_id == user.user_id)) { - %> <% - %><%= p.name %><% - } else { - %><%= p.name %><% - } - } else { - %>Join<% - } - } else { - if (p) { - if (p.user_id == user.user_id) { - %>Play<% - } else { - %><%= p.name %><% - } - } else { - %>Empty<% - } - } - }); - if (game.status > 0 && !players.some(p => p.user_id == user.user_id)) { - %> -
View - <% - } -%> +-

-<% - if (game.status == 0) { - if (players.length == roles.length) { - if (game.owner_id == user.user_id) { - %>

<% - } else { - %>Waiting for <%= game.owner_name %> to start the game.<% - } - } else { - %>Waiting for players to join the game.<% - } - } - if (game.status == 2 && players.some(p => p.user_id == user.user_id)) { - %>
<% - } - if (game.owner_id == user.user_id && (game.status == 0 || solo)) { - %>


<% - } -%> + + -- cgit v1.2.3