fix, cleanup, remove dead code

This commit is contained in:
Thibault Duplessis 2014-11-20 01:04:35 +01:00
parent d2b004bea0
commit 7cd48893aa
3 changed files with 18 additions and 36 deletions

View file

@ -58,5 +58,6 @@ trans.replayAndAnalyse,
trans.boardEditor,
trans.continueFromHere,
trans.playWithTheMachine,
trans.playWithAFriend
trans.playWithAFriend,
trans.yourOpponentWantsToPlayANewGameWithYou
)))

View file

@ -1036,9 +1036,8 @@ div.table .notyet {
width: 190px;
margin-top: 5px;
}
.lichess_ground .control.buttons a.lichess_play_again {
.lichess_ground .control.buttons a.fat {
font-size: 150%;
margin-left: 0;
}
.lichess_ground .control.buttons a.replay_and_analyse {
margin-bottom: 10px;
@ -1170,29 +1169,6 @@ div.control {
text-align: center;
width: 100%;
}
div.control button {
margin: auto;
}
div.control a.lichess_play_again {
margin-left: 1em;
}
div.control div.lichess_play_again_join {
text-align: left;
}
div.control div.lichess_play_again_join a.lichess_play_again {
margin-left: 0;
font-size: 150%;
display: block;
}
div.control div.rematch_alert {
margin-bottom: 1em;
}
div.control div.rematch_alert .button {
margin-top: 1em;
}
div.control div.rematch_wait {
margin-bottom: 1em;
}
div.control.icons .button {
font-size: 16px;
height: 34px;
@ -1218,7 +1194,7 @@ div.control.buttons .button {
text-decoration: none;
font-weight: bold;
}
div.control .rematch.disabled {
div.control .button.disabled {
opacity: 0.5;
cursor: not-allowed;
}

View file

@ -79,19 +79,20 @@ module.exports = {
rematch: function(ctrl) {
if (status.finished(ctrl.data) || status.aborted(ctrl.data)) {
if (ctrl.data.opponent.onGame) {
return m('a.rematch.offer.button.hint--bottom', {
return m('a.button.hint--bottom', {
'data-hint': ctrl.trans('playWithTheSameOpponentAgain'),
onclick: partial(ctrl.socket.send, 'rematch-yes', null)
}, ctrl.trans('rematch'));
} else {
return m('a.rematch.offer.button.disabled', ctrl.trans('rematch'));
return m('a.button.disabled', ctrl.trans('rematch'));
}
}
},
answerOpponentRematch: function(ctrl) {
if (ctrl.data.opponent.offeringRematch) return [
m('a.glowing.button.lichess_play_again.rematch.hint--bottom', {
ctrl.trans('yourOpponentWantsToPlayANewGameWithYou'),
m('a.glowing.button.fat.hint--bottom', {
'data-hint': ctrl.trans('playWithTheSameOpponentAgain'),
onclick: partial(ctrl.socket.send, 'rematch-yes', null),
}, ctrl.trans('joinTheGame')),
@ -101,9 +102,14 @@ module.exports = {
];
},
cancelRematch: function(ctrl) {
if (ctrl.data.player.offeringRematch) return m('a.rematch_cancel.button', {
onclick: partial(ctrl.socket.send, 'rematch-no', null),
}, ctrl.trans('cancelRematchOffer'));
if (ctrl.data.player.offeringRematch) return [
ctrl.trans('rematchOfferSent'),
m('br'),
ctrl.trans('waitingForOpponent'),
m('a.button', {
onclick: partial(ctrl.socket.send, 'rematch-no', null),
}, ctrl.trans('cancelRematchOffer'))
];
},
viewRematch: function(ctrl) {
if (ctrl.data.game.rematch) return m('a.viewRematch.button[data-icon=v]', {
@ -113,8 +119,7 @@ module.exports = {
joinRematch: function(ctrl) {
if (ctrl.data.game.rematch) return [
ctrl.trans('rematchOfferAccepted'),
m('br'), m('br'),
m('a.glowing.button.lichess_play_again.rematch.hint--bottom', {
m('a.glowing.button.fat.hint--bottom', {
'data-hint': ctrl.trans('playWithTheSameOpponentAgain'),
href: ctrl.router.Round.watcher(ctrl.data.game.rematch, ctrl.data.opponent.color).url
}, ctrl.trans('joinTheGame'))
@ -137,7 +142,7 @@ module.exports = {
}, m('span[data-icon=O]'));
},
replayAndAnalyse: function(ctrl) {
if (game.replayable(ctrl.data)) return m('a.button.replay_and_analyse[data-icon=G]', {
if (game.replayable(ctrl.data) && !ctrl.data.player.offeringRematch) return m('a.button.replay_and_analyse', {
href: ctrl.router.Round.watcher(ctrl.data.game.id, ctrl.data.player.color).url
}, ctrl.trans('replayAndAnalyse'));
}