implement ZH trophy
This commit is contained in:
parent
a185a12eba
commit
ee55e9f275
|
@ -1,5 +1,7 @@
|
|||
@(u: User, info: lila.app.mashup.UserInfo)(implicit ctx: Context)
|
||||
|
||||
@import lila.user.Trophy.Kind
|
||||
|
||||
@defining(info.allTrophies.filter(_.kind.klass.has("fire_trophy"))) { fireTrophies =>
|
||||
@if(fireTrophies.nonEmpty) {
|
||||
<div class="stacked">
|
||||
|
@ -13,11 +15,31 @@
|
|||
</div>
|
||||
}
|
||||
}
|
||||
@info.allTrophies.find(_.kind == lila.user.Trophy.Kind.ZugMiracle).map { t =>
|
||||
@info.allTrophies.find(_.kind == Kind.ZugMiracle).map { t =>
|
||||
<style type="text/css">
|
||||
.user_show .trophy.zugMiracle {
|
||||
height: 80px;
|
||||
margin: 0 8px!important;
|
||||
transition: 2s;
|
||||
}
|
||||
@@keyframes psyche {
|
||||
100% { filter: hue-rotate(360deg); }
|
||||
}
|
||||
.user_show .trophy.zugMiracle:hover {
|
||||
transform: translateY(-9px);
|
||||
animation: psyche 0.3s ease-in-out infinite alternate;
|
||||
}
|
||||
</style>
|
||||
<a @t.kind.url.map { url => href="@url" } class="trophy award @t.kind.key @t.kind.klass hint--left" data-hint="@t.kind.name">
|
||||
<img src="@staticUrl("images/trophy/zug-trophy.png")" height=80 />
|
||||
</a>
|
||||
}
|
||||
@info.allTrophies.find(_.kind == Kind.ZHWC).map { t =>
|
||||
<a @t.kind.url.map { url => href="@url" } class="trophy award @t.kind.key @t.kind.klass hint--left" data-hint="@t.kind.name"
|
||||
style="width: 65px; height: 80px; margin: 0 3px!important;">
|
||||
<img src="@staticUrl("images/trophy/zhwc.png")" width=65 height=80 />
|
||||
</a>
|
||||
}
|
||||
@defining(info.allTrophies.filter(_.kind.klass.has("icon3d"))) { iconTrophies =>
|
||||
@iconTrophies.sorted.map { trophy =>
|
||||
@trophy.kind.icon.map { iconChar =>
|
||||
|
|
|
@ -128,16 +128,24 @@ object Trophy {
|
|||
order = 102
|
||||
)
|
||||
|
||||
object ZHWC extends Kind(
|
||||
key = "zhwc",
|
||||
name = "Crazyhouse champion",
|
||||
icon = none,
|
||||
url = "//lichess.org/blog/WMnMzSEAAMgA3oAW/crazyhouse-world-championship-the-candidates".some,
|
||||
klass = none,
|
||||
order = 1
|
||||
)
|
||||
|
||||
val all = List(
|
||||
ZugMiracle,
|
||||
Streamer, Developer, Moderator,
|
||||
MarathonTopHundred, MarathonTopTen, MarathonTopFifty, MarathonWinner,
|
||||
ZugMiracle, ZHWC,
|
||||
WayOfBerserk,
|
||||
MarathonSurvivor,
|
||||
MarathonWinner, MarathonTopTen, MarathonTopFifty, MarathonTopHundred,
|
||||
BongcloudWarrior,
|
||||
Developer, Moderator,
|
||||
Streamer
|
||||
BongcloudWarrior
|
||||
)
|
||||
def byKey(key: String) = all find (_.key == key)
|
||||
val byKey: Map[String, Kind] = all.map { k => k.key -> k }(scala.collection.breakOut)
|
||||
}
|
||||
|
||||
def make(userId: String, kind: Trophy.Kind) = Trophy(
|
||||
|
|
|
@ -8,7 +8,7 @@ final class TrophyApi(coll: Coll) {
|
|||
|
||||
private implicit val trophyKindBSONHandler = new BSONHandler[BSONString, Trophy.Kind] {
|
||||
def read(bsonString: BSONString): Trophy.Kind =
|
||||
Trophy.Kind byKey bsonString.value err s"No such trophy kind: ${bsonString.value}"
|
||||
Trophy.Kind.byKey get bsonString.value err s"No such trophy kind: ${bsonString.value}"
|
||||
def write(x: Trophy.Kind) = BSONString(x.key)
|
||||
}
|
||||
private implicit val trophyBSONHandler = Macros.handler[Trophy]
|
||||
|
@ -22,5 +22,5 @@ final class TrophyApi(coll: Coll) {
|
|||
def awardMarathonWinner(userId: String): Funit = award(userId, Trophy.Kind.MarathonWinner)
|
||||
|
||||
def findByUser(user: User, max: Int = 12): Fu[List[Trophy]] =
|
||||
coll.find(BSONDocument("user" -> user.id)).cursor[Trophy]().gather[List](max)
|
||||
coll.find($doc("user" -> user.id)).list[Trophy](max)
|
||||
}
|
||||
|
|
BIN
public/images/trophy/zhwc.png
Normal file
BIN
public/images/trophy/zhwc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
|
@ -84,18 +84,6 @@
|
|||
.user_show .fire_trophy.bongcloudWarrior {
|
||||
filter: hue-rotate(70deg);
|
||||
}
|
||||
.user_show .trophy.zugMiracle {
|
||||
height: 80px;
|
||||
margin: 0 8px!important;
|
||||
transition: 2s;
|
||||
}
|
||||
@keyframes psyche {
|
||||
100% { filter: hue-rotate(360deg); }
|
||||
}
|
||||
.user_show .trophy.zugMiracle:hover {
|
||||
transform: translateY(-9px);
|
||||
animation: psyche 0.3s ease-in-out infinite alternate;
|
||||
}
|
||||
.user_show .packed .trophy {
|
||||
margin-right: -8px;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue