diff --git a/client/assets/styles/player.less b/client/assets/styles/player.less
index 03465f16..4eb448d9 100644
--- a/client/assets/styles/player.less
+++ b/client/assets/styles/player.less
@@ -45,5 +45,9 @@
grid-area: msg;
color: @white;
}
-
}
+
+.chat {
+ justify-content: flex-end;
+}
+
diff --git a/client/src/actions.jsx b/client/src/actions.jsx
index 85b113de..f43d8a6c 100644
--- a/client/src/actions.jsx
+++ b/client/src/actions.jsx
@@ -11,6 +11,7 @@ export const setAnimText = value => ({ type: 'SET_ANIM_TEXT', value });
export const setDemo = value => ({ type: 'SET_DEMO', value });
+export const setChatShow = value => ({ type: 'SET_CHAT_SHOW', value });
export const setActiveItem = value => ({ type: 'SET_ACTIVE_VAR', value });
export const setActiveSkill = (constructId, skill) => ({ type: 'SET_ACTIVE_SKILL', value: constructId ? { constructId, skill } : null });
export const setCombiner = value => ({ type: 'SET_COMBINER', value: Array.from(value) });
diff --git a/client/src/components/chat.jsx b/client/src/components/chat.jsx
new file mode 100644
index 00000000..05292096
--- /dev/null
+++ b/client/src/components/chat.jsx
@@ -0,0 +1,70 @@
+const preact = require('preact');
+const { connect } = require('preact-redux');
+
+const actions = require('../actions');
+
+const addState = connect(
+ function receiveState(state) {
+ const {
+ ws,
+ chatShow,
+ instance,
+ } = state;
+
+ function sendChat(i) {
+ // return ws.sendChat(i);
+ }
+
+ return {
+ instance,
+ chatShow,
+
+ sendChat,
+ };
+ },
+
+ function receiveDispatch(dispatch) {
+ function setChatShow(v) {
+ dispatch(actions.setChatShow(v));
+ }
+
+ return {
+ setChatShow,
+ };
+ }
+);
+
+function Chat(args) {
+ const {
+ instance,
+ chatShow,
+
+ sendChat,
+ setChatShow,
+ } = args;
+
+ const chat = [
+ 'gl',
+ 'hf',
+ 'gg',
+ 'thx',
+ 'nice',
+ 'hmm',
+ 'ok',
+ '...',
+ ];
+
+ function onClick(i) {
+ sendChat(i);
+ setChatShow(false);
+ return true;
+ }
+
+ return (
+
+ {chat.map((c, i) => )}
+
+ );
+}
+
+module.exports = addState(Chat);
diff --git a/client/src/components/instance.ctrl.btns.jsx b/client/src/components/instance.ctrl.btns.jsx
index f1ca2be5..443bc03d 100644
--- a/client/src/components/instance.ctrl.btns.jsx
+++ b/client/src/components/instance.ctrl.btns.jsx
@@ -7,6 +7,7 @@ const addState = connect(
function receiveState(state) {
const {
ws,
+ chatShow,
instance,
} = state;
@@ -21,19 +22,32 @@ const addState = connect(
return {
instance,
+ chatShow,
sendAbandon,
sendReady,
};
},
+
+ function receiveDispatch(dispatch) {
+ function setChatShow(v) {
+ dispatch(actions.setChatShow(v));
+ }
+
+ return {
+ setChatShow,
+ };
+ }
);
function InstanceCtrlBtns(args) {
const {
instance,
+ chatShow,
sendAbandon,
sendReady,
+ setChatShow,
} = args;
const finished = instance && instance.phase === 'Finished';
@@ -49,7 +63,7 @@ function InstanceCtrlBtns(args) {
return (
-
+
);
diff --git a/client/src/components/instance.ctrl.jsx b/client/src/components/instance.ctrl.jsx
index aa4e2670..5d8b30ba 100644
--- a/client/src/components/instance.ctrl.jsx
+++ b/client/src/components/instance.ctrl.jsx
@@ -1,20 +1,24 @@
const preact = require('preact');
const { connect } = require('preact-redux');
-const actions = require('../actions');
const PlayerBox = require('./player.box');
+const Chat = require('./chat');
const InstanceCtrlBtns = require('./instance.ctrl.btns');
const InstanceCtrlTopBtns = require('./instance.ctrl.top.btns');
+const actions = require('../actions');
+
const addState = connect(
function receiveState(state) {
const {
ws,
instance,
account,
+ chatShow,
} = state;
return {
+ chatShow,
instance,
account,
};
@@ -25,6 +29,7 @@ function Controls(args) {
const {
account,
instance,
+ chatShow,
} = args;
if (!instance) return false;
@@ -58,13 +63,17 @@ function Controls(args) {
);
+ const bottom = chatShow
+ ?
+ : ;
+
return (
diff --git a/client/src/reducers.jsx b/client/src/reducers.jsx
index 9268918d..c24519e3 100644
--- a/client/src/reducers.jsx
+++ b/client/src/reducers.jsx
@@ -24,6 +24,7 @@ module.exports = {
demo: createReducer(null, 'SET_DEMO'),
+ chatShow: createReducer(null, 'SET_CHAT_SHOW'),
combiner: createReducer([], 'SET_COMBINER'),
constructs: createReducer([], 'SET_CONSTRUCTS'),
constructEditId: createReducer(null, 'SET_CONSTRUCT_EDIT_ID'),