From 5d5f3baa5ae2197fec783ace10d03952e669ed1e Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 15 Sep 2023 19:17:32 +0200 Subject: 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. --- views/create.pug | 22 ++++++++++++++++++++++ views/head.pug | 12 ++++++++++-- views/join.pug | 8 ++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) (limited to 'views') 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 – many moves per day + + br + label + input(type="radio" name="pace" value="3") + | #{EMOJI_SLOW} Slow – one move per day + 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 - | #{item.game_id} – #{item.title_name} (#{item.scenario}) #{chat_icon} + | #{pace_icon} #{item.game_id} – #{item.title_name} (#{item.scenario}) #{chat_icon} else div - | #{item.game_id} – #{item.title_name} #{chat_icon} + | #{pace_icon} #{item.game_id} – #{item.title_name} #{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 – many moves per day. + when 3 + p #{EMOJI_SLOW} Slow – one move per day. + if game.notice p i= game.notice -- cgit v1.2.3