score in nav

This commit is contained in:
ntr 2019-06-11 22:27:23 +10:00
parent 6bf5b684ca
commit ed4de4a54a
3 changed files with 9 additions and 4 deletions

View File

@ -6,7 +6,7 @@ const addState = connect(
function receiveState(state) {
const { ws, team, account } = state;
function sendInstanceNew(sConstructs, pve) {
function sendInstanceNew(sConstructs, name, pve) {
if (sConstructs.length) {
return ws.sendInstanceNew(sConstructs, account.name, pve);
}

View File

@ -118,9 +118,13 @@ function Nav(args) {
return true;
}
const joined = instances.map(i => (
<button key={i.id} onClick={() => joinInstance(i)} >{i.name}</button>
));
const joined = instances.map(i => {
const score = i.players.find(p => p.id === account.id);
const phase = i.rounds[i.rounds.length - 1].game_id
? 'In game'
: 'Vbox';
return <button key={i.id} onClick={() => joinInstance(i)} >{`${phase} ${score.wins} / ${score.losses}`}</button>
});
const haxSection = process.env.NODE_ENV === 'development'
? (

View File

@ -156,6 +156,7 @@ function createSocket(events) {
function accountInstanceList(res) {
const [struct, playerList] = res;
events.setAccountInstances(playerList);
setTimeout(sendAccountInstances, 5000);
}
function accountConstructs(response) {