hide all ratings WIP
parent
f974aa5b8c
commit
1917816fb8
|
@ -131,7 +131,7 @@ object UserInfo {
|
|||
playbanApi: lila.playban.PlaybanApi
|
||||
)(implicit ec: scala.concurrent.ExecutionContext) {
|
||||
def apply(user: User, nbs: NbGames, ctx: Context): Fu[UserInfo] =
|
||||
(ctx.noBlind ?? ratingChartApi(user)).mon(_.user segment "ratingChart") zip
|
||||
((ctx.noBlind && ctx.pref.showRatings) ?? ratingChartApi(user)).mon(_.user segment "ratingChart") zip
|
||||
relationApi.countFollowers(user.id).mon(_.user segment "nbFollowers") zip
|
||||
!(user.is(User.lichessId) || user.isBot) ??
|
||||
postApi.nbByUser(user.id).mon(_.user segment "nbForumPosts") zip
|
||||
|
|
|
@ -362,8 +362,8 @@ object activity {
|
|||
)}</score>"""
|
||||
}
|
||||
|
||||
private def ratingProgFrag(r: RatingProg) =
|
||||
ratingTag(r.after.value, ratingProgress(r.diff))
|
||||
private def ratingProgFrag(r: RatingProg)(implicit 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) =
|
||||
if (p == 0) ""
|
||||
|
|
|
@ -132,18 +132,22 @@ object widgets {
|
|||
userIdLink(playerUser.id.some, withOnline = false),
|
||||
br,
|
||||
player.berserk option berserkIconSpan,
|
||||
playerUser.rating,
|
||||
player.provisional option "?",
|
||||
playerUser.ratingDiff map { d =>
|
||||
frag(" ", showRatingDiff(d))
|
||||
}
|
||||
ctx.pref.showRatings option frag(
|
||||
playerUser.rating,
|
||||
player.provisional option "?",
|
||||
playerUser.ratingDiff map { d =>
|
||||
frag(" ", showRatingDiff(d))
|
||||
}
|
||||
)
|
||||
)
|
||||
} getOrElse {
|
||||
player.aiLevel map { level =>
|
||||
frag(
|
||||
span(aiName(level, withRating = false)),
|
||||
br,
|
||||
aiRating(level)
|
||||
ctx.pref.showRatings option frag(
|
||||
br,
|
||||
aiRating(level)
|
||||
)
|
||||
)
|
||||
} getOrElse {
|
||||
(player.nameSplit.fold[Frag](anonSpan) { case (name, rating) =>
|
||||
|
|
|
@ -39,7 +39,9 @@ object mini {
|
|||
if (u.lame && !ctx.me.has(u) && !isGranted(_.UserModView))
|
||||
div(cls := "upt__info__warning")(trans.thisAccountViolatedTos())
|
||||
else
|
||||
div(cls := "upt__info__ratings")(u.best8Perfs map { showPerfRating(u, _) })
|
||||
ctx.pref.showRatings option div(cls := "upt__info__ratings")(u.best8Perfs map {
|
||||
showPerfRating(u, _)
|
||||
})
|
||||
),
|
||||
ctx.userId map { myId =>
|
||||
frag(
|
||||
|
|
|
@ -186,7 +186,7 @@ object header {
|
|||
if (info.ratingChart.isDefined && (!u.lame || ctx.is(u) || isGranted(_.UserModView)))
|
||||
div(cls := "rating-history")(spinner)
|
||||
else
|
||||
ctx.is(u) option newPlayer(u),
|
||||
(ctx.is(u) && u.count.game < 10) option newPlayer(u),
|
||||
div(cls := "profile-side")(
|
||||
div(cls := "user-infos")(
|
||||
!ctx.is(u) option frag(
|
||||
|
|
|
@ -29,36 +29,38 @@ object side {
|
|||
"empty" -> perf.isEmpty,
|
||||
"active" -> active.has(perfType)
|
||||
),
|
||||
href := {
|
||||
href := ctx.pref.showRatings.?? {
|
||||
if (isPuzzle) ctx.is(u) option routes.Puzzle.dashboard(30, "home").url
|
||||
else routes.User.perfStat(u.username, perfType.key).url.some
|
||||
},
|
||||
span(
|
||||
h3(perfType.trans),
|
||||
if (isPuzzle && u.perfs.dubiousPuzzle && !ctx.is(u)) st.rating(strong("?"))
|
||||
if (isPuzzle && u.perfs.dubiousPuzzle && !ctx.is(u) && ctx.pref.showRatings) st.rating(strong("?"))
|
||||
else
|
||||
st.rating(
|
||||
if (perf.glicko.clueless) strong("?")
|
||||
else
|
||||
strong(
|
||||
perf.glicko.intRating,
|
||||
perf.provisional option "?"
|
||||
),
|
||||
" ",
|
||||
ratingProgress(perf.progress),
|
||||
" ",
|
||||
ctx.pref.showRatings option frag(
|
||||
if (perf.glicko.clueless) strong("?")
|
||||
else
|
||||
strong(
|
||||
perf.glicko.intRating,
|
||||
perf.provisional option "?"
|
||||
),
|
||||
" ",
|
||||
ratingProgress(perf.progress),
|
||||
" "
|
||||
),
|
||||
span(
|
||||
if (perfType.key == "puzzle") trans.nbPuzzles.plural(perf.nb, perf.nb.localize)
|
||||
else trans.nbGames.plural(perf.nb, perf.nb.localize)
|
||||
)
|
||||
),
|
||||
rankMap get perfType map { rank =>
|
||||
rankMap get perfType ifTrue ctx.pref.showRatings map { rank =>
|
||||
span(cls := "rank", title := trans.rankIsUpdatedEveryNbMinutes.pluralSameTxt(15))(
|
||||
trans.rankX(rank.localize)
|
||||
)
|
||||
}
|
||||
),
|
||||
iconTag("")
|
||||
ctx.pref.showRatings option iconTag("")
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ private object PrefHandlers {
|
|||
"insightShare" -> o.insightShare,
|
||||
"keyboardMove" -> o.keyboardMove,
|
||||
"zen" -> o.zen,
|
||||
"ratings" -> o.ratings,
|
||||
"rookCastle" -> o.rookCastle,
|
||||
"moveEvent" -> o.moveEvent,
|
||||
"pieceNotation" -> o.pieceNotation,
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
@include transition;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
&[href]:hover {
|
||||
background: mix($c-bg-box, $c-bg-page, 50%);
|
||||
|
||||
&::before {
|
||||
|
|
Loading…
Reference in New Issue