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