diff --git a/app/controllers/Plan.scala b/app/controllers/Plan.scala index 16ee150c98b23..aa59ad8d704f4 100644 --- a/app/controllers/Plan.scala +++ b/app/controllers/Plan.scala @@ -101,12 +101,12 @@ final class Plan(env: Env) extends LilaController(env): } } yield res - private def indexPayPalPatron(me: UserModel, patron: lila.plan.Patron, subscription: PayPalSubscription)( - implicit ctx: Context - ) = for { - pricing <- env.plan.priceApi.pricingOrDefault(myCurrency) - gifts <- env.plan.api.giftsFrom(me) - } yield Ok(html.plan.indexPayPal(me, patron, subscription, pricing, gifts)) + private def indexPayPalPatron(me: UserModel, patron: lila.plan.Patron, sub: PayPalSubscription)(using + Context + ) = + env.plan.api.giftsFrom(me) map { gifts => + Ok(html.plan.indexPayPal(me, patron, sub, gifts)) + } private def myCurrency(implicit ctx: Context): Currency = get("currency") flatMap lila.plan.CurrencyApi.currencyOption getOrElse diff --git a/app/controllers/Push.scala b/app/controllers/Push.scala index 6f4fa3f9e5847..1a80e3e247c94 100644 --- a/app/controllers/Push.scala +++ b/app/controllers/Push.scala @@ -2,7 +2,6 @@ package controllers import lila.app.{ given, * } import lila.push.WebSubscription -import lila.push.WebSubscription.* final class Push(env: Env) extends LilaController(env): diff --git a/app/controllers/Puzzle.scala b/app/controllers/Puzzle.scala index b22f99ec56253..4aa9f65357045 100644 --- a/app/controllers/Puzzle.scala +++ b/app/controllers/Puzzle.scala @@ -461,7 +461,7 @@ final class Puzzle(env: Env, apiC: => Api) extends LilaController(env): DashboardPage(u) { implicit ctx => user => Reasonable(page) { env.puzzle.history(user, page) map { history => - Ok(views.html.puzzle.history(user, page, history)) + Ok(views.html.puzzle.history(user, history)) } } } diff --git a/app/controllers/Tutor.scala b/app/controllers/Tutor.scala index f89d98ea82b21..2b3b90c9dc82b 100644 --- a/app/controllers/Tutor.scala +++ b/app/controllers/Tutor.scala @@ -27,12 +27,12 @@ final class Tutor(env: Env) extends LilaController(env): } def openings(username: UserStr, perf: Perf.Key) = TutorPerfPage(username, perf) { - implicit ctx => me => report => perf => - Ok(views.html.tutor.openings(report, perf, me)).toFuccess + implicit ctx => me => _ => perf => + Ok(views.html.tutor.openings(perf, me)).toFuccess } def opening(username: UserStr, perf: Perf.Key, colName: String, opName: String) = - TutorPerfPage(username, perf) { implicit ctx => me => report => perf => + TutorPerfPage(username, perf) { implicit ctx => me => _ => perf => chess.Color .fromName(colName) .fold(Redirect(routes.Tutor.openings(me.username, perf.perf.key)).toFuccess) { color => @@ -41,7 +41,7 @@ final class Tutor(env: Env) extends LilaController(env): .flatMap(perf.openings(color).find) .fold(Redirect(routes.Tutor.openings(me.username, perf.perf.key)).toFuccess) { family => env.puzzle.opening.find(family.family.key) map { puzzle => - Ok(views.html.tutor.opening(report, perf, family, color, me, puzzle)) + Ok(views.html.tutor.opening(perf, family, color, me, puzzle)) } } } diff --git a/app/controllers/User.scala b/app/controllers/User.scala index bccf1b6c8c472..f0963838ab642 100644 --- a/app/controllers/User.scala +++ b/app/controllers/User.scala @@ -428,15 +428,14 @@ final class User( } val userLoginsFu = env.security.userLogins(user, nbOthers) - val others = for { + val others = for userLogins <- userLoginsFu appeals <- env.appeal.api.byUserIds(user.id :: userLogins.otherUserIds) data <- loginsTableData(user, userLogins, nbOthers) - } yield html.user.mod.otherUsers(holder, user, data, appeals) + yield html.user.mod.otherUsers(holder, user, data, appeals) val identification = userLoginsFu map { logins => - Granter.is(_.ViewPrintNoIP)(holder) ?? - html.user.mod.identification(holder, user, logins) + Granter.is(_.ViewPrintNoIP)(holder) ?? html.user.mod.identification(logins) } val kaladin = isGranted(_.MarkEngine) ?? env.irwin.kaladinApi.get(user).map { diff --git a/app/templating/ChessgroundHelper.scala b/app/templating/ChessgroundHelper.scala index 0619cc010bb9f..2c32a7402c5dc 100644 --- a/app/templating/ChessgroundHelper.scala +++ b/app/templating/ChessgroundHelper.scala @@ -4,7 +4,7 @@ package templating import chess.{ Board, Color, Pos } import lila.api.Context -import lila.app.ui.ScalatagsTemplate.{ *, given } +import lila.app.ui.ScalatagsTemplate.* import lila.game.Pov trait ChessgroundHelper: diff --git a/app/views/activity.scala b/app/views/activity.scala index 40887e4270390..4bf3445991826 100644 --- a/app/views/activity.scala +++ b/app/views/activity.scala @@ -12,7 +12,7 @@ import lila.swiss.Swiss object activity: - def apply(u: User, as: Iterable[lila.activity.ActivityView])(implicit ctx: Context) = + def apply(u: User, as: Iterable[lila.activity.ActivityView])(using Context) = div(cls := "activity")( as.toSeq filterNot (_.isEmpty) map { a => st.section( @@ -48,7 +48,7 @@ object activity: private def subCount(count: Int) = if (count >= maxSubEntries) s"$count+" else s"$count" - private def renderPatron(p: Patron)(implicit ctx: Context) = + private def renderPatron(p: Patron)(using Context) = div(cls := "entry plan")( iconTag(""), div( @@ -58,7 +58,7 @@ object activity: ) ) - private def renderPractice(p: Map[lila.practice.PracticeStudy, Int])(implicit ctx: Context) = + private def renderPractice(p: Map[lila.practice.PracticeStudy, Int])(using Context) = val ps = p.toSeq.sortBy(-_._2) entryTag( iconTag(""), @@ -71,7 +71,7 @@ object activity: ) ) - private def onePractice(tup: (lila.practice.PracticeStudy, Int))(implicit ctx: Context) = + private def onePractice(tup: (lila.practice.PracticeStudy, Int))(using Context) = tup match case (study, nb) => val href = routes.Practice.show("-", study.slug, study.id) @@ -80,7 +80,7 @@ object activity: br ) - private def renderPuzzles(u: User)(p: Puzzles)(implicit ctx: Context) = + private def renderPuzzles(u: User)(p: Puzzles)(using ctx: Context) = entryTag( iconTag(""), scoreFrag(p.value), @@ -90,7 +90,7 @@ object activity: ) ) - private def renderStorm(s: Storm)(implicit ctx: Context) = + private def renderStorm(s: Storm)(using Context) = entryTag( iconTag(""), scoreTag(winTag(trans.storm.highscoreX(strong(s.score)))), @@ -100,7 +100,7 @@ object activity: ) ) - private def renderRacer(s: Racer)(implicit ctx: Context) = + private def renderRacer(s: Racer)(using Context) = entryTag( iconTag(""), scoreTag(winTag(trans.storm.highscoreX(strong(s.score)))), @@ -110,7 +110,7 @@ object activity: ) ) - private def renderStreak(s: Streak)(implicit ctx: Context) = + private def renderStreak(s: Streak)(using Context) = entryTag( iconTag(""), scoreTag(winTag(trans.storm.highscoreX(strong(s.score)))), @@ -120,7 +120,7 @@ object activity: ) ) - private def renderGames(games: Games)(implicit ctx: Context) = + private def renderGames(games: Games)(using Context) = games.value.toSeq.sortBy(-_._2.size).map { case (pt, score) => entryTag( iconTag(pt.iconChar), @@ -132,7 +132,7 @@ object activity: ) } - private def renderForumPosts(posts: Map[lila.forum.ForumTopic, List[lila.forum.ForumPost]])(implicit + private def renderForumPosts(posts: Map[lila.forum.ForumTopic, List[lila.forum.ForumPost]])(using ctx: Context ) = ctx.noKid option entryTag( @@ -171,7 +171,7 @@ object activity: ) ) - private def renderCorresMoves(nb: Int, povs: List[lila.game.LightPov])(implicit ctx: Context) = + private def renderCorresMoves(nb: Int, povs: List[lila.game.LightPov])(using Context) = entryTag( iconTag(""), div( @@ -191,7 +191,7 @@ object activity: ) ) - private def renderCorresEnds(score: Score, povs: List[lila.game.LightPov])(implicit ctx: Context) = + private def renderCorresEnds(score: Score, povs: List[lila.game.LightPov])(using Context) = entryTag( iconTag(""), div( @@ -217,7 +217,7 @@ object activity: ) ) - private def renderFollows(all: Follows)(implicit ctx: Context) = + private def renderFollows(all: Follows)(using Context) = entryTag( iconTag(""), div( @@ -236,7 +236,7 @@ object activity: ) ) - private def renderSimuls(u: User)(simuls: List[lila.simul.Simul])(implicit ctx: Context) = + private def renderSimuls(u: User)(simuls: List[lila.simul.Simul])(using Context) = entryTag( iconTag(""), div( @@ -263,7 +263,7 @@ object activity: ) ) - private def renderStudies(studies: List[lila.study.Study.IdName])(implicit ctx: Context) = + private def renderStudies(studies: List[lila.study.Study.IdName])(using Context) = entryTag( iconTag(""), div( @@ -276,7 +276,7 @@ object activity: ) ) - private def renderTeams(teams: Teams)(implicit ctx: Context) = + private def renderTeams(teams: Teams)(using ctx: Context) = ctx.noKid option entryTag( iconTag(""), div( @@ -285,7 +285,7 @@ object activity: ) ) - private def renderTours(tours: lila.activity.ActivityView.Tours)(implicit ctx: Context) = + private def renderTours(tours: lila.activity.ActivityView.Tours)(using Context) = entryTag( iconTag(""), div( @@ -313,7 +313,7 @@ object activity: ) ) - private def renderSwisses(swisses: List[(Swiss.IdName, Rank)])(implicit ctx: Context) = + private def renderSwisses(swisses: List[(Swiss.IdName, Rank)])(using Context) = entryTag( iconTag(""), div( @@ -338,13 +338,13 @@ object activity: ) ) - private def renderStream(u: User)(implicit ctx: Context) = + private def renderStream(u: User)(using ctx: Context) = ctx.noKid option entryTag( iconTag(""), a(href := routes.Streamer.redirect(u.username))(trans.activity.hostedALiveStream()) ) - private def renderSignup(implicit ctx: Context) = + private def renderSignup(using Context) = entryTag( iconTag(""), div(trans.activity.signedUp()) @@ -355,7 +355,7 @@ object activity: private val scoreTag = tag("score") private val winTag = tag("win") - private def scoreFrag(s: Score)(implicit ctx: Context) = + private def scoreFrag(s: Score)(using Context) = raw { s"""${scoreStr("win", s.win, trans.nbWins)}${scoreStr("draw", s.draw, trans.nbDraws)}${scoreStr( "loss", @@ -364,10 +364,10 @@ object activity: )}""" } - private def ratingProgFrag(r: RatingProg)(implicit ctx: Context) = + private def ratingProgFrag(r: RatingProg)(using ctx: Context) = ctx.pref.showRatings option ratingTag(r.after.value, ratingProgress(r.diff)) - private def scoreStr(tag: String, p: Int, name: lila.i18n.I18nKey)(implicit ctx: Context) = + private def scoreStr(tag: String, p: Int, name: lila.i18n.I18nKey)(using Context) = if (p == 0) "" else s"""<$tag>${wrapNumber(name.pluralSameTxt(p))}""" diff --git a/app/views/appeal/tree.scala b/app/views/appeal/tree.scala index 0eece35144cb2..7983295c1a480 100644 --- a/app/views/appeal/tree.scala +++ b/app/views/appeal/tree.scala @@ -23,7 +23,7 @@ object tree: val excludedFromLeaderboards = "Your account has been excluded from leaderboards."; val closedByModerators = "Your account was closed by moderators."; - private def cleanMenu(implicit ctx: Context): Branch = + private def cleanMenu(using Context): Branch = Branch( "root", cleanAllGood, @@ -68,7 +68,7 @@ object tree: ) ) - private def engineMenu(implicit ctx: Context): Branch = + private def engineMenu(using Context): Branch = val accept = "I accept that I used outside assistance in my games." val deny = @@ -110,7 +110,7 @@ object tree: ).some ) - private def boostMenu(implicit ctx: Context): Branch = + private def boostMenu(using Context): Branch = val accept = "I accept that I manipulated my rating." val acceptFull = "I accept that I deliberately manipulated my rating by losing games on purpose, or by playing another account that was deliberately losing games. I am sorry and I would like another chance." @@ -144,7 +144,7 @@ object tree: ).some ) - private def muteMenu(implicit ctx: Context): Branch = + private def muteMenu(using Context): Branch = val accept = "I accept that I have not followed the communication guidelines" val acceptFull = "I accept that I have not followed the communication guidelines. I will behave better in future, please give me another chance." @@ -183,7 +183,7 @@ object tree: ).some ) - private def rankBanMenu(implicit ctx: Context): Branch = + private def rankBanMenu(using Context): Branch = val accept = "I accept that I have manipulated my account to get on the leaderboard." val deny = "I deny having manipulated my account to get on the leaderboard." @@ -213,7 +213,7 @@ object tree: ).some ) - private def playbanMenu(implicit ctx: Context): Branch = + private def playbanMenu: Branch = Branch( "root", "You have a play timeout.", @@ -259,7 +259,7 @@ object tree: ) ) - private def altScreen(implicit ctx: Context) = div(cls := "leaf")( + private def altScreen(using Context) = div(cls := "leaf")( h2(closedByModerators), div(cls := "content")( p("Did you create multiple accounts? If so, remember that you promised not to, on the sign up page."), @@ -274,7 +274,7 @@ object tree: newAppeal() ) - def apply(me: User, playban: Boolean)(implicit ctx: Context) = + def apply(me: User, playban: Boolean)(using ctx: Context) = bits.layout("Appeal a moderation decision") { val query = isGranted(_.Appeals) ?? ctx.req.queryString.toMap val isMarked = playban || me.marks.engine || me.marks.boost || me.marks.troll || me.marks.rankban @@ -315,23 +315,10 @@ object tree: p("Please be honest, concise, and on point.") ) - private def newAppeal(preset: String = "")(implicit ctx: Context) = + private def newAppeal(preset: String = "")(using Context) = discussion.renderForm( lila.appeal.Appeal.form.fill(preset), action = appealRoutes.post.url, isNew = true, presets = none ) - - private def renderHelp = - div(cls := "appeal__help")( - p( - "If your account has been restricted for violation of ", - a(href := routes.Page.tos)("the Lichess rules"), - " you may file an appeal here." - ), - p( - "You can read more about the appeal process ", - a(href := routes.Page.loneBookmark("appeal"))("here.") - ) - ) diff --git a/app/views/base/embed.scala b/app/views/base/embed.scala index efc3af262e75f..644985d6656e1 100644 --- a/app/views/base/embed.scala +++ b/app/views/base/embed.scala @@ -3,7 +3,7 @@ package views.html.base import lila.app.templating.Environment.{ given, * } import lila.app.ui.EmbedConfig import lila.app.ui.EmbedConfig.given -import lila.app.ui.ScalatagsTemplate.{ *, given } +import lila.app.ui.ScalatagsTemplate.* import lila.pref.SoundSet object embed: diff --git a/app/views/forum/post.scala b/app/views/forum/post.scala index 96ddf8ffa507d..ccac8264bf9a6 100644 --- a/app/views/forum/post.scala +++ b/app/views/forum/post.scala @@ -7,7 +7,6 @@ import controllers.routes import lila.api.Context import lila.app.templating.Environment.{ given, * } import lila.app.ui.ScalatagsTemplate.{ *, given } -import lila.common.String.html.richText import lila.forum.ForumPost object post: diff --git a/app/views/forum/topic.scala b/app/views/forum/topic.scala index 2d7b1ddc8de75..67936f3aad365 100644 --- a/app/views/forum/topic.scala +++ b/app/views/forum/topic.scala @@ -203,7 +203,7 @@ object topic: ) } - private def deleteModal(using Context) = + private def deleteModal = div(cls := "forum-delete-modal none")( p("Delete the post"), st.form(method := "post", cls := "form3")( diff --git a/app/views/kaladin.scala b/app/views/kaladin.scala index 89bd1c513b628..12fe2675e6d5a 100644 --- a/app/views/kaladin.scala +++ b/app/views/kaladin.scala @@ -15,7 +15,7 @@ object kaladin: case p if p < 80 => "orange" case _ => "red" - def dashboard(dashboard: lila.irwin.KaladinUser.Dashboard)(implicit ctx: Context) = + def dashboard(dashboard: lila.irwin.KaladinUser.Dashboard)(using Context) = views.html.base.layout( title = "Kaladin dashboard", moreCss = cssTag("mod.misc") @@ -89,7 +89,7 @@ object kaladin: ) } - def report(response: lila.irwin.KaladinUser.Response)(implicit ctx: Context): Frag = + def report(response: lila.irwin.KaladinUser.Response)(using Context): Frag = div(cls := "mz-section mz-section--kaladin", dataRel := "kaladin")( header( span(cls := "title")( diff --git a/app/views/mobile.scala b/app/views/mobile.scala index e8c9e8b6c5a74..8e821d3e70c24 100644 --- a/app/views/mobile.scala +++ b/app/views/mobile.scala @@ -4,7 +4,7 @@ import controllers.routes import lila.api.Context import lila.app.templating.Environment.{ given, * } -import lila.app.ui.ScalatagsTemplate.{ *, given } +import lila.app.ui.ScalatagsTemplate.* import lila.common.LangPath object mobile: diff --git a/app/views/mod/activity.scala b/app/views/mod/activity.scala index ee32edbe9054e..97b3961acbf95 100644 --- a/app/views/mod/activity.scala +++ b/app/views/mod/activity.scala @@ -7,11 +7,10 @@ import lila.app.templating.Environment.{ given, * } import lila.app.ui.ScalatagsTemplate.{ *, given } import lila.common.String.html.safeJsonValue import lila.mod.ModActivity.* -import lila.report.Room object activity: - def apply(p: Result)(implicit ctx: Context) = + def apply(p: Result)(using Context) = views.html.base.layout( title = "Moderation activity", moreCss = cssTag("mod.activity"), diff --git a/app/views/mod/impersonate.scala b/app/views/mod/impersonate.scala index ec75113f858b5..1a37cfa26236f 100644 --- a/app/views/mod/impersonate.scala +++ b/app/views/mod/impersonate.scala @@ -2,7 +2,7 @@ package views.html.mod import play.api.i18n.Lang -import lila.app.templating.Environment.{ given, * } +import lila.app.templating.Environment.* import lila.app.ui.ScalatagsTemplate.{ *, given } import controllers.routes diff --git a/app/views/mod/log.scala b/app/views/mod/log.scala index cb806105b191f..ca90e9120c471 100644 --- a/app/views/mod/log.scala +++ b/app/views/mod/log.scala @@ -2,11 +2,11 @@ package views.html.mod import lila.api.Context import lila.app.templating.Environment.{ given, * } -import lila.app.ui.ScalatagsTemplate.{ *, given } +import lila.app.ui.ScalatagsTemplate.* object log: - def apply(logs: List[lila.mod.Modlog])(implicit ctx: Context) = + def apply(logs: List[lila.mod.Modlog])(using Context) = val title = "My logs" diff --git a/app/views/mod/publicChat.scala b/app/views/mod/publicChat.scala index c0ce4288debb8..52e475f1b59fc 100644 --- a/app/views/mod/publicChat.scala +++ b/app/views/mod/publicChat.scala @@ -5,7 +5,6 @@ import lila.app.templating.Environment.{ given, * } import lila.app.ui.ScalatagsTemplate.{ *, given } import controllers.routes -import play.api.mvc.Call import lila.chat.UserChat import lila.chat.ChatTimeout @@ -14,7 +13,7 @@ object publicChat: def apply( tourChats: List[(lila.tournament.Tournament, UserChat)], swissChats: List[(lila.swiss.Swiss, UserChat)] - )(implicit ctx: Context) = + )(using Context) = views.html.base.layout( title = "Public Chats", moreCss = cssTag("mod.publicChats"), @@ -59,7 +58,7 @@ object publicChat: private val dataRoom = attr("data-room") private val dataChan = attr("data-chan") - private def chatOf(titleFragment: Frag, chat: UserChat)(implicit ctx: Context) = + private def chatOf(titleFragment: Frag, chat: UserChat)(using Context) = frag( titleFragment, div(cls := "chat")( diff --git a/app/views/mod/queueStats.scala b/app/views/mod/queueStats.scala index b4583bf01bfe7..022b3be78993c 100644 --- a/app/views/mod/queueStats.scala +++ b/app/views/mod/queueStats.scala @@ -8,11 +8,10 @@ import lila.app.ui.ScalatagsTemplate.{ *, given } import lila.common.String.html.safeJsonValue import lila.mod.ModQueueStats.* import lila.mod.ModActivity.Period -import lila.report.Room object queueStats: - def apply(p: Result)(implicit ctx: Context) = + def apply(p: Result)(using Context) = views.html.base.layout( title = "Queues stats", moreCss = cssTag("mod.activity"), diff --git a/app/views/mod/table.scala b/app/views/mod/table.scala index 5524455587254..90fb5a94c78c7 100644 --- a/app/views/mod/table.scala +++ b/app/views/mod/table.scala @@ -10,14 +10,11 @@ object table: private val dataSort = attr("data-sort") - def apply(users: List[lila.user.User])(implicit ctx: Context) = + def apply(users: List[lila.user.User])(using Context) = val title = "All mods" - views.html.base.layout( - title = title, - moreCss = cssTag("mod.misc") - ) { + views.html.base.layout(title = title, moreCss = cssTag("mod.misc")): main(cls := "page-menu")( views.html.mod.menu("mods"), div(id := "mod_table", cls := "page-menu__content box")( @@ -46,4 +43,3 @@ object table: ) ) ) - } diff --git a/app/views/msg.scala b/app/views/msg.scala index 6e1b105cb1552..ad05e5e773a62 100644 --- a/app/views/msg.scala +++ b/app/views/msg.scala @@ -4,7 +4,7 @@ import play.api.libs.json.* import lila.api.Context import lila.app.templating.Environment.{ given, * } -import lila.app.ui.ScalatagsTemplate.{ *, given } +import lila.app.ui.ScalatagsTemplate.* import lila.common.String.html.safeJsonValue object msg: diff --git a/app/views/oAuth/authorize.scala b/app/views/oAuth/authorize.scala index 381a9ad4774a2..e080b5ec8eb1d 100644 --- a/app/views/oAuth/authorize.scala +++ b/app/views/oAuth/authorize.scala @@ -4,7 +4,6 @@ package oAuth import lila.api.Context import lila.app.templating.Environment.{ given, * } import lila.app.ui.ScalatagsTemplate.{ *, given } -import lila.common.base.StringUtils.escapeHtmlRaw import lila.user.User import lila.oauth.AuthorizationRequest import lila.oauth.OAuthScope @@ -19,7 +18,7 @@ object authorize: src := assetUrl("images/icons/linked-rings.png") ) - def apply(prompt: AuthorizationRequest.Prompt, me: User, authorizeUrl: String)(implicit ctx: Context) = + def apply(prompt: AuthorizationRequest.Prompt, me: User, authorizeUrl: String)(using Context) = val isDanger = prompt.maybeScopes.exists(OAuthScope.dangerList.contains) val buttonClass = s"button${isDanger ?? " button-red confirm text"}" val buttonDelay = if (isDanger) 5000 else 2000 diff --git a/app/views/opening/bits.scala b/app/views/opening/bits.scala index d512678f94da5..ab4e7f739fefb 100644 --- a/app/views/opening/bits.scala +++ b/app/views/opening/bits.scala @@ -3,7 +3,7 @@ package views.html.opening import cats.data.NonEmptyList import chess.opening.{ OpeningKey, Opening } import controllers.routes -import play.api.libs.json.{ JsArray, Json, JsObject } +import play.api.libs.json.Json import play.api.mvc.Call import lila.api.Context @@ -11,13 +11,13 @@ import lila.app.templating.Environment.{ given, * } import lila.app.ui.ScalatagsTemplate.{ *, given } import lila.common.String.html.safeJsonValue import lila.opening.OpeningQuery.Query -import lila.opening.{ NameSection, OpeningConfig, OpeningExplored, OpeningPage, OpeningQuery, ResultCounts } +import lila.opening.{ NameSection, OpeningConfig, OpeningPage, OpeningQuery, ResultCounts } object bits: def beta = span(cls := "opening__beta")("BETA") - def whatsNext(page: OpeningPage)(using Context): Option[Tag] = + def whatsNext(page: OpeningPage): Option[Tag] = page.explored.map { explored => div(cls := "opening__nexts")( explored.next.map { next => diff --git a/app/views/opening/search.scala b/app/views/opening/search.scala index c96a284536c56..24d54c0e17dfe 100644 --- a/app/views/opening/search.scala +++ b/app/views/opening/search.scala @@ -1,6 +1,5 @@ package views.html.opening -import chess.format.Fen import controllers.routes import lila.api.Context @@ -12,7 +11,7 @@ object search: import bits.* - def form(q: String, focus: Boolean = false)(using Context) = + def form(q: String, focus: Boolean = false) = st.form(cls := "opening__search-form", action := routes.Opening.index(), method := "get")( input( cls := "opening__search-form__input", @@ -26,7 +25,7 @@ object search: submitButton(cls := "button", dataIcon := "") ) - def resultsList(results: List[OpeningSearchResult])(using Context) = + def resultsList(results: List[OpeningSearchResult]) = div(cls := List("opening__search__results" -> true, "none" -> results.isEmpty))( results map { r => a(cls := "opening__search__result", href := bits.queryUrl(r.query))( diff --git a/app/views/opening/show.scala b/app/views/opening/show.scala index 645a5e97a1751..c42e5c8a7f1bb 100644 --- a/app/views/opening/show.scala +++ b/app/views/opening/show.scala @@ -5,9 +5,7 @@ import controllers.routes import lila.api.Context import lila.app.templating.Environment.{ given, * } import lila.app.ui.ScalatagsTemplate.{ *, given } -import lila.opening.NamePart -import lila.opening.{ OpeningPage, OpeningQuery } -import lila.puzzle.PuzzleOpening +import lila.opening.OpeningPage object show: @@ -109,7 +107,7 @@ object show: ) } - private def exampleGames(page: OpeningPage)(using Context) = + private def exampleGames(page: OpeningPage) = div(cls := "opening__games")(page.explored.??(_.games).map { game => div( cls := "opening__games__game lpv lpv--todo lpv--moves-bottom is2d", diff --git a/app/views/plan/indexPayPal.scala b/app/views/plan/indexPayPal.scala index 5c3e0bebdef9b..07ef4c0619fab 100644 --- a/app/views/plan/indexPayPal.scala +++ b/app/views/plan/indexPayPal.scala @@ -5,7 +5,6 @@ import controllers.routes import lila.api.Context import lila.app.templating.Environment.{ given, * } import lila.app.ui.ScalatagsTemplate.{ *, given } -import lila.plan.CurrencyApi.zeroDecimalCurrencies object indexPayPal: @@ -17,9 +16,8 @@ object indexPayPal: me: lila.user.User, patron: lila.plan.Patron, subscription: lila.plan.PayPalSubscription, - pricing: lila.plan.PlanPricing, gifts: List[lila.plan.Charge.Gift] - )(implicit ctx: Context) = + )(using Context) = views.html.base.layout( title = thankYou.txt(), moreCss = cssTag("plan"), diff --git a/app/views/practice/show.scala b/app/views/practice/show.scala index 90cf0af72e6ff..6e126b77cb366 100644 --- a/app/views/practice/show.scala +++ b/app/views/practice/show.scala @@ -5,7 +5,7 @@ import play.api.libs.json.Json import lila.api.Context import lila.app.templating.Environment.{ given, * } -import lila.app.ui.ScalatagsTemplate.{ *, given } +import lila.app.ui.ScalatagsTemplate.* import lila.common.String.html.safeJsonValue object show: diff --git a/app/views/puzzle/dashboard.scala b/app/views/puzzle/dashboard.scala index c637d5c6499ff..88a8fa543845e 100644 --- a/app/views/puzzle/dashboard.scala +++ b/app/views/puzzle/dashboard.scala @@ -2,7 +2,6 @@ package views package html.puzzle import controllers.routes -import play.api.i18n.Lang import play.api.libs.json.Json import lila.api.Context @@ -15,12 +14,11 @@ import lila.user.User object dashboard: - private val baseClass = "puzzle-dashboard" - private val metricClass = s"${baseClass}__metric" - private val themeClass = s"${baseClass}__theme" - private val dataWinPercent = attr("data-win-percent") + private val baseClass = "puzzle-dashboard" + private val metricClass = s"${baseClass}__metric" + private val themeClass = s"${baseClass}__theme" - def home(user: User, dashOpt: Option[PuzzleDashboard], days: Int)(implicit ctx: Context) = + def home(user: User, dashOpt: Option[PuzzleDashboard], days: Int)(using ctx: Context) = dashboardLayout( user = user, days = days, diff --git a/app/views/puzzle/embed.scala b/app/views/puzzle/embed.scala index c0c820429bf42..118745d22ef3e 100644 --- a/app/views/puzzle/embed.scala +++ b/app/views/puzzle/embed.scala @@ -3,9 +3,8 @@ package views.html.puzzle import controllers.routes import play.api.i18n.Lang -import lila.app.templating.Environment.{ given, * } +import lila.app.templating.Environment.* import lila.app.ui.EmbedConfig -import lila.app.ui.EmbedConfig.given import lila.app.ui.ScalatagsTemplate.{ *, given } import lila.puzzle.DailyPuzzle diff --git a/app/views/puzzle/history.scala b/app/views/puzzle/history.scala index c43f0466d42eb..b9ac5751791f1 100644 --- a/app/views/puzzle/history.scala +++ b/app/views/puzzle/history.scala @@ -13,7 +13,7 @@ import lila.user.User object history: - def apply(user: User, page: Int, pager: Paginator[PuzzleSession])(implicit ctx: Context) = + def apply(user: User, pager: Paginator[PuzzleSession])(using ctx: Context) = val title = if (ctx is user) trans.puzzle.history.txt() else s"${user.username} ${trans.puzzle.history.txt()}" diff --git a/app/views/puzzle/opening.scala b/app/views/puzzle/opening.scala index 9271e17e411fa..261447bf66d3a 100644 --- a/app/views/puzzle/opening.scala +++ b/app/views/puzzle/opening.scala @@ -8,7 +8,7 @@ import lila.app.templating.Environment.{ given, * } import lila.app.ui.ScalatagsTemplate.{ *, given } import lila.common.LilaOpeningFamily import lila.puzzle.PuzzleOpening.Order -import lila.puzzle.{ Puzzle, PuzzleAngle, PuzzleOpening, PuzzleOpeningCollection, PuzzleTheme } +import lila.puzzle.{ PuzzleOpening, PuzzleOpeningCollection } object opening: diff --git a/app/views/relay/bits.scala b/app/views/relay/bits.scala index cbd03d2e79499..8d5093466f7da 100644 --- a/app/views/relay/bits.scala +++ b/app/views/relay/bits.scala @@ -27,7 +27,7 @@ object bits: ) ) - def howToUse(using Context) = + def howToUse = a(dataIcon := "", cls := "text", href := routes.RelayTour.help)( "How to use Lichess Broadcasts" ) diff --git a/app/views/relay/tourForm.scala b/app/views/relay/tourForm.scala index 37849cb44b180..d61f615fac7f0 100644 --- a/app/views/relay/tourForm.scala +++ b/app/views/relay/tourForm.scala @@ -7,7 +7,7 @@ import lila.api.Context import lila.app.templating.Environment.{ given, * } import lila.app.ui.ScalatagsTemplate.{ *, given } import lila.relay.RelayTourForm.Data -import lila.relay.{ RelayRound, RelayTour } +import lila.relay.RelayTour object tourForm: diff --git a/app/views/round/bits.scala b/app/views/round/bits.scala index d8681ae00aab1..7d863db9dac05 100644 --- a/app/views/round/bits.scala +++ b/app/views/round/bits.scala @@ -135,7 +135,7 @@ object bits: bookmarked = bookmarked ) - def roundAppPreload(pov: Pov, controls: Boolean)(using Context) = + def roundAppPreload(pov: Pov)(using Context) = div(cls := "round__app")( div(cls := "round__app__board main-board")(chessground(pov)), div(cls := "col1-rmoves-preload") diff --git a/app/views/round/player.scala b/app/views/round/player.scala index f060eacc7289b..22367c0898831 100644 --- a/app/views/round/player.scala +++ b/app/views/round/player.scala @@ -70,7 +70,7 @@ object player: bits.side(pov, data, tour.map(_.tourAndTeamVs), simul, bookmarked = bookmarked), chatOption.map(_ => chat.frag) ), - bits.roundAppPreload(pov, controls = true), + bits.roundAppPreload(pov), div(cls := "round__underboard")( bits.crosstable(cross, pov.game), (playing.nonEmpty || simul.exists(_ isHost ctx.me)) option diff --git a/app/views/round/watcher.scala b/app/views/round/watcher.scala index f394fafc57a9b..6964c3dd7fe4e 100644 --- a/app/views/round/watcher.scala +++ b/app/views/round/watcher.scala @@ -5,7 +5,7 @@ import play.api.libs.json.{ JsObject, Json } import lila.api.Context import lila.app.templating.Environment.{ given, * } -import lila.app.ui.ScalatagsTemplate.{ *, given } +import lila.app.ui.ScalatagsTemplate.* import lila.common.String.html.safeJsonValue import lila.game.Pov @@ -20,7 +20,7 @@ object watcher: userTv: Option[lila.user.User] = None, chatOption: Option[lila.chat.UserChat.Mine], bookmarked: Boolean - )(implicit ctx: Context) = + )(using ctx: Context) = val chatJson = chatOption map { c => chat.json( @@ -56,7 +56,7 @@ object watcher: bits.side(pov, data, tour, simul, userTv, bookmarked), chatOption.map(_ => chat.frag) ), - bits.roundAppPreload(pov, controls = false), + bits.roundAppPreload(pov), div(cls := "round__underboard")(bits.crosstable(cross, pov.game)), div(cls := "round__underchat")(bits underchat pov.game) ) diff --git a/app/views/streamer/bits.scala b/app/views/streamer/bits.scala index b85e2629604c1..fa1ffb9d9a7a9 100644 --- a/app/views/streamer/bits.scala +++ b/app/views/streamer/bits.scala @@ -6,7 +6,6 @@ import lila.api.Context import lila.app.templating.Environment.{ given, * } import lila.app.ui.ScalatagsTemplate.{ *, given } import lila.i18n.LangList -import lila.user.User object bits: @@ -95,7 +94,7 @@ object bits: ) ) - def streamerTitle(s: lila.streamer.Streamer.WithContext)(implicit lang: Lang) = + def streamerTitle(s: lila.streamer.Streamer.WithContext) = span(cls := "streamer-title")( h1(dataIcon := "")(titleTag(s.user.title), s.streamer.name), s.streamer.lastStreamLang map { language => diff --git a/app/views/study/show.scala b/app/views/study/show.scala index 7ac5b09e48204..b3b0b3051d1e6 100644 --- a/app/views/study/show.scala +++ b/app/views/study/show.scala @@ -4,7 +4,7 @@ import play.api.libs.json.Json import lila.api.Context import lila.app.templating.Environment.{ given, * } -import lila.app.ui.ScalatagsTemplate.{ *, given } +import lila.app.ui.ScalatagsTemplate.* import lila.common.String.html.safeJsonValue import lila.common.Json.given import lila.socket.SocketVersion @@ -20,7 +20,7 @@ object show: chatOption: Option[lila.chat.UserChat.Mine], socketVersion: SocketVersion, streamers: List[UserId] - )(implicit ctx: Context) = + )(using ctx: Context) = views.html.base.layout( title = s.name.value, moreCss = cssTag("analyse.study"), diff --git a/app/views/swiss/form.scala b/app/views/swiss/form.scala index 1ea2fad3ad75c..ffd93e5056341 100644 --- a/app/views/swiss/form.scala +++ b/app/views/swiss/form.scala @@ -34,7 +34,7 @@ object form: advancedSettings( form3.split(fields.variant, fields.position), form3.split(fields.chatFor, fields.entryCode), - condition(form, fields, swiss = none), + condition(form), form3.split(fields.playYourGames, fields.allowList), form3.split(fields.forbiddenPairings, fields.manualPairings) ), @@ -66,7 +66,7 @@ object form: advancedSettings( form3.split(fields.variant, fields.position), form3.split(fields.chatFor, fields.entryCode), - condition(form, fields, swiss = swiss.some), + condition(form), form3.split(fields.playYourGames, fields.allowList), form3.split(fields.forbiddenPairings, fields.manualPairings) ), @@ -88,7 +88,7 @@ object form: private def advancedSettings(settings: Frag*) = details(summary("Advanced settings"), settings) - private def condition(form: Form[?], fields: SwissFields, swiss: Option[Swiss])(using ctx: Context) = + private def condition(form: Form[?])(using ctx: Context) = frag( form3.split( form3.group(form("conditions.nbRatedGame.nb"), trans.minimumRatedGames(), half = true)( diff --git a/app/views/swiss/home.scala b/app/views/swiss/home.scala index 293a526af43a8..d2ad8c45d2a31 100644 --- a/app/views/swiss/home.scala +++ b/app/views/swiss/home.scala @@ -144,7 +144,7 @@ object home: ) ) - private def faqEntry(title: Frag, content: Frag)(using Lang) = + private def faqEntry(title: Frag, content: Frag) = div(cls := "faq")( i("?"), p(strong(title), content) diff --git a/app/views/tournament/show.scala b/app/views/tournament/show.scala index 06c0908bb0ba7..13970ff62e7e0 100644 --- a/app/views/tournament/show.scala +++ b/app/views/tournament/show.scala @@ -5,10 +5,9 @@ import play.api.libs.json.Json import lila.api.Context import lila.app.templating.Environment.{ given, * } -import lila.app.ui.ScalatagsTemplate.{ *, given } +import lila.app.ui.ScalatagsTemplate.* import lila.common.String.html.safeJsonValue import lila.tournament.Tournament -import lila.user.User import controllers.routes diff --git a/app/views/tutor/bits.scala b/app/views/tutor/bits.scala index 57ab00bc77b25..e2c5f78891eed 100644 --- a/app/views/tutor/bits.scala +++ b/app/views/tutor/bits.scala @@ -1,15 +1,9 @@ package views.html.tutor -import controllers.routes -import play.api.i18n.Lang -import play.api.libs.json.* -import scalatags.Text - import lila.api.Context import lila.app.templating.Environment.{ given, * } import lila.app.ui.ScalatagsTemplate.{ *, given } -import lila.insight.InsightPosition -import lila.tutor.{ Rating, TutorBothValueOptions, TutorFullReport, TutorNumber, ValueCount } +import lila.tutor.TutorNumber object bits: @@ -33,7 +27,6 @@ object bits: !ctx.is(user) option userSpan(user, withOnline = false) private[tutor] def layout( - availability: TutorFullReport.Availability, menu: Frag, title: String = "Lichess Tutor", pageSmall: Boolean = false @@ -41,7 +34,7 @@ object bits: views.html.base.layout( moreCss = cssTag("tutor"), moreJs = jsModule("tutor"), - title = "Lichess Tutor", + title = title, csp = defaultCsp.withInlineIconFont.some ) { main(cls := List("page-menu tutor" -> true, "page-small" -> pageSmall))( diff --git a/app/views/tutor/compare.scala b/app/views/tutor/compare.scala index 23ada04012c8b..490fdd72d0340 100644 --- a/app/views/tutor/compare.scala +++ b/app/views/tutor/compare.scala @@ -1,11 +1,9 @@ package views.html.tutor -import controllers.routes import play.api.i18n.Lang -import lila.api.Context -import lila.app.templating.Environment.{ given, * } -import lila.app.ui.ScalatagsTemplate.{ *, given } +import lila.app.templating.Environment.* +import lila.app.ui.ScalatagsTemplate.* import lila.common.LilaOpeningFamily import lila.insight.{ InsightDimension, Phase } import lila.rating.PerfType diff --git a/app/views/tutor/empty.scala b/app/views/tutor/empty.scala index 299c2fd8af192..754b7dd8b06d9 100644 --- a/app/views/tutor/empty.scala +++ b/app/views/tutor/empty.scala @@ -1,7 +1,6 @@ package views.html.tutor import controllers.routes -import play.api.libs.json.* import lila.api.Context import lila.app.templating.Environment.{ given, * } @@ -15,7 +14,7 @@ import chess.format.pgn.PgnStr object empty: def start(user: User)(using Context) = - bits.layout(TutorFullReport.Empty(TutorQueue.NotInQueue), menu = emptyFrag, pageSmall = true)( + bits.layout(menu = emptyFrag, pageSmall = true)( cls := "tutor__empty box", boxTop(h1(bits.otherUser(user), "Lichess Tutor")), bits.mascotSays("Explain what tutor is about here."), @@ -26,7 +25,6 @@ object empty: def queued(in: TutorQueue.InQueue, user: User, waitGames: List[(Pov, PgnStr)])(using Context) = bits.layout( - TutorFullReport.Empty(in), menu = emptyFrag, title = "Lichess Tutor - Examining games...", pageSmall = true @@ -52,7 +50,7 @@ object empty: ) ) - private def waitGame(game: (Pov, PgnStr))(using Context) = + private def waitGame(game: (Pov, PgnStr)) = div( cls := "tutor__waiting-game lpv lpv--todo lpv--moves-false lpv--controls-false", st.data("pgn") := game._2.value, @@ -74,7 +72,7 @@ object empty: ) def insufficientGames(user: User)(using Context) = - bits.layout(TutorFullReport.InsufficientGames, menu = emptyFrag, pageSmall = true)( + bits.layout(menu = emptyFrag, pageSmall = true)( cls := "tutor__insufficient box", boxTop(h1(bits.otherUser(user), "Lichess Tutor")), mascotSaysInsufficient diff --git a/app/views/tutor/home.scala b/app/views/tutor/home.scala index ca75f3a0c93e4..02cd9e90ae3da 100644 --- a/app/views/tutor/home.scala +++ b/app/views/tutor/home.scala @@ -5,16 +5,13 @@ import controllers.routes import lila.api.Context import lila.app.templating.Environment.{ given, * } import lila.app.ui.ScalatagsTemplate.{ *, given } -import lila.common.Heapsort.given -import lila.tutor.{ TutorCompare, TutorFullReport, TutorPerfReport } -import lila.tutor.TutorCompare.given +import lila.tutor.{ TutorFullReport, TutorPerfReport } import lila.user.User -import lila.insight.Phase object home: def apply(full: TutorFullReport.Available, user: User)(using Context) = - bits.layout(full, menu = menu(full, user, none))( + bits.layout(menu = menu(full, user, none))( cls := "tutor__home box", boxTop(h1(bits.otherUser(user), "Lichess Tutor")), if (full.report.perfs.isEmpty) empty.mascotSaysInsufficient diff --git a/app/views/tutor/opening.scala b/app/views/tutor/opening.scala index 088c28ed336ad..7062db8bc6262 100644 --- a/app/views/tutor/opening.scala +++ b/app/views/tutor/opening.scala @@ -1,19 +1,16 @@ package views.html.tutor import controllers.routes -import play.api.libs.json.* import lila.api.Context -import lila.app.templating.Environment.{ given, * } +import lila.app.templating.Environment.given import lila.app.ui.ScalatagsTemplate.{ *, given } -import lila.common.LilaOpeningFamily import lila.insight.InsightPosition -import lila.tutor.{ TutorFullReport, TutorOpeningFamily, TutorPerfReport } +import lila.tutor.{ TutorOpeningFamily, TutorPerfReport } object opening: def apply( - full: TutorFullReport.Available, perfReport: TutorPerfReport, report: TutorOpeningFamily, as: chess.Color, @@ -21,7 +18,6 @@ object opening: puzzle: Option[lila.puzzle.PuzzleOpening.FamilyWithCount] )(using Context) = bits.layout( - full, title = s"Lichess Tutor • ${perfReport.perf.trans} • ${as.name} • ${report.family.name.value}", menu = frag( perfReport.openings(as).families map { family => diff --git a/app/views/tutor/openings.scala b/app/views/tutor/openings.scala index 818b193a49809..725ce3650d42c 100644 --- a/app/views/tutor/openings.scala +++ b/app/views/tutor/openings.scala @@ -1,26 +1,16 @@ package views.html.tutor import controllers.routes -import play.api.libs.json.* import lila.api.Context -import lila.app.templating.Environment.{ given, * } +import lila.app.templating.Environment.given import lila.app.ui.ScalatagsTemplate.{ *, given } -import lila.tutor.{ - Rating, - TutorBothValueOptions, - TutorBothValues, - TutorFullReport, - TutorPerfReport, - ValueCount -} +import lila.tutor.TutorPerfReport object openings: - def apply(full: TutorFullReport.Available, report: TutorPerfReport, user: lila.user.User)(using - ctx: Context - ) = - bits.layout(full, menu = perf.menu(full, user, report, "openings"))( + def apply(report: TutorPerfReport, user: lila.user.User)(using ctx: Context) = + bits.layout(menu = perf.menu(user, report, "openings"))( cls := "tutor__openings box", boxTop( h1( diff --git a/app/views/tutor/perf.scala b/app/views/tutor/perf.scala index 7164c4e3c0141..51585b126204a 100644 --- a/app/views/tutor/perf.scala +++ b/app/views/tutor/perf.scala @@ -1,11 +1,10 @@ package views.html.tutor import controllers.routes -import play.api.libs.json.* import play.api.mvc.Call import lila.api.Context -import lila.app.templating.Environment.{ given, * } +import lila.app.templating.Environment.given import lila.app.ui.ScalatagsTemplate.{ *, given } import lila.common.Heapsort.topN import lila.tutor.TutorCompare.given @@ -18,7 +17,7 @@ object perf: def apply(full: TutorFullReport.Available, report: TutorPerfReport, user: User)(using ctx: Context ) = - bits.layout(full, menu = menu(full, user, report, "perf"))( + bits.layout(menu = menu(user, report, "perf"))( cls := "tutor__perf box", boxTop( h1( @@ -73,7 +72,6 @@ object perf: ) private[tutor] def menu( - full: TutorFullReport.Available, user: User, report: TutorPerfReport, active: String @@ -95,7 +93,7 @@ object perf: ) ) - private def angleCard(title: Frag, url: Option[Call])(content: Modifier*)(using Context) = + private def angleCard(title: Frag, url: Option[Call])(content: Modifier*) = st.article( cls := List("tutor__perf__angle tutor-card" -> true, "tutor-card--link" -> url.isDefined), dataHref := url diff --git a/app/views/tutor/phases.scala b/app/views/tutor/phases.scala index fdbff0d1c289c..a2ba850da7bce 100644 --- a/app/views/tutor/phases.scala +++ b/app/views/tutor/phases.scala @@ -1,19 +1,17 @@ package views.html.tutor import controllers.routes -import play.api.libs.json.* import lila.api.Context -import lila.app.templating.Environment.{ given, * } +import lila.app.templating.Environment.given import lila.app.ui.ScalatagsTemplate.{ *, given } import lila.tutor.{ TutorFullReport, TutorPerfReport } -import lila.insight.Phase import lila.insight.InsightPosition object phases: def apply(full: TutorFullReport.Available, report: TutorPerfReport, user: lila.user.User)(using Context) = - bits.layout(full, menu = perf.menu(full, user, report, "phases"))( + bits.layout(menu = perf.menu(user, report, "phases"))( cls := "tutor__phases box", boxTop( h1( diff --git a/app/views/tutor/skills.scala b/app/views/tutor/skills.scala index 51e4a00513090..8182dc9655294 100644 --- a/app/views/tutor/skills.scala +++ b/app/views/tutor/skills.scala @@ -1,19 +1,17 @@ package views.html.tutor import controllers.routes -import play.api.libs.json.* import lila.api.Context -import lila.app.templating.Environment.{ given, * } +import lila.app.templating.Environment.given import lila.app.ui.ScalatagsTemplate.{ *, given } import lila.tutor.{ TutorFullReport, TutorPerfReport } -import lila.insight.Phase import lila.insight.InsightPosition object skills: def apply(full: TutorFullReport.Available, report: TutorPerfReport, user: lila.user.User)(using Context) = - bits.layout(full, menu = perf.menu(full, user, report, "skills"))( + bits.layout(menu = perf.menu(user, report, "skills"))( cls := "tutor__skills box", boxTop( h1( diff --git a/app/views/tutor/time.scala b/app/views/tutor/time.scala index 9088bee892391..357ccee9d1f4d 100644 --- a/app/views/tutor/time.scala +++ b/app/views/tutor/time.scala @@ -13,7 +13,7 @@ object time: def apply(full: TutorFullReport.Available, report: TutorPerfReport, user: lila.user.User)(using Context ) = - bits.layout(full, menu = perf.menu(full, user, report, "time"))( + bits.layout(menu = perf.menu(user, report, "time"))( cls := "tutor__time box", boxTop( h1( diff --git a/app/views/tv/index.scala b/app/views/tv/index.scala index 174bb78c37738..77673967e927b 100644 --- a/app/views/tv/index.scala +++ b/app/views/tv/index.scala @@ -5,7 +5,7 @@ import play.api.libs.json.Json import lila.api.Context import lila.app.templating.Environment.{ given, * } -import lila.app.ui.ScalatagsTemplate.{ *, given } +import lila.app.ui.ScalatagsTemplate.* import lila.common.String.html.safeJsonValue import controllers.routes @@ -19,7 +19,7 @@ object index: data: play.api.libs.json.JsObject, cross: Option[lila.game.Crosstable.WithMatchup], history: List[lila.game.Pov] - )(implicit ctx: Context) = + )(using Context) = views.html.round.bits.layout( variant = pov.game.variant, title = s"${channel.name} TV: ${playerText(pov.player)} vs ${playerText(pov.opponent)}", @@ -53,7 +53,7 @@ object index: side.meta(pov), side.channels(channel, champions, "/tv") ), - views.html.round.bits.roundAppPreload(pov, controls = false), + views.html.round.bits.roundAppPreload(pov), div(cls := "round__underboard")( views.html.round.bits.crosstable(cross, pov.game), div(cls := "tv-history")( diff --git a/app/views/ublog/post.scala b/app/views/ublog/post.scala index b6beaf54bd6fd..e7b1698e5acab 100644 --- a/app/views/ublog/post.scala +++ b/app/views/ublog/post.scala @@ -120,7 +120,7 @@ object post: (ctx.isAuth && !ctx.is(user)) option div(cls := "ublog-post__actions")( likeButton(post, liked, showText = true), - followButton(user, post, followed) + followButton(user, followed) ), h2(a(href := routes.Ublog.index(user.username))(trans.ublog.moreBlogPostsBy(user.username))), others.size > 0 option div(cls := "ublog-post-cards")(others map { card(_) }) @@ -156,7 +156,7 @@ object post: )(text) ) - private def followButton(user: User, post: UblogPost, followed: Boolean)(using Context) = + private def followButton(user: User, followed: Boolean)(using Context) = div( cls := List( "ublog-post__follow" -> true, @@ -193,7 +193,7 @@ object post: ) ) - def miniCard(post: UblogPost.BasePost)(using Context) = + def miniCard(post: UblogPost.BasePost) = span(cls := "ublog-post-card ublog-post-card--mini")( thumbnail(post, _.Small)(cls := "ublog-post-card__image"), h3(cls := "ublog-post-card__title")(post.title) diff --git a/app/views/user/mod.scala b/app/views/user/mod.scala index 1eec276698745..3d19f414fb6c5 100644 --- a/app/views/user/mod.scala +++ b/app/views/user/mod.scala @@ -665,10 +665,7 @@ object mod: case email => frag(email) } - def identification(mod: Holder, user: User, logins: UserLogins)(using - ctx: Context, - renderIp: RenderIp - ): Frag = + def identification(logins: UserLogins)(using ctx: Context, renderIp: RenderIp): Frag = val canIpBan = isGranted(_.IpBan) val canFpBan = isGranted(_.PrintBan) val canLocate = isGranted(_.Admin) diff --git a/app/views/userTournament/upcoming.scala b/app/views/userTournament/upcoming.scala index e6db459169f64..aa68e11cccd37 100644 --- a/app/views/userTournament/upcoming.scala +++ b/app/views/userTournament/upcoming.scala @@ -3,7 +3,7 @@ package userTournament import lila.api.Context import lila.app.templating.Environment.{ given, * } -import lila.app.ui.ScalatagsTemplate.{ *, given } +import lila.app.ui.ScalatagsTemplate.* import lila.common.paginator.Paginator import lila.user.User diff --git a/build.sbt b/build.sbt index afc9c1cc20942..2a3805fa70a36 100644 --- a/build.sbt +++ b/build.sbt @@ -11,6 +11,7 @@ lazy val root = Project("lila", file(".")) .dependsOn(api) .aggregate(api) .settings(buildSettings) + .settings(scalacOptions ++= Seq("-Wunused:all")) organization := "org.lichess" Compile / run / fork := true @@ -150,14 +151,14 @@ lazy val evaluation = module("evaluation", lazy val common = module("common", Seq(), Seq( - scalalib, galimatias, chess, + scalalib, galimatias, chess, kamon.core, scalatags, scaffeine, apacheText ) ++ specs2.bundle ++ reactivemongo.bundle ++ flexmark.bundle ) lazy val rating = module("rating", Seq(common, db, memo, i18n), - reactivemongo.bundle ++ specs2.bundle + reactivemongo.bundle ++ specs2.bundle ) lazy val perfStat = module("perfStat", diff --git a/modules/insight/src/main/JsonView.scala b/modules/insight/src/main/JsonView.scala index 74808ca17833a..8b6d1cc8557d5 100644 --- a/modules/insight/src/main/JsonView.scala +++ b/modules/insight/src/main/JsonView.scala @@ -4,6 +4,7 @@ import play.api.i18n.Lang import play.api.libs.json.* import lila.common.{ LilaOpeningFamily, SimpleOpening } +@annotation.nowarn("msg=unused") final class JsonView: import lila.insight.{ InsightDimension as D, InsightMetric as M } diff --git a/modules/tournament/src/main/Condition.scala b/modules/tournament/src/main/Condition.scala index e2318fba7f1d9..4902598856496 100644 --- a/modules/tournament/src/main/Condition.scala +++ b/modules/tournament/src/main/Condition.scala @@ -224,10 +224,10 @@ object Condition: "list" -> verdicts.list.map { case WithVerdict(cond, verd) => Json.obj( "condition" -> cond.name(using lang), - "verdict" -> (verd match { + "verdict" -> (verd match case Refused(reason) => reason(lang) case Accepted => JsString("ok") - }) + ) ) }, "accepted" -> verdicts.accepted diff --git a/project/BuildSettings.scala b/project/BuildSettings.scala index 3ce11795c25c0..6f73e95eca244 100644 --- a/project/BuildSettings.scala +++ b/project/BuildSettings.scala @@ -56,8 +56,8 @@ object BuildSettings { "-feature", "-language:postfixOps", "-language:implicitConversions", - "-Xtarget:12", - "-Wunused:all" + "-Xtarget:12" + // "-Wunused:all" ) val srcMain = Seq(