2018-12-04 23:58:08 -07:00
|
|
|
package views.html.tv
|
|
|
|
|
|
|
|
import lila.api.Context
|
|
|
|
import lila.app.templating.Environment._
|
|
|
|
import lila.app.ui.ScalatagsTemplate._
|
|
|
|
|
|
|
|
import controllers.routes
|
|
|
|
|
|
|
|
object side {
|
|
|
|
|
2019-05-13 04:47:05 -06:00
|
|
|
def channels(
|
2019-12-13 07:30:20 -07:00
|
|
|
channel: lila.tv.Tv.Channel,
|
|
|
|
champions: lila.tv.Tv.Champions,
|
|
|
|
baseUrl: String
|
2020-05-05 22:11:15 -06:00
|
|
|
): Frag =
|
|
|
|
div(cls := "tv-channels subnav")(
|
|
|
|
lila.tv.Tv.Channel.all.map { c =>
|
|
|
|
a(
|
|
|
|
href := s"$baseUrl/${c.key}",
|
|
|
|
cls := List(
|
|
|
|
"tv-channel" -> true,
|
|
|
|
c.key -> true,
|
|
|
|
"active" -> (c == channel)
|
|
|
|
)
|
|
|
|
)(
|
|
|
|
span(dataIcon := c.icon)(
|
|
|
|
span(
|
|
|
|
strong(c.name),
|
|
|
|
span(cls := "champion")(
|
|
|
|
champions.get(c).fold[Frag](raw(" - ")) { p =>
|
|
|
|
frag(
|
|
|
|
p.user.title.fold[Frag](p.user.name)(t => frag(t, nbsp, p.user.name)),
|
2021-10-21 05:03:35 -06:00
|
|
|
ratingTag(
|
|
|
|
" ",
|
|
|
|
p.rating
|
|
|
|
)
|
2020-05-05 22:11:15 -06:00
|
|
|
)
|
|
|
|
}
|
|
|
|
)
|
2019-04-05 20:20:44 -06:00
|
|
|
)
|
2018-12-04 23:58:08 -07:00
|
|
|
)
|
2019-01-18 19:15:20 -07:00
|
|
|
)
|
2020-05-05 22:11:15 -06:00
|
|
|
}
|
|
|
|
)
|
2018-12-04 23:58:08 -07:00
|
|
|
|
2019-05-13 04:47:05 -06:00
|
|
|
private val separator = " • "
|
|
|
|
|
|
|
|
def meta(pov: lila.game.Pov)(implicit ctx: Context): Frag = {
|
|
|
|
import pov._
|
|
|
|
div(cls := "game__meta")(
|
|
|
|
st.section(
|
|
|
|
div(cls := "game__meta__infos", dataIcon := views.html.game.bits.gameIcon(game))(
|
|
|
|
div(cls := "header")(
|
|
|
|
div(cls := "setup")(
|
|
|
|
views.html.game.widgets showClock game,
|
|
|
|
separator,
|
|
|
|
(if (game.rated) trans.rated else trans.casual).txt(),
|
|
|
|
separator,
|
2021-06-07 16:29:02 -06:00
|
|
|
views.html.game.bits.variantLink(game.variant, game.perfType, shortName = true)
|
2019-05-13 04:47:05 -06:00
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
div(cls := "game__meta__players")(
|
|
|
|
game.players.map { p =>
|
|
|
|
div(cls := s"player color-icon is ${p.color.name} text")(
|
|
|
|
playerLink(p, withOnline = false, withDiff = true, withBerserk = true)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
),
|
|
|
|
game.tournamentId map { tourId =>
|
|
|
|
st.section(cls := "game__tournament-link")(
|
2021-06-14 01:13:27 -06:00
|
|
|
a(href := routes.Tournament.show(tourId), dataIcon := "", cls := "text")(
|
2019-12-13 07:30:20 -07:00
|
|
|
tournamentIdToName(tourId)
|
|
|
|
)
|
2019-05-13 04:47:05 -06:00
|
|
|
)
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-12-04 23:58:08 -07:00
|
|
|
def sides(
|
2019-12-13 07:30:20 -07:00
|
|
|
pov: lila.game.Pov,
|
|
|
|
cross: Option[lila.game.Crosstable.WithMatchup]
|
2018-12-04 23:58:08 -07:00
|
|
|
)(implicit ctx: Context) =
|
|
|
|
div(cls := "sides")(
|
2019-04-06 19:43:03 -06:00
|
|
|
cross.map {
|
|
|
|
views.html.game.crosstable(_, pov.gameId.some)
|
2018-12-04 23:58:08 -07:00
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|