improve challenge notification
This commit is contained in:
parent
8cd3cf28de
commit
79c6583bb3
|
@ -4,6 +4,8 @@ package actor
|
|||
import akka.actor._
|
||||
import play.api.templates.Html
|
||||
|
||||
import lila.game.GameRepo
|
||||
import lila.user.UserRepo
|
||||
import views.{ html ⇒ V }
|
||||
|
||||
private[app] final class Renderer extends Actor {
|
||||
|
@ -19,8 +21,13 @@ private[app] final class Renderer extends Actor {
|
|||
case lila.tournament.actorApi.RemindTournament(tournament) ⇒
|
||||
sender ! V.tournament.reminder(tournament)
|
||||
|
||||
case lila.hub.actorApi.setup.RemindChallenge(gameId, from, _) ⇒
|
||||
sender ! V.setup.challengeNotification(gameId, from)
|
||||
case lila.hub.actorApi.setup.RemindChallenge(gameId, from, _) ⇒ {
|
||||
val replyTo = sender
|
||||
(GameRepo game gameId) zip (UserRepo named from) foreach {
|
||||
case (Some(game), Some(user)) ⇒ replyTo ! V.setup.challengeNotification(game, user)
|
||||
case x ⇒ logwarn(s"remind challenge $x")
|
||||
}
|
||||
}
|
||||
|
||||
case lila.hub.actorApi.RemindDeployPre ⇒ sender ! V.notification.deploy("pre")
|
||||
case lila.hub.actorApi.RemindDeployPost ⇒ sender ! V.notification.deploy("post")
|
||||
|
|
|
@ -13,7 +13,7 @@ import lila.lobby.actorApi.GetOpen
|
|||
import lila.lobby.{ Hook, HookRepo }
|
||||
import lila.setup.FilterConfig
|
||||
import lila.socket.History
|
||||
import lila.timeline.{ Entry, GameEntry }
|
||||
import lila.timeline.Entry
|
||||
import lila.tournament.Created
|
||||
import lila.user.{ User, Context }
|
||||
import lila.relation.RelationApi
|
||||
|
|
|
@ -2,19 +2,17 @@ package lila.app
|
|||
package templating
|
||||
|
||||
import chess.format.Forsyth
|
||||
import chess.{ Status => S, Variant, Color, Clock, Mode }
|
||||
import lila.user.{ User, Context }
|
||||
import lila.game.{ Game, Player, Namer }
|
||||
|
||||
import lila.user.Env.{ current ⇒ userEnv }
|
||||
|
||||
import chess.{ Status ⇒ S, Variant, Color, Clock, Mode }
|
||||
import controllers.routes
|
||||
|
||||
import play.api.templates.Html
|
||||
import play.api.mvc.Call
|
||||
import play.api.templates.Html
|
||||
|
||||
import lila.game.{ Game, Player, Namer }
|
||||
import lila.user.Env.{ current ⇒ userEnv }
|
||||
import lila.user.{ User, Context }
|
||||
|
||||
|
||||
trait GameHelper { self: I18nHelper with UserHelper with AiHelper with StringHelper ⇒
|
||||
|
||||
def variantName(variant: Variant)(implicit ctx: Context) = variant match {
|
||||
case Variant.Standard ⇒ trans.standard.str()
|
||||
case Variant.Chess960 ⇒ "chess960"
|
||||
|
@ -27,6 +25,12 @@ trait GameHelper { self: I18nHelper with UserHelper with AiHelper with StringHel
|
|||
def clockName(clock: Clock)(implicit ctx: Context): String =
|
||||
trans.nbMinutesPerSidePlusNbSecondsPerMove.str(clock.limitInMinutes, clock.increment)
|
||||
|
||||
def clockNameNoCtx(clock: Option[Clock]): String =
|
||||
clock.fold(trans.unlimited.en())(clockNameNoCtx)
|
||||
|
||||
def clockNameNoCtx(clock: Clock): String =
|
||||
trans.nbMinutesPerSidePlusNbSecondsPerMove.en(clock.limitInMinutes, clock.increment)
|
||||
|
||||
def shortClockName(clock: Option[Clock])(implicit ctx: Context): String =
|
||||
clock.fold(trans.unlimited.str())(Namer.shortClock)
|
||||
|
||||
|
@ -37,6 +41,11 @@ trait GameHelper { self: I18nHelper with UserHelper with AiHelper with StringHel
|
|||
case Mode.Rated ⇒ trans.rated.str()
|
||||
}
|
||||
|
||||
def modeNameNoCtx(mode: Mode): String = mode match {
|
||||
case Mode.Casual ⇒ trans.casual.en()
|
||||
case Mode.Rated ⇒ trans.rated.en()
|
||||
}
|
||||
|
||||
def playerUsername(player: Player, withRating: Boolean = true) =
|
||||
Namer.player(player, withRating)(userEnv.usernameOrAnonymous).await
|
||||
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
@(gameId: String, userId: String)
|
||||
@(game: Game, user: User)
|
||||
|
||||
@notification.view("challenge_reminder", closable = false) {
|
||||
@userIdLink(userId.some) @trans.challengeToPlay.en()
|
||||
<a class="action decline" href="@routes.Setup.decline(gameId)">@trans.decline.en()</a>
|
||||
<a class="action" href="@routes.Round.watcher(gameId, "white")">View challenge</a>
|
||||
<div>
|
||||
@userLink(user) @trans.challengeToPlay.en()
|
||||
@clockNameNoCtx(game.clock)
|
||||
@modeNameNoCtx(game.mode)
|
||||
</div>
|
||||
<div class="actions">
|
||||
<a class="action decline" href="@routes.Setup.decline(game.id)">@trans.decline.en()</a>
|
||||
<a class="action" href="@routes.Round.watcher(game.id, "white")">View challenge</a>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -1959,10 +1959,13 @@ body.homepage #notifications {
|
|||
#notifications .user_link {
|
||||
display: inline-block;
|
||||
}
|
||||
#notifications .actions {
|
||||
text-align: right;
|
||||
width: 100%;
|
||||
margin: 3px 0 3px 0;
|
||||
}
|
||||
#notifications .action {
|
||||
float: right;
|
||||
display: block;
|
||||
margin-left: 8px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
a.hover_text > .base, a.hover_text:hover > .hover {
|
||||
display: inline-block;
|
||||
|
|
|
@ -22,7 +22,7 @@ body.dark #hooks_wrap > div.tabs > a, body.dark #top div.auth .links a:hover, bo
|
|||
background-color: #3e3e3e;
|
||||
color: #b0b0b0;
|
||||
}
|
||||
body.dark #top a.signin, body.dark #top a.toggle:hover, body.dark #top .dropdown, body.dark #top a.goto_nav.current, body.dark #top a.goto_nav:hover, body.dark #top ul.language_links a.accepted {
|
||||
body.dark #notifications > div, body.dark #top a.signin, body.dark #top a.toggle:hover, body.dark #top .dropdown, body.dark #top a.goto_nav.current, body.dark #top a.goto_nav:hover, body.dark #top ul.language_links a.accepted {
|
||||
color: #b0b0b0;
|
||||
}
|
||||
body.dark #top .dropdown, body.dark #top .shown a.toggle {
|
||||
|
|
Loading…
Reference in a new issue