Skip to content

Commit

Permalink
Merge branch 'master' into orientation-dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
johndoknjas committed Nov 4, 2024
2 parents c650a89 + 8fb94a3 commit 44157b6
Show file tree
Hide file tree
Showing 343 changed files with 471 additions and 532 deletions.
12 changes: 12 additions & 0 deletions modules/coreI18n/src/main/key.scala
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ object I18nKey:
val `notYetStarted`: I18nKey = "broadcast:notYetStarted"
val `officialWebsite`: I18nKey = "broadcast:officialWebsite"
val `standings`: I18nKey = "broadcast:standings"
val `officialStandings`: I18nKey = "broadcast:officialStandings"
val `iframeHelp`: I18nKey = "broadcast:iframeHelp"
val `webmastersPage`: I18nKey = "broadcast:webmastersPage"
val `pgnSourceHelp`: I18nKey = "broadcast:pgnSourceHelp"
Expand All @@ -194,6 +195,17 @@ object I18nKey:
val `ratingDiff`: I18nKey = "broadcast:ratingDiff"
val `gamesThisTournament`: I18nKey = "broadcast:gamesThisTournament"
val `score`: I18nKey = "broadcast:score"
val `perPage`: I18nKey = "broadcast:perPage"
val `allTeams`: I18nKey = "broadcast:allTeams"
val `tournamentFormat`: I18nKey = "broadcast:tournamentFormat"
val `tournamentLocation`: I18nKey = "broadcast:tournamentLocation"
val `topPlayers`: I18nKey = "broadcast:topPlayers"
val `timezone`: I18nKey = "broadcast:timezone"
val `fideRatingCategory`: I18nKey = "broadcast:fideRatingCategory"
val `optionalDetails`: I18nKey = "broadcast:optionalDetails"
val `upcomingBroadcasts`: I18nKey = "broadcast:upcomingBroadcasts"
val `pastBroadcasts`: I18nKey = "broadcast:pastBroadcasts"
val `allBroadcastsByMonth`: I18nKey = "broadcast:allBroadcastsByMonth"
val `nbBroadcasts`: I18nKey = "broadcast:nbBroadcasts"

object challenge:
Expand Down
2 changes: 1 addition & 1 deletion modules/puzzle/src/main/PuzzleBatch.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class PuzzleBatch(colls: PuzzleColls, anonApi: PuzzleAnon, pathApi: Puzzle
else PuzzleTier.top
pathApi
.nextFor(angle, tier, difficulty, Set.empty)
.orFail(s"No puzzle path for ${me.username} $tier")
.orFail(s"No puzzle path for batch ${me.username} $angle $tier")
.flatMap: pathId =>
colls.path:
_.aggregateList(nb): framework =>
Expand Down
2 changes: 1 addition & 1 deletion modules/puzzle/src/main/PuzzleSelector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class PuzzleSelector(
def switchPath(withRetries: Int)(tier: PuzzleTier) =
pathApi
.nextFor(angle, tier, session.settings.difficulty, session.previousPaths)
.orFail(s"No puzzle path for ${me.username} $angle $tier")
.orFail(s"No puzzle path for selection ${me.username} $angle $tier")
.flatMap { pathId =>
val newSession = session.switchTo(pathId)
sessionApi.set(newSession)
Expand Down
2 changes: 2 additions & 0 deletions modules/relay/src/main/RelayRound.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ case class RelayRound(
def hasStartedEarly = startedAt.exists(at => startsAtTime.exists(_.isAfter(at)))
def shouldHaveStarted = hasStarted || startsAtTime.exists(_.isBefore(nowInstant))

def shouldHaveStarted1Hour = !hasStarted && startsAtTime.exists(_.isBefore(nowInstant.minusHours(1)))

def shouldGiveUp =
!hasStarted && startsAtTime.match
case Some(at) => at.isBefore(nowInstant.minusHours(3))
Expand Down
5 changes: 4 additions & 1 deletion modules/relay/src/main/RelayTour.scala
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,11 @@ object RelayTour:
~round.sync.log.lastErrors.some
.filter(_.nonEmpty)
.orElse:
(round.hasStarted && round.sync.upstream.isDefined && !round.sync.ongoing)
(round.hasStarted && round.sync.hasUpstream && !round.sync.ongoing)
.option(List("Not syncing!"))
.orElse:
round.shouldHaveStarted1Hour.option:
List(if round.sync.hasUpstream then "Upstream has not started" else "Nothing pushed yet")

case class WithLastRound(tour: RelayTour, round: RelayRound, group: Option[RelayGroup.Name])
extends RelayRound.AndTourAndGroup:
Expand Down
20 changes: 10 additions & 10 deletions modules/relay/src/main/ui/RelayFormUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -421,30 +421,30 @@ final class RelayFormUi(helpers: Helpers, ui: RelayUi, tourUi: RelayTourUi):
(!Granter.opt(_.StudyAdmin)).option(div(cls := "form-group")(ui.howToUse)),
form3.globalError(form),
form3.group(form("name"), trb.tournamentName())(form3.input(_)(autofocus)),
form3.fieldset("Optional details", toggle = tg.exists(_.tour.info.nonEmpty).some)(
form3.fieldset(trb.optionalDetails(), toggle = tg.exists(_.tour.info.nonEmpty).some)(
form3.split(
form3.group(
form("info.format"),
"Tournament format",
trb.tournamentFormat(),
help = frag("""e.g. "8-player round-robin" or "5-round Swiss"""").some,
half = true
)(form3.input(_)),
form3.group(
form("info.location"),
"Tournament Location",
trb.tournamentLocation(),
half = true
)(form3.input(_))
),
form3.split(
form3.group(
form("info.players"),
"Top players",
trb.topPlayers(),
help = frag("Mention up to 4 of the best players participating").some,
half = true
)(form3.input(_)),
form3.group(
form("info.timeZone"),
"Time zone",
trb.timezone(),
help = frag("Used to set round dates using their local time").some,
half = true
):
Expand All @@ -453,13 +453,13 @@ final class RelayFormUi(helpers: Helpers, ui: RelayUi, tourUi: RelayTourUi):
form3.split(
form3.group(
form("info.tc"),
"Time control",
trs.timeControl(),
help = frag(""""Classical" or "Rapid" or "Rapid & Blitz"""").some,
half = true
)(form3.input(_)),
form3.group(
form("info.fideTc"),
"FIDE rating category",
trb.fideRatingCategory(),
help = frag("Which FIDE ratings to use").some,
half = true
):
Expand All @@ -472,13 +472,13 @@ final class RelayFormUi(helpers: Helpers, ui: RelayUi, tourUi: RelayTourUi):
form3.split(
form3.group(
form("info.website"),
"Official Website",
trb.officialWebsite(),
help = frag("External website URL").some,
half = true
)(form3.input(_)),
form3.group(
form("info.standings"),
"Official Standings",
trb.officialStandings(),
help = frag("External website URL, e.g. chess-results.com, info64.org").some,
half = true
)(form3.input(_))
Expand Down Expand Up @@ -517,7 +517,7 @@ final class RelayFormUi(helpers: Helpers, ui: RelayUi, tourUi: RelayTourUi):
form3.split(
form3.checkbox(
form("teamTable"),
"Team tournament",
trans.team.teamTournament(),
help = frag("Show a team leaderboard. Requires WhiteTeam and BlackTeam PGN tags.").some,
half = true
)
Expand Down
6 changes: 3 additions & 3 deletions modules/relay/src/main/ui/RelayTourUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ final class RelayTourUi(helpers: Helpers, ui: RelayUi):
nonEmptyTier(_.NORMAL, "normal"),
upcoming.nonEmpty.option(
frag(
h2(cls := "relay-index__section")("Upcoming broadcasts"),
h2(cls := "relay-index__section")(trc.upcomingBroadcasts()),
st.section(cls := "relay-cards relay-cards--upcoming"):
upcoming.map:
card.render(_, live = _ => false)
)
),
h2(cls := "relay-index__section")("Past broadcasts"),
h2(cls := "relay-index__section")(trc.pastBroadcasts()),
div(cls := "relay-cards relay-cards--past"):
past.map: t =>
card.render(t, live = _ => false)
,
h2(cls := "relay-index__section relay-index__calendar"):
a(cls := "button button-fat button-no-upper", href := routes.RelayTour.calendar)(
strong(trc.broadcastCalendar()),
small("View all broadcasts by month")
small(trc.allBroadcastsByMonth())
)
)
)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"//": "NOTE: lint-staged patterns must stay in sync with bin/git-hooks/pre-commit!",
"dependencies": {
"@types/lichess": "workspace:*",
"@types/node": "^22.8.6",
"@types/node": "^22.8.7",
"@types/web": "^0.0.166",
"@typescript-eslint/eslint-plugin": "^8.12.2",
"@typescript-eslint/parser": "^8.12.2",
Expand Down
Loading

0 comments on commit 44157b6

Please sign in to comment.