Skip to content

Commit

Permalink
remove leaderboard and tournament winners from homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Oct 6, 2024
1 parent 7c0af8e commit fc0717c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 100 deletions.
15 changes: 3 additions & 12 deletions app/mashup/Preload.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand All @@ -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,
Expand All @@ -107,8 +102,6 @@ final class Preload(
relayListing.spotlight,
simuls,
feat,
lead,
tWinners,
puzzle,
streams.excludeUsers(events.flatMap(_.hostedBy)),
playban,
Expand Down Expand Up @@ -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],
Expand Down
39 changes: 1 addition & 38 deletions app/views/lobby/bits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)(
Expand Down
2 changes: 1 addition & 1 deletion app/views/lobby/home.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
,
Expand Down
17 changes: 0 additions & 17 deletions ui/lobby/css/_box.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
38 changes: 6 additions & 32 deletions ui/lobby/css/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -34,7 +23,6 @@
'feed feed'
'tours tours'
'timeline timeline'
'leader winner'
'about about';

&__support {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit fc0717c

Please sign in to comment.