<commit_before>package views
package html.tournament

import chess.variant.{ FromPosition, Standard }
import controllers.routes
import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._
import lila.common.String.html.markdownLinksOrRichText
import lila.tournament.{ TeamBattle, Tournament, TournamentShield }

object side {

  private val separator = " • "

  def apply(
      tour: Tournament,
      verdicts: lila.tournament.Condition.All.WithVerdicts,
      streamers: List[lila.user.User.ID],
      shieldOwner: Option[TournamentShield.OwnerId],
      chat: Boolean
  )(implicit ctx: Context) =
    frag(
      div(cls := "tour__meta")(
        st.section(dataIcon := tour.perfType.iconChar.toString)(
          div(
            p(
              tour.clock.show,
              separator,
              views.html.game.bits.variantLink(
                tour.variant,
                tour.perfType.some,
                shortName = true
              ),
              tour.position.isDefined ?? s"$separator${trans.thematic.txt()}",
              separator,
              tour.durationString
            ),
            tour.mode.fold(trans.casualTournament, trans.ratedTournament)(),
            separator,
            "Arena",
            (isGranted(_.ManageTournament) || (ctx.userId
              .has(tour.createdBy) && !tour.isFinished)) option frag(
              " ",
              a(href := routes.Tournament.edit(tour.id), title := "Edit tournament")(iconTag(""))
            )
          )
        ),
        tour.teamBattle map teamBattle(tour),
        tour.spotlight map { s =>
          st.section(
            markdownLinksOrRichText(s.description),
            shieldOwner map { owner =>
              p(cls := "defender", dataIcon := "")(
                "Defender:",
                userIdLink(owner.value.some)
              )
            }
          )
        },
        variantTeamLinks.get(tour.variant) filter { case (team, _) =>
          tour.createdBy == lila.user.User.lichessId || tour.conditions.teamMember.exists(_.teamId == team.id)
        } map { case (team, link) =>
          st.section(
            if (isMyTeamSync(team.id)) frag(trans.team.team(), " ", link)
            else trans.team.joinLichessVariantTeam(link)
          )
        },
        tour.description map { d =>
          st.section(cls := "description")(markdownLinksOrRichText(d))
        },
        tour.looksLikePrize option bits.userPrizeDisclaimer(tour.createdBy),
        verdicts.relevant option st.section(<commit_msg>Make description set via Tournament Manager scroll on overflow<commit_after>package views
package html.tournament

import chess.variant.{ FromPosition, Standard }
import controllers.routes
import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._
import lila.common.String.html.markdownLinksOrRichText
import lila.tournament.{ TeamBattle, Tournament, TournamentShield }

object side {

  private val separator = " • "

  def apply(
      tour: Tournament,
      verdicts: lila.tournament.Condition.All.WithVerdicts,
      streamers: List[lila.user.User.ID],
      shieldOwner: Option[TournamentShield.OwnerId],
      chat: Boolean
  )(implicit ctx: Context) =
    frag(
      div(cls := "tour__meta")(
        st.section(dataIcon := tour.perfType.iconChar.toString)(
          div(
            p(
              tour.clock.show,
              separator,
              views.html.game.bits.variantLink(
                tour.variant,
                tour.perfType.some,
                shortName = true
              ),
              tour.position.isDefined ?? s"$separator${trans.thematic.txt()}",
              separator,
              tour.durationString
            ),
            tour.mode.fold(trans.casualTournament, trans.ratedTournament)(),
            separator,
            "Arena",
            (isGranted(_.ManageTournament) || (ctx.userId
              .has(tour.createdBy) && !tour.isFinished)) option frag(
              " ",
              a(href := routes.Tournament.edit(tour.id), title := "Edit tournament")(iconTag(""))
            )
          )
        ),
        tour.teamBattle map teamBattle(tour),
        tour.spotlight map { s =>
          st.section(cls := "description")(
            markdownLinksOrRichText(s.description),
            shieldOwner map { owner =>
              p(cls := "defender", dataIcon := "")(
                "Defender:",
                userIdLink(owner.value.some)
              )
            }
          )
        },
        variantTeamLinks.get(tour.variant) filter { case (team, _) =>
          tour.createdBy == lila.user.User.lichessId || tour.conditions.teamMember.exists(_.teamId == team.id)
        } map { case (team, link) =>
          st.section(
            if (isMyTeamSync(team.id)) frag(trans.team.team(), " ", link)
            else trans.team.joinLichessVariantTeam(link)
          )
        },
        tour.description map { d =>
          st.section(cls := "description")(markdownLinksOrRichText(d))
        },
        tour.looksLikePrize option bits.userPrizeDisclaimer(tour.createdBy),
        verdicts.relevant option st.section(
{'fraction_non_alphanumeric': 0.11789473684210526, 'fraction_numerical': 0.0, 'mean_word_length': 1.9575551782682512, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '4868358', 'n_tokens_mistral': 1540, 'n_tokens_neox': 1471, 'n_words': 256}