diff --git a/packages/server/play-node-go/src/components/Button/Game/Game.js b/packages/server/play-node-go/src/components/Button/Game/Game.js
new file mode 100644
index 0000000..00df7a3
--- /dev/null
+++ b/packages/server/play-node-go/src/components/Button/Game/Game.js
@@ -0,0 +1,16 @@
+import React from 'react';
+import { Link } from 'react-router-dom';
+import './Game.scss';
+
+const GameButton = (props) => {
+ const gameData = props.game;
+ return (
+
+
View Game
+
{gameData.playerBlack} - {gameData.playerBlackRank}
+
{gameData.playerWhite} - {gameData.playerWhiteRank}
+
+ );
+}
+
+export default GameButton;
\ No newline at end of file
diff --git a/packages/server/play-node-go/src/components/Button/Game/Game.scss b/packages/server/play-node-go/src/components/Button/Game/Game.scss
new file mode 100644
index 0000000..e69de29
diff --git a/packages/server/play-node-go/src/components/Button/Game/Game.test.js b/packages/server/play-node-go/src/components/Button/Game/Game.test.js
new file mode 100644
index 0000000..6d956c0
--- /dev/null
+++ b/packages/server/play-node-go/src/components/Button/Game/Game.test.js
@@ -0,0 +1,22 @@
+import React from 'react';
+import { render } from '@testing-library/react';
+import { BrowserRouter as Router } from 'react-router-dom';
+import Game from './Game';
+
+const gameData = {
+ id: 1,
+ name: "main",
+ description: "A general place to play Go",
+ language: "EN"
+}
+
+test('renders GameButton without crashing', () => {
+ const { getByTestId } = render(
+
+
+
+ );
+ const GameButton = getByTestId('GameButton');
+ expect(GameButton).toBeInTheDocument();
+});
+
diff --git a/packages/server/play-node-go/src/components/Display/Development/Development.js b/packages/server/play-node-go/src/components/Display/Development/Development.js
new file mode 100644
index 0000000..46dd204
--- /dev/null
+++ b/packages/server/play-node-go/src/components/Display/Development/Development.js
@@ -0,0 +1,9 @@
+import React from 'react';
+
+const Development = () => {
+ return (<>
+ This Feature is in Development :{')'}
+ >);
+}
+
+export default Development;
\ No newline at end of file
diff --git a/packages/server/play-node-go/src/components/Display/Message/Message.js b/packages/server/play-node-go/src/components/Display/Message/Message.js
new file mode 100644
index 0000000..ac3db16
--- /dev/null
+++ b/packages/server/play-node-go/src/components/Display/Message/Message.js
@@ -0,0 +1,15 @@
+import React from 'react';
+import './Message.scss';
+
+const Message = (props) => {
+ const messageData = props.message;
+ return (
+
+
{messageData.content}
+
{messageData.username}
+
{messageData.admin ? 'admin' : <>>}
+
+ );
+}
+
+export default Message;
\ No newline at end of file
diff --git a/packages/server/play-node-go/src/components/Display/Message/Message.scss b/packages/server/play-node-go/src/components/Display/Message/Message.scss
new file mode 100644
index 0000000..e69de29
diff --git a/packages/server/play-node-go/src/components/Display/Message/Message.test.js b/packages/server/play-node-go/src/components/Display/Message/Message.test.js
new file mode 100644
index 0000000..5d2423c
--- /dev/null
+++ b/packages/server/play-node-go/src/components/Display/Message/Message.test.js
@@ -0,0 +1,16 @@
+import React from 'react';
+import { render } from '@testing-library/react';
+import Message from './Message';
+
+const messageData = [
+ {
+ "content": "Hey! Welcome to the general room!", "username": "userOne", "admin": true
+ }
+];
+
+test('renders Message without crashing', () => {
+ const { getByTestId } = render( );
+ const messageDiv = getByTestId('Message');
+ expect(messageDiv).toBeInTheDocument();
+});
+
diff --git a/packages/server/play-node-go/src/pages/Game/Game.js b/packages/server/play-node-go/src/pages/Game/Game.js
index e4dbd4b..9198ba2 100644
--- a/packages/server/play-node-go/src/pages/Game/Game.js
+++ b/packages/server/play-node-go/src/pages/Game/Game.js
@@ -1,10 +1,13 @@
import React from 'react';
import './Game.scss';
+import Development from '../../components/Display/Development/Development';
+
const Game = () => {
return (
);
}
diff --git a/packages/server/play-node-go/src/pages/Room/Room.js b/packages/server/play-node-go/src/pages/Room/Room.js
index c6c0719..c8d8c3c 100644
--- a/packages/server/play-node-go/src/pages/Room/Room.js
+++ b/packages/server/play-node-go/src/pages/Room/Room.js
@@ -4,6 +4,10 @@ import './Room.scss';
import socketIOClient from 'socket.io-client';
import config from '../../config';
import roomsServices from '../../services/api/roomsServices';
+import GameButton from '../../components/Button/Game/Game';
+import Message from '../../components/Display/Message/Message';
+
+import Development from '../../components/Display/Development/Development';
const Room = (props) => {
const state = props.state;
@@ -45,9 +49,46 @@ const Room = (props) => {
// ! [end]
+ const renderGames = () => {
+ const games = state.games || [];
+ if (games.length) {
+ return games.map(gameData => (
+
+ ))
+ }
+ return Loading Games...
+ }
+
+ const renderMessages = () => {
+ const messages = state.messages || [];
+ if (messages.length) {
+ return messages.map((messageData, idx) => (
+
+ ))
+ }
+ return Loading Messages...
+ }
+
+
return (
-
+
{state.currentRoom ? state.currentRoom.name : 'Loading'}
+
+
+ {renderGames()}
+
+
+
+ {renderMessages()}
+
+
+
);
}
diff --git a/packages/server/play-node-go/src/pages/Room/Room.scss b/packages/server/play-node-go/src/pages/Room/Room.scss
index e69de29..9733dac 100644
--- a/packages/server/play-node-go/src/pages/Room/Room.scss
+++ b/packages/server/play-node-go/src/pages/Room/Room.scss
@@ -0,0 +1,28 @@
+div.Room {
+ display: flex;
+ flex-flow: column nowrap;
+ height: 100%;
+ width: 100%;
+ justify-content: stretch;
+ align-items: initial;
+
+ h2 {
+ justify-self:stretch;
+ align-self: flex-start;
+ width: 100%;
+ max-height: 5vh;
+
+ }
+
+ div.Room__game-container {
+ height: 100%;
+ justify-self: flex-start;
+ align-self: flex-start;
+ }
+
+ div.Room__message-container {
+ height: 100%;
+ justify-self: flex-end;
+ align-self: flex-end;
+ }
+}
\ No newline at end of file
diff --git a/packages/server/play-node-go/src/pages/Room/Room.test.js b/packages/server/play-node-go/src/pages/Room/Room.test.js
index bac7a49..9df0950 100644
--- a/packages/server/play-node-go/src/pages/Room/Room.test.js
+++ b/packages/server/play-node-go/src/pages/Room/Room.test.js
@@ -1,12 +1,14 @@
import React from 'react';
import { render } from '@testing-library/react';
import { BrowserRouter as Router } from 'react-router-dom';
+import { initState } from '../../reducers/init/stateReducer.init';
import Room from './Room';
+const state = initState();
test('renders Room without crashing', () => {
const { getByTestId } = render(
-
+
);
const RoomDiv = getByTestId('Room');
diff --git a/packages/server/play-node-go/src/services/api/roomsServices.js b/packages/server/play-node-go/src/services/api/roomsServices.js
index e5ad1aa..92ca915 100644
--- a/packages/server/play-node-go/src/services/api/roomsServices.js
+++ b/packages/server/play-node-go/src/services/api/roomsServices.js
@@ -25,6 +25,17 @@ const getRoomService = async (roomIndex) => {
)
.then(res => res.text())
.then(text => JSON.parse(text))
+ .then(obj => {
+ obj.games = obj.roomGames.map(game => {
+ delete Object.assign(game, {boardSize: game.board_size }).board_size;
+ delete Object.assign(game, {playerBlack: game.player_black }).player_black;
+ delete Object.assign(game, {playerBlackRank: game.player_black_rank }).player_black_rank;
+ delete Object.assign(game, {playerWhite: game.player_white }).player_white;
+ delete Object.assign(game, {playerWhiteRank: game.player_white_rank }).player_white_rank;
+ return game;
+ })
+ return obj;
+ })
.catch(err => err);
return response;