diff --git a/src/actions/roomActions.js b/src/actions/roomActions.js new file mode 100644 index 0000000..ee9a2d6 --- /dev/null +++ b/src/actions/roomActions.js @@ -0,0 +1,8 @@ +import { ROOM_SELECT } from "../constants/ActionTypes"; + +export default { + select: (room_name) => ({ + type: ROOM_SELECT, + payload: room_name + }) +}; diff --git a/src/components/Footer.js b/src/components/Footer.js new file mode 100644 index 0000000..65a431b --- /dev/null +++ b/src/components/Footer.js @@ -0,0 +1,21 @@ +import React, { PropTypes } from "react"; + +import SocketStatusPane from "./SocketStatusPane"; + +import LoginStatusPane from "../containers/LoginStatusPane"; + +const Footer = ({ socket, socketActions }) => { + return ( + + ); +}; + +Footer.propTypes = { + socket: PropTypes.object.isRequired, + socketActions: PropTypes.object.isRequired +}; + +export default Footer; diff --git a/src/components/Header.js b/src/components/Header.js index 10e2f51..b09de8e 100644 --- a/src/components/Header.js +++ b/src/components/Header.js @@ -2,9 +2,9 @@ import React, { PropTypes } from "react"; const Header = (props) => { return ( - + ); }; diff --git a/src/components/Room.js b/src/components/Room.js index 3277c6e..a3571b2 100644 --- a/src/components/Room.js +++ b/src/components/Room.js @@ -1,11 +1,16 @@ import React, { PropTypes } from "react"; -const Room = ({ name }) => { - return
{name}
; +const Room = ({ name, onClick }) => { + return ( + + {name} + + ); }; Room.propTypes = { - name: PropTypes.string.isRequired + name: PropTypes.string.isRequired, + onClick: PropTypes.func.isRequired }; export default Room; diff --git a/src/components/RoomList.js b/src/components/RoomList.js index 0cf8eb9..c9551b4 100644 --- a/src/components/RoomList.js +++ b/src/components/RoomList.js @@ -1,26 +1,35 @@ import React, { PropTypes } from "react"; import Room from "./Room"; +import RoomListHeader from "./RoomListHeader"; -const RoomList = ({ rooms }) => { +const RoomList = ({ refresh, rooms, roomActions }) => { const children = []; + for (const [room_name, room_data] of rooms) { + const onClick = (event) => { + roomActions.select(room_name); + }; + children.push(
  • - +
  • ); } + return (
    -
    Room List
    +
    ); }; RoomList.propTypes = { - rooms: PropTypes.object.isRequired + refresh: PropTypes.func.isRequired, + rooms: PropTypes.object.isRequired, + roomActions: PropTypes.object.isRequired }; export default RoomList; diff --git a/src/components/RoomListHeader.js b/src/components/RoomListHeader.js new file mode 100644 index 0000000..fc00749 --- /dev/null +++ b/src/components/RoomListHeader.js @@ -0,0 +1,20 @@ +import React, { PropTypes } from "react"; + +const RoomListHeader = ({ refresh }) => { + return ( +
    +
    +

    Room List

    +
    +
    + +
    +
    + ); +}; + +RoomListHeader.propTypes = { + refresh: PropTypes.func.isRequired +}; + +export default RoomListHeader; diff --git a/src/components/SocketStatusPane.js b/src/components/SocketStatusPane.js index 105a52e..1af38d6 100644 --- a/src/components/SocketStatusPane.js +++ b/src/components/SocketStatusPane.js @@ -21,7 +21,7 @@ const SocketStatusPane = (props) => { string = `disconnected`; break; } - return
    Connection status: {string}
    ; + return
    Connection status: {string}
    ; }; SocketStatusPane.propTypes = { diff --git a/src/components/SolsticeApp.js b/src/components/SolsticeApp.js index aa7ec9d..0ac246b 100644 --- a/src/components/SolsticeApp.js +++ b/src/components/SolsticeApp.js @@ -1,8 +1,9 @@ import React, {PropTypes} from "react"; -import ConnectForm from "../components/ConnectForm"; -import Header from "../components/Header"; -import SocketStatusPane from "../components/SocketStatusPane"; +import ConnectForm from "./ConnectForm"; +import Header from "./Header"; +import Footer from "./Footer"; +import SocketStatusPane from "./SocketStatusPane"; import LoginStatusPane from "../containers/LoginStatusPane"; import RoomsPane from "../containers/RoomsPane"; @@ -21,12 +22,13 @@ const SolsticeApp = (props) => { ); } return ( -
    +
    - - - -
    +
    + +
    +