diff --git a/client/src/components/nav.jsx b/client/src/components/nav.jsx new file mode 100644 index 00000000..afe5821f --- /dev/null +++ b/client/src/components/nav.jsx @@ -0,0 +1,45 @@ +const { connect } = require('preact-redux'); +const preact = require('preact'); +const actions = require('../actions'); + +const addState = connect( + function receiveState(state) { + const { + ws, + instances, + cryps, + } = state; + + function sendInstanceState(instance) { + return ws.sendInstanceState(instance.id); + } + + return { + instances, + sendInstanceState, + }; + }, +); + +function Nav(args) { + const { + sendInstanceState, + instances, + } = args; + + const joined = instances.map((i, j) => ( + + )); + + return ( + + ); +} + +module.exports = addState(Nav); diff --git a/client/src/main.jsx b/client/src/main.jsx index e50b4d74..56c37077 100644 --- a/client/src/main.jsx +++ b/client/src/main.jsx @@ -12,6 +12,7 @@ const registerEvents = require('./events'); const Header = require('./components/header.container'); const Body = require('./components/body.component'); +const Nav = require('./components/nav'); // Redux Store const createStoreWithMiddleware = applyMiddleware(logger)(createStore); @@ -53,19 +54,7 @@ document.fonts.load('16pt "Jura"').then(() => { const Cryps = () => (
- +
); diff --git a/client/src/reducers.jsx b/client/src/reducers.jsx index bd0fd4ad..89c28721 100644 --- a/client/src/reducers.jsx +++ b/client/src/reducers.jsx @@ -80,7 +80,7 @@ function crypsReducer(state = defaultCryps, action) { } } -const defaultInstances = null; +const defaultInstances = []; function instancesReducer(state = defaultInstances, action) { switch (action.type) { case actions.SET_INSTANCES: diff --git a/client/src/socket.jsx b/client/src/socket.jsx index 46c361cd..a490a28c 100644 --- a/client/src/socket.jsx +++ b/client/src/socket.jsx @@ -312,7 +312,7 @@ function createSocket(events) { sendAccountInstances(); sendAccountCryps(); // console.log(testGame); - events.setGame(testGame(account.id)); + // events.setGame(testGame(account.id)); clearGameStateTimeout(); } diff --git a/client/styles.css b/client/styles.css index c07f9b38..4c0dfecf 100644 --- a/client/styles.css +++ b/client/styles.css @@ -65,6 +65,10 @@ nav { margin-right: 2em; } +nav hr { + margin: 2em 0; +} + nav button { display: block; color: #888; @@ -98,7 +102,7 @@ tr.right:focus, tr.right:hover { } tr { - transition-property: all; + transition-property: background, color; transition-duration: 0.5s; transition-delay: 0; transition-timing-function: ease;