move simul socket message handler to ui/round

This commit is contained in:
Thibault Duplessis 2017-08-19 11:00:52 -05:00
parent 42e8ffe9c3
commit a05e6f0711
3 changed files with 10 additions and 11 deletions

View file

@ -1,13 +1,13 @@
/// <reference types="types/lichess" /> /// <reference types="types/lichess" />
import { GameData, GameView, Player, Status, Source } from './interfaces'; import { GameData, GameView, Player, Status, Source, Simul } from './interfaces';
import * as game from './game'; import * as game from './game';
import * as status from './status'; import * as status from './status';
import * as router from './router'; import * as router from './router';
import viewStatus from './view/status'; import viewStatus from './view/status';
export { GameData, Player, Status, Source, game, status, router }; export { GameData, Player, Status, Source, Simul, game, status, router };
export const view: GameView = { export const view: GameView = {
status: viewStatus status: viewStatus

View file

@ -4,6 +4,7 @@ import * as xhr from './xhr';
import * as sound from './sound'; import * as sound from './sound';
import RoundController from './ctrl'; import RoundController from './ctrl';
import { Untyped, ApiEnd } from './interfaces'; import { Untyped, ApiEnd } from './interfaces';
import { Simul } from 'game';
const li = window.lichess; const li = window.lichess;
@ -123,6 +124,12 @@ export function make(send: SocketSend, ctrl: RoundController): RoundSocket {
li.hasToReload = true; li.hasToReload = true;
location.href = '/' + gameId; location.href = '/' + gameId;
} }
},
simulEnd(simul: Simul) {
$.modal($(
'<p>Simul complete!</p><br /><br />' +
'<a class="button" href="/simul/' + simul.id + '">Back to ' + simul.name + ' simul</a>'
));
} }
}; };

View file

@ -120,20 +120,12 @@ lichess.topMenuIntent = function() {
'<div class="actions">' + '<div class="actions">' +
'<a class="withdraw text" href="' + url + '/withdraw" data-icon="Z">Pause</a>' + '<a class="withdraw text" href="' + url + '/withdraw" data-icon="Z">Pause</a>' +
'<a class="text" href="' + url + '" data-icon="G">Join</a>' + '<a class="text" href="' + url + '" data-icon="G">Join</a>' +
'</div>' + '</div></div></div>'
'</div>' +
'</div>'
).find("a.withdraw").click(function() { ).find("a.withdraw").click(function() {
$.post($(this).attr("href")); $.post($(this).attr("href"));
$('#tournament_reminder').remove(); $('#tournament_reminder').remove();
return false; return false;
}); });
},
simulEnd: function(simul) {
$.modal($(
'<p>Simul complete!</p><br /><br />' +
'<a class="button" href="/simul/' + simul.id + '">Back to ' + simul.name + ' simul</a>'
));
} }
}, },
params: {}, params: {},