link insights from user pages - beta users only
This commit is contained in:
parent
8a87b50a99
commit
6c2709967e
|
@ -41,7 +41,8 @@ final class Env(
|
|||
getRanks = Env.user.cached.ranking.getAll,
|
||||
isDonor = Env.donation.isDonor,
|
||||
isHostingSimul = Env.simul.isHosting,
|
||||
isStreamer = Env.tv.isStreamer.apply) _
|
||||
isStreamer = Env.tv.isStreamer.apply,
|
||||
insightShare = Env.insight.share) _
|
||||
|
||||
system.actorOf(Props(new actor.Renderer), name = RendererName)
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ case class UserInfo(
|
|||
playTime: User.PlayTime,
|
||||
donor: Boolean,
|
||||
trophies: Trophies,
|
||||
isStreamer: Boolean) {
|
||||
isStreamer: Boolean,
|
||||
insightVisible: Boolean) {
|
||||
|
||||
def nbRated = user.count.rated
|
||||
|
||||
|
@ -65,7 +66,8 @@ object UserInfo {
|
|||
getRanks: String => Fu[Map[String, Int]],
|
||||
isDonor: String => Fu[Boolean],
|
||||
isHostingSimul: String => Fu[Boolean],
|
||||
isStreamer: String => Boolean)(user: User, ctx: Context): Fu[UserInfo] =
|
||||
isStreamer: String => Boolean,
|
||||
insightShare: lila.insight.Share)(user: User, ctx: Context): Fu[UserInfo] =
|
||||
countUsers() zip
|
||||
getRanks(user.id) zip
|
||||
(gameCached nbPlaying user.id) zip
|
||||
|
@ -78,8 +80,9 @@ object UserInfo {
|
|||
postApi.nbByUser(user.id) zip
|
||||
isDonor(user.id) zip
|
||||
trophyApi.findByUser(user) zip
|
||||
(user.count.rated >= 10).??(insightShare.grant(user, ctx.me)) zip
|
||||
PlayTime(user) flatMap {
|
||||
case ((((((((((((nbUsers, ranks), nbPlaying), nbImported), crosstable), ratingChart), nbFollowing), nbFollowers), nbBlockers), nbPosts), isDonor), trophies), playTime) =>
|
||||
case (((((((((((((nbUsers, ranks), nbPlaying), nbImported), crosstable), ratingChart), nbFollowing), nbFollowers), nbBlockers), nbPosts), isDonor), trophies), insightVisible), playTime) =>
|
||||
(nbPlaying > 0) ?? isHostingSimul(user.id) map { hasSimul =>
|
||||
new UserInfo(
|
||||
user = user,
|
||||
|
@ -98,7 +101,8 @@ object UserInfo {
|
|||
playTime = playTime,
|
||||
donor = isDonor,
|
||||
trophies = trophies,
|
||||
isStreamer = isStreamer(user.id))
|
||||
isStreamer = isStreamer(user.id),
|
||||
insightVisible = insightVisible)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -269,6 +269,13 @@ description = describeUser(u)).some) {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if(info.insightVisible && isGranted(_.Beta)) {
|
||||
<a class="insight" href="@routes.Insight.index(u.username)">
|
||||
<span class="icon" data-icon="7"></span>
|
||||
<strong>Chess Insights</strong>
|
||||
<em>Analytics from @if(ctx.is(u)){your}else{@u.username's} games</em>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@if(u.hasGames || info.nbImported > 0) {
|
||||
|
|
|
@ -110,6 +110,7 @@ body.dark .leaderboard_title,
|
|||
body.dark #friend_box,
|
||||
body.dark #friend_box .title,
|
||||
body.dark div.user_show div.user-infos,
|
||||
body.dark div.user_show .insight,
|
||||
body.dark div.game_config input[type="text"],
|
||||
body.dark #powerTip,
|
||||
body.dark #miniGame,
|
||||
|
|
|
@ -174,11 +174,56 @@ div.user_show .user-infos {
|
|||
border-left: 1px solid #c0c0c0;
|
||||
overflow: hidden;
|
||||
width: 305px;
|
||||
height: 325px;
|
||||
height: 265px;
|
||||
}
|
||||
div.user_show .user-infos:hover {
|
||||
overflow-y: auto;
|
||||
}
|
||||
div.user_show .insight {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
padding: 0 14px;
|
||||
width: 306px;
|
||||
height: 60px;
|
||||
border-top: 1px solid #c0c0c0;
|
||||
border-left: 1px solid #c0c0c0;
|
||||
}
|
||||
div.user_show .insight .icon {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 10px;
|
||||
}
|
||||
div.user_show .insight .icon::before {
|
||||
color: #3893E8;
|
||||
font-size: 40px;
|
||||
line-height: 60px;
|
||||
opacity: 0.8;
|
||||
}
|
||||
div.user_show .insight strong {
|
||||
color: #3893E8;
|
||||
display: block;
|
||||
font-weight: normal;
|
||||
font-size: 1.5em;
|
||||
margin: 10px 0 1px 0;
|
||||
}
|
||||
div.user_show .insight em {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: block;
|
||||
width: 275px;
|
||||
}
|
||||
div.user_show .insight:hover {
|
||||
background: #3893E8;
|
||||
}
|
||||
div.user_show .insight:hover,
|
||||
div.user_show .insight:hover *,
|
||||
div.user_show .insight:hover .icon::before {
|
||||
transition: 0.13s;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
div.user_show .name,
|
||||
div.user_show .bio,
|
||||
div.user_show .stats,
|
||||
|
|
Loading…
Reference in a new issue