Changing tournament time to status text

pull/9946/head
frpg 2021-10-10 18:05:06 +01:00 committed by Thibault Duplessis
parent ba94b07029
commit f38de37949
3 changed files with 17 additions and 38 deletions

View File

@ -28,7 +28,7 @@ object publicChat {
div(cls := "player_chats")(
tourChats.map { case (tournament, chat) =>
div(cls := "game", dataChan := "tournament", dataRoom := tournament.id)(
chatOf(tournamentTitleFrag(routes.Tournament.show(tournament.id), tournament), chat)
chatOf(tournamentTitle(tournament), chat)
)
}
),
@ -37,7 +37,7 @@ object publicChat {
div(cls := "player_chats")(
swissChats.map { case (swiss, chat) =>
div(cls := "game", dataChan := "swiss", dataRoom := swiss.id.value)(
chatOf(swissTitleFrag(routes.Swiss.show(swiss.id.value), swiss.name), chat)
chatOf(swissTitle(swiss), chat)
)
}
)
@ -78,28 +78,25 @@ object publicChat {
)
)
private def swissTitleFrag(url: Call, name: String) =
frag(
a(cls := "title", href := url)(name)
)
private def swissTitle(swiss: lila.swiss.Swiss) =
a(cls := "title", href := routes.Swiss.show(swiss.id.value))(swiss.name)
private def tournamentTitleFrag(url: Call, tournament: lila.tournament.Tournament) = {
frag(
private def tournamentTitle(tournament: lila.tournament.Tournament) =
div(
cls := "title-time-container",
div(cls := "title-container", a(cls := "title", href := url)(tournament.name)),
div(cls := "title-container", a(cls := "title", href := routes.Tournament.show(tournament.id))(tournament.name)),
div(
cls := "time-container",
span(
cls := List(
"tournament-time finished" -> tournament.isFinished,
"tournament-time in-progress" -> tournament.isStarted,
"tournament-time starting" -> (!tournament.isFinished && !tournament.isStarted)
"tournament-status" -> true,
tournament.status.name.toLowerCase -> true
)
)(tournament.countdown)
)(tournament.status.name)
)
)
)
}
}

View File

@ -121,24 +121,6 @@ case class Tournament(
"%02d:%02d".format(s / 60, s % 60)
}
private def optionalHours(s: Int) = if (s / 3600 > 0) (s / 3600).toString + "h " else ""
private def minutes(s: Int) = (s % 3600) / 60;
private def startsIn: String =
secondsToStart pipe { s =>
"-%s%2dm".format(optionalHours(s), minutes(s))
}
private def endsIn: String =
secondsToFinish pipe { s =>
"%s%2dm".format(optionalHours(s), minutes(s))
}
def countdown: String =
if (isFinished) "Over"
else if (isStarted) endsIn
else startsIn
def schedulePair = schedule map { this -> _ }
def winner =

View File

@ -50,22 +50,22 @@
background-color: $time-container-bg;
}
.player_chats .game .title-time-container .time-container .tournament-time {
.player_chats .game .title-time-container .time-container .tournament-status {
text-align: center;
font-weight: bolder;
display: block;
padding: 6px;
}
.player_chats .game .title-time-container .time-container .tournament-time.starting {
.player_chats .game .title-time-container .time-container .tournament-status.created {
color: $c-warn;
}
.player_chats .game .title-time-container .time-container .tournament-time.in-progress {
.player_chats .game .title-time-container .time-container .tournament-status.started {
color: $c-good;
}
.player_chats .game .title-time-container .time-container .tournament-time.finished {
.player_chats .game .title-time-container .time-container .tournament-status.finished {
color: $c-bad;
}
}