From fc0717c5ad539066d798986163834060f86ce6c6 Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Sun, 6 Oct 2024 11:44:12 +0200 Subject: [PATCH] remove leaderboard and tournament winners from homepage --- app/mashup/Preload.scala | 15 +++------------ app/views/lobby/bits.scala | 39 +------------------------------------- app/views/lobby/home.scala | 2 +- ui/lobby/css/_box.scss | 17 ----------------- ui/lobby/css/_layout.scss | 38 ++++++------------------------------- 5 files changed, 11 insertions(+), 100 deletions(-) diff --git a/app/mashup/Preload.scala b/app/mashup/Preload.scala index 6670a45c1166..6308cd8c664f 100644 --- a/app/mashup/Preload.scala +++ b/app/mashup/Preload.scala @@ -20,8 +20,6 @@ final class Preload( tv: lila.tv.Tv, gameRepo: lila.game.GameRepo, perfsRepo: lila.user.UserPerfsRepo, - userCached: lila.user.Cached, - tourWinners: lila.tournament.WinnersApi, timelineApi: lila.timeline.EntryApi, liveStreamApi: lila.streamer.LiveStreamApi, dailyPuzzle: lila.puzzle.DailyPuzzle.Try, @@ -54,7 +52,7 @@ final class Preload( ( ( ( - (((((((((data, povs), tours), events), simuls), feat), entries), lead), tWinners), puzzle), + (((((((data, povs), tours), events), simuls), feat), entries), puzzle), streams ), playban @@ -71,8 +69,6 @@ final class Preload( .zip(simuls.mon(_.lobby.segment("simuls"))) .zip(tv.getBestGame.mon(_.lobby.segment("tvBestGame"))) .zip((ctx.userId.so(timelineApi.userEntries)).mon(_.lobby.segment("timeline"))) - .zip(userCached.topWeek.mon(_.lobby.segment("userTopWeek"))) - .zip(tourWinners.all.dmap(_.top).mon(_.lobby.segment("tourWinners"))) .zip((ctx.noBot.so(dailyPuzzle())).mon(_.lobby.segment("puzzle"))) .zip( ctx.kid.no.so( @@ -93,11 +89,10 @@ final class Preload( (currentGame, _) <- (ctx.me .soUse(currentGameMyTurn(povs, lightUserApi.sync))) .mon(_.lobby.segment("currentGame")) - .zip( + .zip: lightUserApi - .preloadMany(tWinners.map(_.userId) ::: entries.flatMap(_.userIds).toList) + .preloadMany(entries.flatMap(_.userIds).toList) .mon(_.lobby.segment("lightUsers")) - ) yield Homepage( data, entries, @@ -107,8 +102,6 @@ final class Preload( relayListing.spotlight, simuls, feat, - lead, - tWinners, puzzle, streams.excludeUsers(events.flatMap(_.hostedBy)), playban, @@ -153,8 +146,6 @@ object Preload: relays: List[lila.relay.RelayTour.ActiveWithSomeRounds], simuls: List[Simul], featured: Option[Game], - leaderboard: List[lila.core.user.LightPerf], - tournamentWinners: List[Winner], puzzle: Option[lila.puzzle.DailyPuzzle.WithHtml], streams: LiveStreams.WithTitles, playban: Option[TempBan], diff --git a/app/views/lobby/bits.scala b/app/views/lobby/bits.scala index 95228e9a23aa..ef563af2194f 100644 --- a/app/views/lobby/bits.scala +++ b/app/views/lobby/bits.scala @@ -12,46 +12,9 @@ object bits: def underboards( tours: List[lila.tournament.Tournament], - simuls: List[lila.simul.Simul], - leaderboard: List[lila.core.user.LightPerf], - tournamentWinners: List[lila.tournament.Winner] + simuls: List[lila.simul.Simul] )(using ctx: Context) = frag( - ctx.pref.showRatings.option( - div(cls := "lobby__leaderboard lobby__box")( - div(cls := "lobby__box__top")( - h2(cls := "title text", dataIcon := Icon.CrownElite)(trans.site.leaderboard()), - a(cls := "more", href := routes.User.list)(trans.site.more(), " »") - ), - div(cls := "lobby__box__content"): - table: - tbody: - leaderboard.map: l => - tr( - td(lightUserLink(l.user)), - td(cls := "text", dataIcon := PerfType(l.perfKey).icon)(l.rating), - td(ratingProgress(l.progress)) - ) - ) - ), - div(cls := s"lobby__box ${if ctx.pref.showRatings then "lobby__winners" else "lobby__wide-winners"}")( - div(cls := "lobby__box__top")( - h2(cls := "title text", dataIcon := Icon.Trophy)(trans.arena.tournamentWinners()), - a(cls := "more", href := routes.Tournament.leaderboard)(trans.site.more(), " »") - ), - div(cls := "lobby__box__content"): - table: - tbody: - tournamentWinners - .take(10) - .map: w => - tr( - td(userIdLink(w.userId.some)), - td: - a(title := w.tourName, href := routes.Tournament.show(w.tourId)): - views.tournament.ui.scheduledTournamentNameShortHtml(w.tourName) - ) - ), div(cls := "lobby__tournaments-simuls")( div(cls := "lobby__tournaments lobby__box")( a(cls := "lobby__box__top", href := routes.Tournament.home)( diff --git a/app/views/lobby/home.scala b/app/views/lobby/home.scala index 5cb76aaf2c64..8c9c6bc41297 100644 --- a/app/views/lobby/home.scala +++ b/app/views/lobby/home.scala @@ -132,7 +132,7 @@ object home: .map: views.ublog.ui.card(_, showAuthor = views.ublog.ui.ShowAt.bottom, showIntro = false) , - ctx.noBot.option(bits.underboards(tours, simuls, leaderboard, tournamentWinners)), + ctx.noBot.option(bits.underboards(tours, simuls)), div(cls := "lobby__feed"): views.feed.lobbyUpdates(lastUpdates) , diff --git a/ui/lobby/css/_box.scss b/ui/lobby/css/_box.scss index ebad18c4e86a..98ba201e62c2 100644 --- a/ui/lobby/css/_box.scss +++ b/ui/lobby/css/_box.scss @@ -49,11 +49,6 @@ border-top: $border; max-width: 21ch; - /* prevent leaderboard overflow due to long usernames */ - &:first-child { - padding-inline-start: 0.7em; - } - &.name a { font-weight: bold; color: $c-font-dim; @@ -71,18 +66,6 @@ } } - &__leaderboard, - &__winners { - td:first-child { - @extend %ellipsis; - } - - td:last-child { - text-align: right; - padding-inline-end: 0.7em; - } - } - &__blog .lobby__box__top { border-bottom: $border; } diff --git a/ui/lobby/css/_layout.scss b/ui/lobby/css/_layout.scss index 401b3480ebee..638df1c860d7 100644 --- a/ui/lobby/css/_layout.scss +++ b/ui/lobby/css/_layout.scss @@ -2,23 +2,12 @@ ---cols: 1; // ui/lobby/src/main.ts grid-area: main; display: grid; - grid-template-areas: 'app' 'table' 'side' 'blog' 'support' 'feed' 'tv' 'puzzle' 'tours' 'leader' 'winner' 'timeline' 'about'; + grid-template-areas: 'app' 'table' 'side' 'blog' 'support' 'feed' 'tv' 'puzzle' 'tours' 'timeline' 'about'; grid-gap: $block-gap; &__tournaments, - &__simuls, - &__leaderboard, - &__winners { - max-height: 20em; - } - // this helps in empty dev mode - &__leaderboard, - &__winners { - min-height: 20em; - } - //sets min height when we disable Show player ratings and there is only Tournament winners box to display - &__wide-winners { - min-height: 20em; + &__simuls { + max-height: 30em; } @include mq-at-least-col2 { @@ -34,7 +23,6 @@ 'feed feed' 'tours tours' 'timeline timeline' - 'leader winner' 'about about'; &__support { @@ -57,9 +45,8 @@ 'tv blog blog' 'tv support support' 'puzzle feed feed' - 'leader tours tours' - 'winner tours tours' - 'winner about about'; + 'tours tours tours' + 'about about about'; &__start { margin: 2em 0 0 0; @@ -87,8 +74,7 @@ 'tv blog blog puzzle' 'tv support support puzzle' 'feed feed tours tours' - 'feed feed leader winner' - 'about about leader winner'; + '. about about .'; &__start { justify-content: center; @@ -133,18 +119,6 @@ grid-area: tv; } - &__leaderboard { - grid-area: leader; - } - - &__winners { - grid-area: winner; - } - - &__wide-winners { - grid-area: leader / leader / leader / winner; - } - &__puzzle { grid-area: puzzle; }