Skip to content

Commit

Permalink
improve tournament notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Oct 28, 2012
1 parent 02686fc commit 1c995a6
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions app/tournament/Hub.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ final class Hub(

case Reload notifyReload

case Start notifyVersion("start", JsNull)

case ReloadPage notifyVersion("reloadPage", JsNull)

case PingVersion(uid, v) {
Expand Down
4 changes: 4 additions & 0 deletions app/tournament/Socket.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ final class Socket(
private val timeoutDuration = 1 second
implicit private val timeout = Timeout(timeoutDuration)

def start(tournamentId: String) = io {
hubMaster ! Forward(tournamentId, Start)
}

def reload(tournamentId: String) = io {
hubMaster ! Forward(tournamentId, Reload)
}
Expand Down
2 changes: 1 addition & 1 deletion app/tournament/TournamentApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private[tournament] final class TournamentApi(
def start(created: Created): Option[IO[Unit]] = created.start map { started
for {
_ repo saveIO started
_ socket reload started.id
_ socket start started.id
_ reloadSiteSocket
_ lobbyReload
} yield ()
Expand Down
1 change: 1 addition & 0 deletions app/tournament/actorApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ case class CloseTournament(tournamentId: String)
case object GetTournamentIds
case class GetHub(tournamentId: String)
case class Forward(tournamentId: String, msg: Any)
case object Start
case object Reload
case object ReloadPage
case object HubTimeout
Expand Down
6 changes: 6 additions & 0 deletions public/javascripts/big.js
Original file line number Diff line number Diff line change
Expand Up @@ -1768,9 +1768,15 @@ $(function() {
});
}

function start() {
alert("Tournament is starting!");
reload();
}

lichess.socket = new strongSocket(lichess.socketUrl + socketUrl, _ld_.version, $.extend(true, lichess.socketDefaults, {
events: {
talk: function(e) { if (chatExists) addToChat(e); },
start: start,
reload: reload,
reloadPage: function() {
location.reload();
Expand Down
2 changes: 1 addition & 1 deletion public/stylesheets/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ div.notifications {
div.notifications > div {
margin-left: 211px;
width: 498px;
border: 1px solid #404040;
border: 1px solid #c0c0c0;
padding: 6px 8px 7px 8px;
margin-bottom: 8px;
border-radius: 3px;
Expand Down
2 changes: 1 addition & 1 deletion public/stylesheets/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ body.dark div.lichess_overboard p.explanations,
body.dark div.search_status,
body.dark #tournament table.data,
body.dark #tournament table.data thead th,
#tournament table.data
body.dark div.notifications > div
{
border-color: #3e3e3e;
}
Expand Down

0 comments on commit 1c995a6

Please sign in to comment.