<commit_before>package views
package html.tournament

import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._
import lila.tournament.{ Tournament, TournamentShield, TeamBattle }

import controllers.routes

object side {

  private val separator = " • "

  def apply(
    tour: Tournament,
    verdicts: lila.tournament.Condition.All.WithVerdicts,
    streamers: Set[lila.user.User.ID],
    shieldOwner: Option[TournamentShield.OwnerId],
    chat: Boolean
  )(implicit ctx: Context) = frag(
    div(cls := "tour__meta")(
      st.section(dataIcon := tour.perfType.map(_.iconChar.toString))(
        div(
          p(
            tour.clock.show,
            separator,
            if (tour.variant.exotic) {
              views.html.game.bits.variantLink(
                tour.variant,
                if (tour.variant == chess.variant.KingOfTheHill) tour.variant.shortName else tour.variant.name
              )
            } else tour.perfType.map(_.name),
            (!tour.position.initial) ?? s"$separator${trans.thematic.txt()}",
            separator,
            tour.durationString
          ),
          tour.mode.fold(trans.casualTournament, trans.ratedTournament)(),
          separator,
          systemName(tour.system).capitalize,
          isGranted(_.TerminateTournament) option
            postForm(cls := "terminate", action := routes.Tournament.terminate(tour.id))(
              submitButton(dataIcon := "j", cls := "fbt fbt-red confirm", title := "Terminates the tournament immediately")
            )
        )
      ),
      tour.teamBattle map teamBattle(tour),
      tour.spotlight map { s =>
        st.section(
          lila.common.String.html.markdownLinks(s.description),
          shieldOwner map { owner =>
            p(cls := "defender", dataIcon := "5")(
              "Defender:",
              userIdLink(owner.value.some)
            )
          }
        )
      },
      verdicts.relevant option st.section(dataIcon := "7", cls := List(
        "conditions" -> true,
        "accepted" -> (ctx.isAuth && verdicts.accepted),
        "refused" -> (ctx.isAuth && !verdicts.accepted)
      ))(div(
        (verdicts.list.size < 2) option p(trans.conditionOfEntry()),
        verdicts.list map { v =>
          p(cls := List(
            "condition text" -> true,
            "accepted" -> v.verdict.accepted,
            "refused" -> !v.verdict.accepted
          ))(v.condition.name(ctx.lang))
        }
      )),
      tour.noBerserk option div(cls := "text", dataIcon := "`")("No Berserk allowed"),
      !tour.isScheduled && !tour.isTeamBattle option frag(trans.by(usernameOrId(tour.createdBy)), br),
      (!tour.isStarted || (tour.isScheduled && !tour.position.initial)) option absClientDateTime(tour.startsAt),
      !tour.position.initial option p(
        a(target := "_blank", href := tour.position.url)(
          strong(tour.position.eco), " ", tour.position.name
        ),
        separator,
        a(href := routes.UserAnalysis.parse(tour.position.fen.replace(" ", "_")))(trans.analysis())
      )
    ),
    streamers.toList map views.html.streamer.bits.contextual,
    chat option views.html.chat.frag<commit_msg>show team tournament author<commit_after>package views
package html.tournament

import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._
import lila.tournament.{ Tournament, TournamentShield, TeamBattle }

import controllers.routes

object side {

  private val separator = " • "

  def apply(
    tour: Tournament,
    verdicts: lila.tournament.Condition.All.WithVerdicts,
    streamers: Set[lila.user.User.ID],
    shieldOwner: Option[TournamentShield.OwnerId],
    chat: Boolean
  )(implicit ctx: Context) = frag(
    div(cls := "tour__meta")(
      st.section(dataIcon := tour.perfType.map(_.iconChar.toString))(
        div(
          p(
            tour.clock.show,
            separator,
            if (tour.variant.exotic) {
              views.html.game.bits.variantLink(
                tour.variant,
                if (tour.variant == chess.variant.KingOfTheHill) tour.variant.shortName else tour.variant.name
              )
            } else tour.perfType.map(_.name),
            (!tour.position.initial) ?? s"$separator${trans.thematic.txt()}",
            separator,
            tour.durationString
          ),
          tour.mode.fold(trans.casualTournament, trans.ratedTournament)(),
          separator,
          systemName(tour.system).capitalize,
          isGranted(_.TerminateTournament) option
            postForm(cls := "terminate", action := routes.Tournament.terminate(tour.id))(
              submitButton(dataIcon := "j", cls := "fbt fbt-red confirm", title := "Terminates the tournament immediately")
            )
        )
      ),
      tour.teamBattle map teamBattle(tour),
      tour.spotlight map { s =>
        st.section(
          lila.common.String.html.markdownLinks(s.description),
          shieldOwner map { owner =>
            p(cls := "defender", dataIcon := "5")(
              "Defender:",
              userIdLink(owner.value.some)
            )
          }
        )
      },
      verdicts.relevant option st.section(dataIcon := "7", cls := List(
        "conditions" -> true,
        "accepted" -> (ctx.isAuth && verdicts.accepted),
        "refused" -> (ctx.isAuth && !verdicts.accepted)
      ))(div(
        (verdicts.list.size < 2) option p(trans.conditionOfEntry()),
        verdicts.list map { v =>
          p(cls := List(
            "condition text" -> true,
            "accepted" -> v.verdict.accepted,
            "refused" -> !v.verdict.accepted
          ))(v.condition.name(ctx.lang))
        }
      )),
      tour.noBerserk option div(cls := "text", dataIcon := "`")("No Berserk allowed"),
      !tour.isScheduled option frag(trans.by(usernameOrId(tour.createdBy)), br),
      (!tour.isStarted || (tour.isScheduled && !tour.position.initial)) option absClientDateTime(tour.startsAt),
      !tour.position.initial option p(
        a(target := "_blank", href := tour.position.url)(
          strong(tour.position.eco), " ", tour.position.name
        ),
        separator,
        a(href := routes.UserAnalysis.parse(tour.position.fen.replace(" ", "_")))(trans.analysis())
      )
    ),
    streamers.toList map views.html.streamer.bits.contextual,
    chat option views.html.chat.frag
{'fraction_non_alphanumeric': 0.136986301369863, 'fraction_numerical': 0.0009339975093399751, 'mean_word_length': 2.2597666159309995, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3806403', 'n_tokens_mistral': 1986, 'n_tokens_neox': 1901, 'n_words': 341}