From 652852e3104ce4020de53231ee7691a4970439d6 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 1 May 2021 00:48:35 +0200 Subject: Add server and lobby code. --- views/profile.ejs | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 views/profile.ejs (limited to 'views/profile.ejs') diff --git a/views/profile.ejs b/views/profile.ejs new file mode 100644 index 0000000..60f1ff9 --- /dev/null +++ b/views/profile.ejs @@ -0,0 +1,84 @@ +<%- include('header', { title: "Rally the Troops!", refresh: (active_games.length > 0 ? 300 : 0) }) %> + + + +

+Welcome, <%= user.name %>! +

+Your mail address is <%= user.mail %>. + +
+ +

+Change password + +

+Logout + +<% if (open_games.length > 0) { %> +

Open Games

+ + +
IDGameScenarioPlayersDescriptionCreated +<% open_games.forEach((row) => { %> +
<%= row.game_id %> +<%= row.title_name %> +<%= row.scenario %> +<%= row.players.join(", ") %> +<%= row.description %> +<%= row.ctime %> +Join +<% }); %> +
+<% } %> + +<% if (active_games.length > 0) { %> +

Active Games

+ + +
IDGameScenarioPlayersDescriptionChangedTurn +<% active_games.forEach((row) => { %> +
<%= row.game_id %> +<%= row.title_name %> +<%= row.scenario %> +<%= row.players.join(", ") %> +<%= row.description %> +<%= row.mtime %> +<% + if (row.your_turn) { + %><%= row.active %><% + } else { + %><%= row.active %><% + } + if (row.players.reduce((n,p) => n + (p === user.name ? 1 : 0), 0) == 1) { + %>Play<% + } else { + %>Play<% + } +%> +<% }); %> +
+<% } %> + +<% if (finished_games.length > 0) { %> +

Finished Games

+ + +
IDGameScenarioPlayersDescriptionFinishedResult +<% finished_games.forEach((row) => { %> +
<%= row.game_id %> +<%= row.title_name %> +<%= row.scenario %> +<%= row.players.join(", ") %> +<%= row.description %> +<%= row.mtime %> +<%= row.result %> +View +<% }); %> +
+<% } %> + +<% if (open_games.length == 0 && active_games.length == 0 && finished_games.length == 0) { %> +

+You don't have any current or finished games. +<% } %> -- cgit v1.2.3