show game names in TV chat
This commit is contained in:
parent
53de86926a
commit
53c244a93a
|
@ -1,6 +1,9 @@
|
|||
@(messages: List[(Option[String], String)])(implicit ctx: Context)
|
||||
|
||||
@messages.map {
|
||||
case (Some("lichess"), text) => {
|
||||
<li class="system">@text</li>
|
||||
}
|
||||
case (username, text) => {
|
||||
<li><span>@usernameLink(username, withOnline = false, truncate = 12.some)</span>@text</li>
|
||||
}
|
||||
|
|
|
@ -22,7 +22,9 @@ cssClass = "spectators")(roomHtml)
|
|||
@confrontation.map { c =>
|
||||
@user.confrontation(c)
|
||||
}.getOrElse {
|
||||
<div class="confrontation">
|
||||
<div class="vs">@playerLink(pov.game.creator, withElo = false, withOnline = false) vs @playerLink(pov.game.invited, withElo = false, withOnline = false)</div>
|
||||
</div>
|
||||
}
|
||||
<br />
|
||||
<span class="s16 clock">@shortClockName(pov.game.clock)</span>
|
||||
|
|
|
@ -41,7 +41,7 @@ final class Env(
|
|||
|
||||
lazy val featured = new Featured(
|
||||
lobbySocket = hub.socket.lobby,
|
||||
roundSocket = hub.socket.round,
|
||||
roundActor = hub.actor.round,
|
||||
rendererActor = hub.actor.renderer,
|
||||
system = system)
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import tube.gameTube
|
|||
|
||||
final class Featured(
|
||||
lobbySocket: lila.hub.ActorLazyRef,
|
||||
roundSocket: lila.hub.ActorLazyRef,
|
||||
roundActor: lila.hub.ActorLazyRef,
|
||||
rendererActor: lila.hub.ActorLazyRef,
|
||||
system: ActorSystem) {
|
||||
|
||||
|
@ -37,7 +37,7 @@ final class Featured(
|
|||
|
||||
case Set(game) ⇒ {
|
||||
oneId = game.id.some
|
||||
roundSocket ! actorApi.ChangeFeaturedId(game.id)
|
||||
roundActor ! actorApi.ChangeFeaturedGame(game)
|
||||
rendererActor ? actorApi.RenderFeaturedJs(game) onSuccess {
|
||||
case html: Html ⇒ lobbySocket ! actorApi.ChangeFeatured(html)
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ final class Featured(
|
|||
}
|
||||
|
||||
def isWayBetter(g1: Game, g2: Game) =
|
||||
score(g2.resetTurns) > (score(g1.resetTurns) * 1.3)
|
||||
score(g2.resetTurns) > (score(g1.resetTurns) * 1.2)
|
||||
|
||||
def rematch(game: Game): Fuog = game.next ?? $find.byId[Game]
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import play.api.libs.json.JsObject
|
|||
import play.api.templates.Html
|
||||
|
||||
case class ChangeFeatured(html: Html)
|
||||
case class ChangeFeaturedId(id: String)
|
||||
case class ChangeFeaturedGame(game: Game)
|
||||
case class RenderFeaturedJs(game: Game)
|
||||
|
||||
case class TellWatchers(msg: JsObject)
|
||||
|
|
|
@ -27,6 +27,7 @@ final class Env(config: Config, system: ActorSystem) {
|
|||
val timeline = actorLazyRef("timeline.user")
|
||||
val bookmark = actorLazyRef("bookmark")
|
||||
val roundMap = actorLazyRef("round.map")
|
||||
val round = actorLazyRef("round.actor")
|
||||
val lobby = actorLazyRef("lobby")
|
||||
val relation = actorLazyRef("relation")
|
||||
val challenger = actorLazyRef("challenger")
|
||||
|
|
|
@ -3,11 +3,11 @@ package lila.round
|
|||
import akka.actor._
|
||||
import akka.pattern.ask
|
||||
import com.typesafe.config.Config
|
||||
import makeTimeout.large
|
||||
|
||||
import lila.common.PimpedConfig._
|
||||
import lila.socket.actorApi.GetVersion
|
||||
import lila.hub.actorApi.map.Ask
|
||||
import makeTimeout.large
|
||||
import lila.socket.actorApi.GetVersion
|
||||
|
||||
final class Env(
|
||||
config: Config,
|
||||
|
@ -18,6 +18,7 @@ final class Env(
|
|||
hub: lila.hub.Env,
|
||||
ai: () ⇒ Fu[lila.ai.Ai],
|
||||
getUsername: String ⇒ Fu[Option[String]],
|
||||
getUsernameOrAnon: String ⇒ Fu[String],
|
||||
i18nKeys: lila.i18n.I18nKeys,
|
||||
scheduler: lila.common.Scheduler) {
|
||||
|
||||
|
@ -36,6 +37,7 @@ final class Env(
|
|||
val HijackTimeout = config duration "hijack.timeout"
|
||||
val NetDomain = config getString "net.domain"
|
||||
val ActorMapName = config getString "actor.map.name"
|
||||
val ActorName = config getString "actor.name"
|
||||
}
|
||||
import settings._
|
||||
|
||||
|
@ -108,6 +110,18 @@ final class Env(
|
|||
private[round] def animationDelay = AnimationDelay
|
||||
private[round] def moretimeSeconds = Moretime.toSeconds
|
||||
|
||||
system.actorOf(Props(new Actor {
|
||||
def receive = {
|
||||
case msg @ lila.game.actorApi.ChangeFeaturedGame(game) ⇒ {
|
||||
socketHub ! msg
|
||||
def playerName(p: lila.game.Player) = lila.game.Namer.player(p, false)(getUsernameOrAnon)
|
||||
(game.players map playerName).sequenceFu foreach { names ⇒
|
||||
WatcherRoomRepo.addMessage("tv", "lichess".some, names mkString " vs ")
|
||||
}
|
||||
}
|
||||
}
|
||||
}), name = ActorName)
|
||||
|
||||
{
|
||||
import scala.concurrent.duration._
|
||||
|
||||
|
@ -148,6 +162,7 @@ object Env {
|
|||
hub = lila.hub.Env.current,
|
||||
ai = lila.ai.Env.current.ai,
|
||||
getUsername = lila.user.Env.current.usernameOption,
|
||||
getUsernameOrAnon = lila.user.Env.current.usernameOrAnonymous,
|
||||
i18nKeys = lila.i18n.Env.current.keys,
|
||||
scheduler = lila.common.PlayApp.scheduler)
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ private[round] final class SocketHub(
|
|||
|
||||
def _receive: Receive = {
|
||||
|
||||
case lila.game.actorApi.ChangeFeaturedId(id) ⇒ tellAll {
|
||||
lila.game.actorApi.TellWatchers(makeMessage("featured_id", id))
|
||||
case lila.game.actorApi.ChangeFeaturedGame(game) ⇒ tellAll {
|
||||
lila.game.actorApi.TellWatchers(makeMessage("featured_id", game.id))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -806,7 +806,11 @@ var storage = {
|
|||
resize: true,
|
||||
render: function(u, t) {
|
||||
if (self.options.player.spectator) {
|
||||
return '<li><span>' + $.userLinkLimit(u, 14) + '</span>' + urlToLink(t) + '</li>';
|
||||
if (u == 'lichess') {
|
||||
return '<li class="system">' + urlToLink(t) + '</li>';
|
||||
} else {
|
||||
return '<li><span>' + $.userLinkLimit(u, 14) + '</span>' + urlToLink(t) + '</li>';
|
||||
}
|
||||
} else {
|
||||
return '<li class="' + u + (u == 'system' ? ' trans_me' : '') + '">' + urlToLink(t) + '</li>';
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
|
||||
app.thread = new SpeedOMeter({
|
||||
name : "THREAD",
|
||||
maxVal : 500,
|
||||
maxVal : 1000,
|
||||
threshold: 0.8,
|
||||
container : container
|
||||
});
|
||||
|
|
|
@ -585,6 +585,12 @@ div.lichess_chat li {
|
|||
line-height: 14px;
|
||||
margin: 0.6em 0 0.6em 3px;
|
||||
}
|
||||
div.lichess_chat li.system {
|
||||
padding: 3px;
|
||||
background: #e0e0e0;
|
||||
margin-left: 0;
|
||||
text-align: center;
|
||||
}
|
||||
div.lichess_chat.kings ol.lichess_messages {
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
|
|
@ -160,6 +160,7 @@ body.dark #top a.bgpicker:hover,
|
|||
body.dark a#sound_state:hover,
|
||||
body.dark #top .dropdown,
|
||||
body.dark #GameText a:hover,
|
||||
body.dark div.lichess_chat li.system,
|
||||
body.dark #hooks_wrap a.filter:hover,
|
||||
body.dark #hooks_wrap a.filter.active,
|
||||
body.dark div.content_box_inter a.intertab:hover,
|
||||
|
|
Loading…
Reference in a new issue