From 65cd317b954d3e50ad0dc66289c55e586f8a4d66 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 9 Dec 2019 22:04:42 -0800 Subject: [PATCH] Added querying to sidebar. Fixed initial state. --- client/src/App/App.container.jsx | 2 +- .../white-board-left-sider.component.jsx | 24 +++++++++++++++++++ .../white-board-left-sider.container.jsx | 18 ++++++++++++++ client/src/graphql/initial-state.js | 6 +---- .../white-board.page.container.jsx | 14 +---------- .../pages/white-board/white-board.page.jsx | 21 ++-------------- 6 files changed, 47 insertions(+), 38 deletions(-) create mode 100644 client/src/components/white-board-left-sider/white-board-left-sider.component.jsx create mode 100644 client/src/components/white-board-left-sider/white-board-left-sider.container.jsx diff --git a/client/src/App/App.container.jsx b/client/src/App/App.container.jsx index 1b240e876..752978b44 100644 --- a/client/src/App/App.container.jsx +++ b/client/src/App/App.container.jsx @@ -86,7 +86,7 @@ class AppContainer extends Component { const { client, loaded } = this.state; if (!loaded) { - return
Loading...
; + return ; } return ( diff --git a/client/src/components/white-board-left-sider/white-board-left-sider.component.jsx b/client/src/components/white-board-left-sider/white-board-left-sider.component.jsx new file mode 100644 index 000000000..a46ea91b8 --- /dev/null +++ b/client/src/components/white-board-left-sider/white-board-left-sider.component.jsx @@ -0,0 +1,24 @@ +import React from "react"; +import { Menu, Icon } from "antd"; +export default function WhiteBoardLeftSiderComponent({visible}) { + return ( + + + + nav 1 + + + + nav 2 + + + + nav 3 + + + + nav 4 + + + ); +} diff --git a/client/src/components/white-board-left-sider/white-board-left-sider.container.jsx b/client/src/components/white-board-left-sider/white-board-left-sider.container.jsx new file mode 100644 index 000000000..dc3c0ec96 --- /dev/null +++ b/client/src/components/white-board-left-sider/white-board-left-sider.container.jsx @@ -0,0 +1,18 @@ +import React from "react"; +import { Query, Mutation } from "react-apollo"; + +import WhiteBoardLeftSiderComponent from './white-board-left-sider.component' +import Spin from "../loading-spinner/loading-spinner.component"; +import { GET_WHITE_BOARD_LEFT_SIDER_VISIBLE } from "../../graphql/local.queries"; + +export default function WhiteBoardPageContainer() { + return ( + + {({ loading, error, data: { whiteBoardLeftSiderVisible} }) => { + if (loading) return ; + if (error) return error.message; + return ; + }} + + ); +} diff --git a/client/src/graphql/initial-state.js b/client/src/graphql/initial-state.js index cfdeeaa64..11b75d57c 100644 --- a/client/src/graphql/initial-state.js +++ b/client/src/graphql/initial-state.js @@ -1,9 +1,5 @@ export default { - currentUser: { - email: null, - displayName: null, - token: null - }, + currentUser: { email: null, displayName: null }, selectedNavItem: "Home", recentItems: [], whiteBoardLeftSiderVisible: true diff --git a/client/src/pages/white-board/white-board.page.container.jsx b/client/src/pages/white-board/white-board.page.container.jsx index 389c601f9..e2c5f4382 100644 --- a/client/src/pages/white-board/white-board.page.container.jsx +++ b/client/src/pages/white-board/white-board.page.container.jsx @@ -1,19 +1,7 @@ import React from "react"; -import { Query, Mutation } from "react-apollo"; import WhiteBoardPage from "./white-board.page"; -import Spin from "../../components/loading-spinner/loading-spinner.component"; -import { GET_WHITE_BOARD_LEFT_SIDER_VISIBLE } from "../../graphql/local.queries"; export default function WhiteBoardPageContainer() { - return ( - - {({ loading, error, data }) => { - if (loading) return ; - if (error) return error.message; - console.log('data from getwhiteboardquery', data) - return ; - }} - - ); + return ; } diff --git a/client/src/pages/white-board/white-board.page.jsx b/client/src/pages/white-board/white-board.page.jsx index af018c2f0..9f6426bda 100644 --- a/client/src/pages/white-board/white-board.page.jsx +++ b/client/src/pages/white-board/white-board.page.jsx @@ -1,6 +1,7 @@ import React from "react"; import Board from "react-trello"; import WhiteBoardCard from "../../components/white-board-card/white-board-card.component"; +import WhiteBoardLeftSiderContainer from "../../components/white-board-left-sider/white-board-left-sider.container"; import { Layout, Icon, Menu } from "antd"; export default function WhiteBoardPage({ whiteBoardLeftSiderVisible }) { @@ -48,25 +49,7 @@ export default function WhiteBoardPage({ whiteBoardLeftSiderVisible }) { //console.log(collapsed, type); }} > -
- - - - nav 1 - - - - nav 2 - - - - nav 3 - - - - nav 4 - - +