marathon and simul spotlights

proxy-selector
Thibault Duplessis 2016-07-26 17:14:49 +02:00
parent 1c951dccdf
commit 9d04c4e75c
8 changed files with 31 additions and 7 deletions

View File

@ -204,14 +204,15 @@ trait UserHelper { self: I18nHelper with StringHelper with NumberHelper =>
s"""<span $klass $href>$icon$titleS$content$rating</span>"""
}
def userIdSpanMini(userId: String, withOnline: Boolean = false) = Html {
def userIdSpanMini(userId: String, withOnline: Boolean = false, rating: Option[Int] = None) = Html {
val user = lightUser(userId)
val name = user.fold(userId)(_.name)
val content = user.fold(userId)(_.titleNameHtml)
val klass = userClass(userId, none, withOnline)
val href = s"data-${userHref(name)}"
val icon = withOnline ?? lineIcon(user)
s"""<span $klass $href>$icon$content</span>"""
val ra = rating.??(r => s" ($r)")
s"""<span $klass $href>$icon$content$ra</span>"""
}
private def renderRating(perf: Perf) =

View File

@ -16,6 +16,9 @@
@tours.flatMap(_.spotlightedNow).map {
case (tour, spot) => { @tournament.homepageSpotlight(tour, spot) }
}
@simuls.find(_.spotlightable).map { s =>
@simul.homepageSpotlight(s)
}
@ctx.me.map { u =>
<div id="timeline" data-href="@routes.Timeline.home">
@timeline.entries(userTimeline)

View File

@ -0,0 +1,12 @@
@(s: lila.simul.Simul)(implicit ctx: Context)
<a href="@routes.Simul.show(s.id)" class="tour_spotlight simul_spotlight id_@s.id">
<img class="img icon" src="@staticUrl("images/fire-silhouette.svg")" />
<span class="content">
<span class="name">@s.name simul</span>
<span class="headline">@userIdSpanMini(s.hostId, withOnline = false, rating = s.hostRating.some)</span>
<span class="more">
@trans.nbConnectedPlayers(s.applicants.size.localize) • @trans.join()
</span>
</span>
</a>

View File

@ -5,8 +5,9 @@
@spot.iconImg.map { i =>
<img class="img" src="@staticUrl(s"images/$i")" />
}.getOrElse {
@spot.iconFont.map { i =>
<i class="img" data-icon="@i"></i>
@spot.iconFont.map {
case "\\" => { <img class="img icon" src="@staticUrl(s"images/globe.svg")" /> }
case i => { <i class="img" data-icon="@i"></i> }
}.getOrElse {
<i class="img" data-icon="g"></i>
}

View File

@ -113,6 +113,8 @@ case class Simul(
def isNotBrandNew = createdAt isBefore DateTime.now.minusSeconds(10)
private def Created(s: => Simul): Simul = if (isCreated) s else this
def spotlightable = isCreated && hostRating >= 2200
}
object Simul {

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" ><path d="M0 0h512v512H0z" fill="transparent" stroke="transparent" stroke-width="0"></path><path fill="#ffffff" d="M272.95 16.707c-151.29 47.714 57.322 110.88-26.536 131.344C190.7 161.648 137.3 96.283 192.947 45.313c-90.766 32.524-66.292 89.67-12.396 113.25 34.31 15.01 31.884 61.38 8.643 64.637 46.37-54.285-116.637-44.737-86.03-147.47-126.44 158.063 132.535 163.37 51.6 273.194 16.4-51.26-51.074-33.42-65.52-77.88-48.557 115.975 86.87 96.047 107.81 222.95h36.394l-7.375-108.703H196.93c0-49.724 3.178-108.336 45.2-116.245-7.75-9.352-12.786-24.51-12.786-39.207 0-26.536 15.774-48.523 35.98-51.15h.002c1.348-.17 2.78 0 4.164 0 22.13 0 40.145 22.846 40.145 51.15 0 14.334-4.772 29.304-12.192 38.613 45.905 7.12 44.903 66.976 44.903 116.84H314.69l-6.524 108.704h36.752c14.29-138.24 137.056-121.245 77.576-235.742 9.728 46.034-32.646 93.67-53.514 52.13-19.04-37.903 125.515-105.092 70.21-215.175 4.588 81.484-114.155 120.303-118.663 65.824 52.768 23.022 73.61-45.905 30.02-71.985-40.69-24.346-116.444-36.76-77.596-72.338zm69.488 20.635c44.895 15.685 63.888 78.675 48.73 110.674 18.238-3.568 70.807-106.98-48.73-110.674z"></path></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" ><path d="M0 0h512v512H0z" fill="transparent" stroke="transparent"></path><path d="M322.02 20.184l-17.13 42.273c7.053 2.776 13.857 6.04 20.372 9.758l8.62-13.274 15.675 10.18-8.637 13.296c.85.628 1.692 1.266 2.53 1.91l-19.745 22.735c4.994 3.747 9.706 7.85 14.1 12.268l19.754-22.746c.187.184.38.366.567.55l11.795-10.618 12.504 13.89-11.79 10.614c4.71 5.887 9.005 12.117 12.846 18.648l14.114-7.19 8.482 16.653-14.092 7.177c3.015 6.877 5.555 14.007 7.578 21.353l15.452-3.283 3.884 18.28-15.445 3.282c1.114 7.374 1.71 14.918 1.77 22.59l15.777.827-.98 18.664-15.74-.825c-.835 7.61-2.214 15.056-4.09 22.303l14.947 4.857-5.777 17.774-14.922-4.85c-2.767 7.09-6.03 13.934-9.75 20.486l13.142 8.537-10.18 15.674-13.13-8.528c-4.493 6.108-9.418 11.877-14.725 17.273l10.46 11.617-13.89 12.506-10.437-11.594c-5.9 4.734-12.14 9.062-18.69 12.924l7.05 13.838-16.65 8.484-7.033-13.803c-6.898 3.034-14.055 5.585-21.427 7.62l3.213 15.123-18.28 3.884-3.21-15.107c-7.405 1.125-14.978 1.735-22.682 1.797l-.808 15.41-18.662-.98.807-15.368c-7.645-.834-15.127-2.208-22.405-4.092l-4.738 14.58-17.773-5.777 4.73-14.55c-7.124-2.78-13.997-6.063-20.575-9.803l-8.328 12.822-15.672-10.18 8.33-12.824c-.93-.685-1.848-1.384-2.762-2.088l19.848-22.853c-4.997-3.743-9.71-7.842-14.108-12.257l-19.848 22.853c-.156-.152-.314-.302-.47-.455l-11.356 10.226-12.504-13.89 11.347-10.216c-4.563-5.7-8.737-11.725-12.49-18.03l-38.9 23.71c9.515 15.894 21.132 30.386 34.472 43.088l-20.575 23.69 14.112 12.255 20.575-23.693c34.76 27.522 78.7 43.96 126.482 43.96 1.365 0 2.726-.023 4.084-.05v19.473c-34.134 15.356-59.115 36.682-79.753 59.906h197.54c-19.674-24.32-44.835-43.993-80.784-59.712V409.41c92.908-19.004 162.8-101.184 162.8-199.68 0-58.094-24.315-110.51-63.323-147.636l20.58-23.698-14.11-12.253-20.584 23.7c-15.464-12.24-32.75-22.278-51.376-29.66zm-75.108 82.664c-59.132 0-106.838 47.692-106.838 106.8 0 59.11 47.706 106.8 106.838 106.8 59.132 0 106.838-47.69 106.838-106.8 0-9.375-1.203-18.462-3.46-27.12-10.244 25.087-23.08 45.15-45.905 66.95-16.887-1.487-29.712-8.08-40.643-19.966 6.048-8.86 13.09-17.22 27.096-22.102-12.564-28.283-18.19-56.568-21.393-84.85 12.464 4.59 20.16 11.93 29.235 24.954 7.712 1.697 16.863-6.856 23.27-13.975-19.274-18.99-45.752-30.692-75.038-30.692zm-32.48 65.03c17.62 12.56 32.407 31.486 38.03 52.517-11.065 9.256-16.907 21.124-19.92 34.406 16.957 8.23 30.048 21.297 41.65 36.22v.007c-34.438-3.405-68.245-9.135-98.696-27.164-12.172-20.824-19.107-41.65-19.92-62.474 16.6-7.525 33.2-4.936 49.8.895 9.222-11.47 9.186-20.922 9.056-34.408z" fill="#ffffff"></path></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -670,8 +670,9 @@ div.game_config .color_submits button.random i {
}
.tour_spotlight {
display: flex;
flex: 0 0 auto;
align-items: center;
margin: 15px 0 5px -30px;
margin: 10px 0 5px -30px;
color: #fff!important;
background: #4166a0;
padding: 5px;
@ -698,7 +699,8 @@ div.game_config .color_submits button.random i {
filter: brightness(9);
-webkit-filter: brightness(9);
}
.tour_spotlight i.img {
.tour_spotlight i.img,
.tour_spotlight .img.icon {
margin: 0 5px 0 0;
}
.tour_spotlight i.img::before {
@ -707,13 +709,14 @@ div.game_config .color_submits button.random i {
.tour_spotlight .content {
display: block;
}
.tour_spotlight span {
.tour_spotlight > span {
display: block;
}
.tour_spotlight span.name {
font-size: 15px;
}
.tour_spotlight span.headline {
display: block;
font-size: 10px;
}
.tour_spotlight span.more {