summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-09-15 19:17:32 +0200
committerTor Andersson <tor@ccxvii.net>2023-09-20 20:29:16 +0200
commit5d5f3baa5ae2197fec783ace10d03952e669ed1e (patch)
tree1b22bf8d4f52873fdbee0aca5b2ffcf0803fd8e9 /views
parent58530e70bbd741d29fbc7b7904c37dcbc3ec1648 (diff)
downloadserver-5d5f3baa5ae2197fec783ace10d03952e669ed1e.tar.gz
Add pace property to games.
Currently unenforced and only visual effect in game listings.- Future time control and user penalty features may make use of it.
Diffstat (limited to 'views')
-rw-r--r--views/create.pug22
-rw-r--r--views/head.pug12
-rw-r--r--views/join.pug8
3 files changed, 40 insertions, 2 deletions
diff --git a/views/create.pug b/views/create.pug
index 32fa01b..95e0ea0 100644
--- a/views/create.pug
+++ b/views/create.pug
@@ -29,6 +29,27 @@ html
br
input(type="text" autocomplete="off" name="notice" size=50 placeholder="What are you looking for?")
+ p Pace:
+ br
+ label
+ input(type="radio" name="pace" value="0" checked)
+ | Any
+
+ br
+ label
+ input(type="radio" name="pace" value="1")
+ | #{EMOJI_LIVE} Live
+
+ br
+ label
+ input(type="radio" name="pace" value="2")
+ | #{EMOJI_FAST} Fast <i>&ndash; many moves per day</i>
+
+ br
+ label
+ input(type="radio" name="pace" value="3")
+ | #{EMOJI_SLOW} Slow <i>&ndash; one move per day</i>
+
p
label
input(type="checkbox" name="is_random" value="true")
@@ -38,6 +59,7 @@ html
label
input(type="checkbox" name="is_private" value="true")
| Private
+
if limit
p.error= limit
else
diff --git a/views/head.pug b/views/head.pug
index 0fc415b..d9a1364 100644
--- a/views/head.pug
+++ b/views/head.pug
@@ -43,6 +43,8 @@ mixin gamelist(list,hide_title=0)
div
-
let className = "game_item"
+ let pace_icon = ""
+ let pace_text = ""
let chat_icon = ""
if (item.your_turn) className += " your_turn"
if (item.status === 0 && item.join_count === 0) className += " open replacement"
@@ -53,15 +55,19 @@ mixin gamelist(list,hide_title=0)
else if (item.status === 2) className += " finished"
else if (item.status === 3) className += " archived"
if (item.is_unread) chat_icon = "\u{1f4dd}"
+ if (item.pace === 0) pace_icon = "", pace_text = ""
+ 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"
div(class=className)
div.game_head
if item.scenario.length <= 2
div
- | <a href="/join/#{item.game_id}">#{item.game_id} &#x2013; #{item.title_name} (#{item.scenario})</a> #{chat_icon}
+ | #{pace_icon} <a href="/join/#{item.game_id}">#{item.game_id} &#x2013; #{item.title_name} (#{item.scenario})</a> #{chat_icon}
else
div
- | <a href="/join/#{item.game_id}">#{item.game_id} &#x2013; #{item.title_name}</a> #{chat_icon}
+ | #{pace_icon} <a href="/join/#{item.game_id}">#{item.game_id} &#x2013; #{item.title_name}</a> #{chat_icon}
case item.status
when 0
@@ -94,6 +100,8 @@ mixin gamelist(list,hide_title=0)
div.game_info
if item.notice
i= item.notice
+ else
+ i= pace_text
if item.scenario !== "Standard" && item.scenario !== "Historical" && item.scenario.length > 2
div Scenario: #{item.scenario}
unless item.human_options === "None"
diff --git a/views/join.pug b/views/join.pug
index 3110bd3..5c3c296 100644
--- a/views/join.pug
+++ b/views/join.pug
@@ -61,6 +61,14 @@ html
unless game.human_options === "None"
p Options: #{game.human_options}.
+ case game.pace
+ when 1
+ p #{EMOJI_LIVE} Live!
+ when 2
+ p #{EMOJI_FAST} Fast &ndash; many moves per day.
+ when 3
+ p #{EMOJI_SLOW} Slow &ndash; one move per day.
+
if game.notice
p
i= game.notice