default view games list

This commit is contained in:
ntr
2019-07-07 15:42:29 +10:00
parent ec4252d5c9
commit f24b5afd5c
11 changed files with 30 additions and 28 deletions
-3
View File
@@ -302,9 +302,6 @@ module.exports = {
// disallow use of comma operator
'no-sequences': 'error',
// restrict what can be breakn as an exception
'no-break-literal': 'error',
// disallow unmodified conditions of loops
// https://eslint.org/docs/rules/no-unmodified-loop-condition
'no-unmodified-loop-condition': 'off',
+1
View File
@@ -3,6 +3,7 @@ const preact = require('preact');
const { Elements, injectStripe } = require('react-stripe-elements');
const { saw } = require('./shapes');
const { postData } = require('./../utils');
function pingColour(ping) {
if (ping < 100) return 'forestgreen';
+1 -3
View File
@@ -21,8 +21,6 @@ function Main(props) {
instance,
account,
nav,
team,
constructs,
} = props;
if (!account) {
@@ -37,7 +35,7 @@ function Main(props) {
return <Instance />;
}
if (nav === 'team' || !team.some(t => t) || constructs.length < 3) return <Team />;
if (nav === 'team') return <Team />;
if (nav === 'list') return <List />;
return (
+1 -6
View File
@@ -3,6 +3,7 @@ const preact = require('preact');
const { Fragment } = require('preact');
const { postData } = require('../utils');
console.log(postData);
const actions = require('../actions');
const AccountStatus = require('./account.status');
@@ -33,10 +34,6 @@ const addState = connect(
return ws.sendInstanceList();
}
function logout() {
postData('/logout').then(() => window.location.reload(true));
}
return {
account,
instances,
@@ -46,7 +43,6 @@ const addState = connect(
sendInstanceState,
sendAccountInstances,
sendInstanceList,
logout,
};
},
function receiveDispatch(dispatch) {
@@ -142,7 +138,6 @@ function Nav(args) {
<h1 class="header-title">mnml.gg</h1>
<AccountStatus />
<hr />
<button onClick={() => navTo('team')}>Select Team</button>
<button disabled={canJoin} onClick={() => navTo('list')}>Play</button>
<hr />
{joined}
+6 -1
View File
@@ -33,7 +33,12 @@ function registerEvents(store) {
// check team is in list
const { team } = store.getState();
const ids = constructs.map(c => c.id);
if (!team.every(t => t && ids.includes(t))) store.dispatch(actions.setTeam([null, null, null]));
// team is fucked up, or just registered
// reset to the first 3 constructs
if (!team.every(t => t && ids.includes(t))) {
store.dispatch(actions.setTeam([ids[0], ids[1], ids[2]]));
}
store.dispatch(actions.setConstructs(constructs));
}
+1 -3
View File
@@ -221,9 +221,7 @@ function createSocket(events) {
};
function logout() {
localStorage.removeItem('account');
account = null;
event.setAccount(null);
window.location.reload(true);
}
function errHandler(error) {