Using sqlite database, mt proctor animation.

This commit is contained in:
2020-04-09 22:52:44 -07:00
parent b34a66f697
commit 6ff6387fef
31 changed files with 1525 additions and 280 deletions

View File

@@ -28,7 +28,8 @@ import { rootId } from './constants.js'
import App from './components/app/App.jsx'
import { initialize, handleMessage as handleMessageFarm } from './components/farm/interface.js'
import { setStartGames, startOrJoinGame } from './components/start/actions.js'
import { setStartGames, startOrJoinGame, setUser, setOpenGames,
setErrors } from './components/start/actions.js'
import { play } from './components/app/actions.js'
import { createStore } from 'redux'
import rootReducer from './rootReducers.js'
@@ -46,9 +47,24 @@ document.body.appendChild(makeDiv(rootId));
window.store = store;
const createAccount = (msg) => {
Ws.sendCommand({ type: 'create-account', ...msg});
}
const login = (msg) => {
Ws.sendCommand({ type: 'login', ...msg});
}
const logout = () => {
Ws.sendCommand({ type: 'logout'});
}
ReactDOM.render(
<Provider store={store}>
<App />
<App createAccount={createAccount}
login={login}
logout={logout}
/>
</Provider>,
document.getElementById(rootId)
);
@@ -78,6 +94,9 @@ function handleMessage(evt) {
store.dispatch(play());
} else if (data.event === 'start-init') {
store.dispatch(setStartGames(data.games.games));
store.dispatch(setOpenGames(data.openGames.games));
store.dispatch(setUser(data.user));
store.dispatch(setErrors(data.errors));
if (autostart) {
if (data.games.games.length === 0) {
store.dispatch(startOrJoinGame({ type: 'new-game',