Skip to content

Commit

Permalink
set live clocks only for bot setup
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHeppell committed Mar 4, 2025
1 parent 81510b5 commit 6c0e5b8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
8 changes: 8 additions & 0 deletions app/templating/SetupHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ trait SetupHelper { self: I18nHelper =>
(TimeMode.Unlimited.id.toString, trans.unlimited.txt(), none)
)

def translatedTimeModeChoicesLive(implicit lang: Lang) =
List(
(TimeMode.FischerClock.id.toString, trans.realTime.txt(), none),
(TimeMode.ByoyomiClock.id.toString, trans.byoyomiTime.txt(), none),
(TimeMode.BronsteinDelayClock.id.toString, trans.bronsteinDelay.txt(), none),
(TimeMode.SimpleDelayClock.id.toString, trans.simpleDelay.txt(), none)
)

val goHandicapChoices: List[SelectChoice] = {
(0 to 9).toList map { s =>
(s.toString, s.toString, none)
Expand Down
7 changes: 5 additions & 2 deletions app/views/setup/bits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private object bits {
)
)

def renderTimeMode(form: Form[_], allowAnon: Boolean)(implicit ctx: Context) =
def renderTimeMode(form: Form[_], allowAnon: Boolean, allowCorrespondence: Boolean)(implicit ctx: Context) =
div(cls := "time_mode_config optional_config")(
div(
cls := List(
Expand All @@ -198,7 +198,10 @@ private object bits {
target := "_blank"
)(trans.timeControl())
),
renderSelect(form("timeMode"), translatedTimeModeChoices)
renderSelect(
form("timeMode"),
if (allowCorrespondence) translatedTimeModeChoices else translatedTimeModeChoicesLive
)
),
if (ctx.blind)
frag(
Expand Down
6 changes: 3 additions & 3 deletions app/views/setup/forms.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object forms {
) {
frag(
renderVariant(form, translatedVariantChoicesWithVariants),
renderTimeMode(form, allowAnon = false),
renderTimeMode(form, allowAnon = false, allowCorrespondence = true),
ctx.isAuth option frag(
div(cls := "mode_choice buttons")(
renderRadios(form("mode"), translatedModeChoices)
Expand Down Expand Up @@ -71,7 +71,7 @@ object forms {
),
renderVariant(form, translatedAiVariantChoices),
fenInput(form("fen"), strict = true, validFen),
renderTimeMode(form, allowAnon = true),
renderTimeMode(form, allowAnon = true, allowCorrespondence = true),
if (ctx.blind)
frag(
renderLabel(form("level"), trans.strength()),
Expand Down Expand Up @@ -116,7 +116,7 @@ object forms {
fenInput(form("fen"), strict = false, validFen),
renderGoOptions(form),
renderBackgammonOptions(form),
renderTimeMode(form, allowAnon = true),
renderTimeMode(form, allowAnon = true, allowCorrespondence = user.fold(true)(u => !u.isBot)),
renderMultiMatch(form),
ctx.isAuth option div(cls := "mode_choice buttons")(
renderRadios(form("mode"), translatedModeChoices)
Expand Down

0 comments on commit 6c0e5b8

Please sign in to comment.