From c090851de6dc5b1e160afa5e8073791c0fa39e11 Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Mon, 15 Jun 2015 20:35:36 +0200 Subject: [PATCH] lichess donor trophy --- app/mashup/UserInfo.scala | 9 +++++++- app/views/user/show.scala.html | 31 +++++++++++++--------------- modules/round/src/main/History.scala | 2 -- modules/user/src/main/Trophy.scala | 7 +++++++ public/stylesheets/dark.css | 3 +++ public/stylesheets/user-show.css | 13 ++++++++++++ 6 files changed, 45 insertions(+), 20 deletions(-) diff --git a/app/mashup/UserInfo.scala b/app/mashup/UserInfo.scala index cd59b74823..84c20fa243 100644 --- a/app/mashup/UserInfo.scala +++ b/app/mashup/UserInfo.scala @@ -10,7 +10,7 @@ import lila.forum.PostApi import lila.game.{ GameRepo, Game, Crosstable, PlayTime } import lila.relation.RelationApi import lila.security.Granter -import lila.user.{ User, Trophies, TrophyApi } +import lila.user.{ User, Trophy, Trophies, TrophyApi } case class UserInfo( user: User, @@ -35,6 +35,13 @@ case class UserInfo( def nbWithMe = crosstable ?? (_.nbGames) def percentRated: Int = math.round(nbRated / user.count.game.toFloat * 100) + + def allTrophies = (donor ?? List(Trophy( + _id = "", + user = user.id, + kind = Trophy.Kind.Donor, + date = org.joda.time.DateTime.now) + )) ::: trophies } object UserInfo { diff --git a/app/views/user/show.scala.html b/app/views/user/show.scala.html index 38d35fd707..b077fce7ec 100644 --- a/app/views/user/show.scala.html +++ b/app/views/user/show.scala.html @@ -72,6 +72,20 @@ openGraph = Map( 'description -> describeUser(u))) {
+ @info.allTrophies.map { trophy => + + href="@url" + } class="trophy award @trophy.kind.key @trophy.kind.klass hint--left" data-hint="@trophy.kind.name"> + @trophy.kind match { + case lila.user.Trophy.Kind.ZugMiracle => { + + } + case _ => { + + } + } + + } @if(!u.lame) { @info.ranks.map { case (perf, rank) if rank == 1 => { @@ -97,20 +111,6 @@ openGraph = Map( case _ => {} } } - @info.trophies.map { trophy => - - href="@url" - } class="trophy award @trophy.kind.key @trophy.kind.klass hint--left" data-hint="@trophy.kind.name"> - @trophy.kind match { - case lila.user.Trophy.Kind.ZugMiracle => { - - } - case _ => { - - } - } - - }

@u.titleUsername

@if(u.disabled) { CLOSED @@ -203,9 +203,6 @@ openGraph = Map(

@title

} } - @if(info.donor) { - Lichess Donor - } @u.profile.map { p => @NotForKids { @p.nonEmptyRealName.map { name => diff --git a/modules/round/src/main/History.scala b/modules/round/src/main/History.scala index 6345adf046..fffe1a4276 100644 --- a/modules/round/src/main/History.scala +++ b/modules/round/src/main/History.scala @@ -20,10 +20,8 @@ private[round] final class History( load: Fu[VersionedEvents], persist: VersionedEvents => Unit) { - // private var version = 0 private var events: VersionedEvents = _ - // TODO optimize def getVersion: Int = { waitForLoadedEvents events.headOption.??(_.version) diff --git a/modules/user/src/main/Trophy.scala b/modules/user/src/main/Trophy.scala index 8672cd1cbe..ae57305487 100644 --- a/modules/user/src/main/Trophy.scala +++ b/modules/user/src/main/Trophy.scala @@ -82,6 +82,13 @@ object Trophy { url = "http://lichess.org/report".some, "icon3d".some) + object Donor extends Kind( + key = "donor", + name = "Lichess donor", + icon = "".some, + url = "http://lichess.org/donate".some, + "icon3d".some) + val all = List( ZugMiracle, WayOfBerserk, diff --git a/public/stylesheets/dark.css b/public/stylesheets/dark.css index 64076317a5..9d5e6fb076 100644 --- a/public/stylesheets/dark.css +++ b/public/stylesheets/dark.css @@ -515,6 +515,9 @@ body.dark .variant_icons span { 0px 0px 10px #000, 0px 0px 20px #000; } +body.dark div.user_show .trophy.donor span:hover { + color: rgba(255,255,255,0.7); +} body.dark .fire_trophy.wayOfBerserk span { color: rgba(255,255,255,0.5); } diff --git a/public/stylesheets/user-show.css b/public/stylesheets/user-show.css index a4599fcd65..3531a81823 100644 --- a/public/stylesheets/user-show.css +++ b/public/stylesheets/user-show.css @@ -83,6 +83,19 @@ div.user_show .fire_trophy.bongcloudWarrior { filter: hue-rotate(70deg); -webkit-filter: hue-rotate(70deg); } +div.user_show .trophy.donor span { + color: #d59120; + transition: 0.5s; +} +div.user_show .trophy.donor:hover { + margin-top: -14px!important; +} +div.user_show .trophy.donor span:hover { + animation: fire 1.25s ease-in-out infinite alternate; + -moz-animation: fire 1.25s ease-in-out infinite alternate; + -webkit-animation: fire 1.25s ease-in-out infinite alternate; + -o-animation: fire 1.25s ease-in-out infinite alternate; +} div.user_show .honorific { display: inline-block; margin-top: 1em;