include more detail in the status messages

This commit is contained in:
Jesse D. McDonald 2020-04-30 04:27:30 -05:00
parent 72c92ae08e
commit 838699994a
1 changed files with 7 additions and 4 deletions

View File

@ -580,6 +580,9 @@ $(function (){
}
function putMeta(extra) {
function player(side) {
return (side === PS.LIGHT ? 'light' : 'dark');
}
const gameId = $('#cb_board').data('gameId');
const lightName = $('#cb_light_name').val();
const darkName = $('#cb_dark_name').val();
@ -588,10 +591,10 @@ $(function (){
const lastMove = currentGame.lastMove || {};
const lastMeta = lastMove.meta || {};
const status =
(currentGame.status === PS.PLAYING) ? '' :
(currentGame.status === PS.CHECKMATE) ? 'checkmate' :
(currentGame.status === PS.RESIGNED) ? 'resigned' :
'ended';
(currentGame.status === PS.PLAYING) ? `${player(currentGame.player)}'s turn` :
(currentGame.status === PS.CHECKMATE) ? `checkmate — ${player(winner)} won` :
(currentGame.status === PS.RESIGNED) ? `${player(lastMove.side)} resigned` :
'game ended';
const meta = {
lightName,