From a223d96a692ba979a62bcf588ab7f83fb339fa27 Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Tue, 6 Jan 2015 02:22:58 +0100 Subject: [PATCH] fix tournament UI bugs --- public/stylesheets/tournament.css | 1 + ui/lobby/src/view/playing.js | 2 +- ui/tournament/src/tournament.js | 2 +- ui/tournament/src/view/util.js | 8 ++++---- ui/tournament/src/xhr.js | 1 + 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/public/stylesheets/tournament.css b/public/stylesheets/tournament.css index f555029706..6c1b2069c5 100644 --- a/public/stylesheets/tournament.css +++ b/public/stylesheets/tournament.css @@ -131,6 +131,7 @@ ol.scheduled_tournaments a:hover { width: 0; background: #759900; opacity: 0.5; + transition: width 0.5s; } #tournament button.right { float: right; diff --git a/ui/lobby/src/view/playing.js b/ui/lobby/src/view/playing.js index ad87e91dee..ee123d82a1 100644 --- a/ui/lobby/src/view/playing.js +++ b/ui/lobby/src/view/playing.js @@ -18,7 +18,7 @@ module.exports = function(ctrl) { class: pov.isMyTurn ? 'my_turn' : '' }, [ m('span', { - class: 'mini_board mini_board_' + pov.id + ' parse_fen is2d', + class: 'mini_board live_' + pov.id + ' parse_fen is2d', 'data-color': pov.color, 'data-fen': pov.fen, 'data-lastmove': pov.lastMove, diff --git a/ui/tournament/src/tournament.js b/ui/tournament/src/tournament.js index 2357247d8d..a249d3c329 100644 --- a/ui/tournament/src/tournament.js +++ b/ui/tournament/src/tournament.js @@ -6,7 +6,7 @@ module.exports = { }, containsMe: function(ctrl) { return ctrl.userId && ctrl.data.players.filter(function(p) { - return p.id === ctrl.userId; + return p.id === ctrl.userId && !p.withdraw; }).length > 0; }, myCurrentPairing: function(ctrl) { diff --git a/ui/tournament/src/view/util.js b/ui/tournament/src/view/util.js index 95c52b4a31..0f87a11231 100644 --- a/ui/tournament/src/view/util.js +++ b/ui/tournament/src/view/util.js @@ -8,7 +8,7 @@ function miniGame(game) { m('a', { key: game.id, href: '/' + game.id, - class: 'mini_board mini_board_' + game.id + ' live live_' + game.id + ' parse_fen is2d', + class: 'mini_board live_' + game.id + ' parse_fen is2d', 'data-color': game.color, 'data-fen': game.fen, 'data-lastmove': game.lastMove, @@ -24,10 +24,10 @@ function miniGame(game) { game.user1.rating ]), m('div.right', [ - game.user1.name, + game.user2.name, m('br'), - game.user1.rating, - game.user1.title ? ' ' + game.user1.title : '' + game.user2.rating, + game.user2.title ? ' ' + game.user2.title : '' ]) ]) ]); diff --git a/ui/tournament/src/xhr.js b/ui/tournament/src/xhr.js index 6dd04b3a67..a5432b0a38 100644 --- a/ui/tournament/src/xhr.js +++ b/ui/tournament/src/xhr.js @@ -13,6 +13,7 @@ function tourAction(action, ctrl) { url: '/tournament/' + ctrl.data.id + '/' + action, config: xhrConfig }).then(null, function() { + // when the tournament no longer exists location.reload(); }); }