diff --git a/client/src/App/App.js b/client/src/App/App.js
index 7b1a72c34..8d756fb93 100644
--- a/client/src/App/App.js
+++ b/client/src/App/App.js
@@ -1,19 +1,20 @@
import React from "react";
import { ApolloProvider } from "react-apollo";
-import { gql } from "apollo-boost";
import { HttpLink } from "apollo-link-http";
-import { getMainDefinition } from "apollo-utilities";
import ApolloClient from "apollo-client";
import { InMemoryCache } from "apollo-cache-inmemory";
//Styling imports
import "./App.css";
-import HeaderAppBar from "../components/header-app-bar/header-app-bar.component";
+import HeaderAppBarContainer from "../components/header-app-bar/header-app-bar.container";
import SignIn from "../components/sign-in/sign-in.component";
import initialState from "../graphql/initial-state";
-const graphqlEndpoint = process.env.REACT_APP_GRAPHQL_ENDPOINT || "https://bodyshop-dev-db.herokuapp.com/v1/graphql";
+//Todo: Issue with this line. Not sure why.
+const graphqlEndpoint =
+ process.env.REACT_APP_GRAPHQL_ENDPOINT ||
+ "https://bodyshop-dev-db.herokuapp.com/v1/graphql";
export default function App({ authState }) {
console.log("graphqlEndpoint", graphqlEndpoint);
@@ -36,10 +37,10 @@ export default function App({ authState }) {
data: initialState
});
- console.log(client)
+ console.log(client);
return (
-
+
);
diff --git a/client/src/components/header-app-bar/header-app-bar.component.jsx b/client/src/components/header-app-bar/header-app-bar.component.jsx
index f1e2b542b..0abc8adde 100644
--- a/client/src/components/header-app-bar/header-app-bar.component.jsx
+++ b/client/src/components/header-app-bar/header-app-bar.component.jsx
@@ -3,10 +3,6 @@ import { Menu, Icon } from "antd";
const { SubMenu } = Menu;
class HeaderAppBar extends Component {
- state = {
- current: "alipay"
- };
-
handleClick = e => {
console.log("click ", e);
this.setState({
@@ -15,47 +11,53 @@ class HeaderAppBar extends Component {
};
render() {
+ const { selectedNavItem, navItems } = this.props;
return (
+
+ //
+ //
+ // Navigation One
+ //
+ //
+ //
+ // Navigation Two
+ //
+ //
+ //
+ // Navigation Three - Submenu
+ //
+ // }
+ // >
+ //
+ // Option 1
+ // Option 2
+ //
+ //
+ // Option 3
+ // Option 4
+ //
+ //
+ //
+ //
+ // Navigation Four - Link
+ //
+ //
+ //
);
}
}
diff --git a/client/src/components/header-app-bar/header-app-bar.container.jsx b/client/src/components/header-app-bar/header-app-bar.container.jsx
new file mode 100644
index 000000000..19a5e564f
--- /dev/null
+++ b/client/src/components/header-app-bar/header-app-bar.container.jsx
@@ -0,0 +1,44 @@
+import React from "react";
+import { Query } from "react-apollo";
+import { gql } from "apollo-boost";
+
+import { Spin, Alert } from "antd";
+
+import HeaderAppBar from "./header-app-bar.component";
+
+const GET_NAV_ITEMS = gql`
+ query nav_items {
+ masterdata_by_pk(key: "NAV_ITEMS") {
+ value
+ }
+ }
+`;
+
+const GET_SELECTED_NAV_ITEM = gql`
+ query selected_nav_item {
+ selectedNavItem @client
+ }
+`;
+
+const HeaderAppBarContainer = () => (
+
+ {({ loading, error, data: { selectedNavItem } }) => {
+ console.log("Selected Nav item", selectedNavItem);
+ return (
+
+ {({ loading, error, data }) => {
+ if (loading) return ;
+ return (
+
+ );
+ }}
+
+ );
+ }}
+
+);
+
+export default HeaderAppBarContainer;
diff --git a/client/src/graphql/initial-state.js b/client/src/graphql/initial-state.js
index bffd7394f..3048f3ca2 100644
--- a/client/src/graphql/initial-state.js
+++ b/client/src/graphql/initial-state.js
@@ -1,3 +1,3 @@
export default {
- currentSelectedNavItem: "wat",
+ selectedNavItem: "Home",
};
diff --git a/client/src/index.js b/client/src/index.js
index 05c3bb41d..459f19bc1 100644
--- a/client/src/index.js
+++ b/client/src/index.js
@@ -2,13 +2,6 @@ import React from "react";
import ReactDOM from "react-dom";
import { BrowserRouter } from "react-router-dom";
-import { ApolloProvider } from "react-apollo";
-import { createHttpLink } from "apollo-link-http";
-import { InMemoryCache } from "apollo-cache-inmemory";
-import { ApolloClient } from "apollo-boost";
-import { typeDefs, resolvers } from "./graphql/resolvers";
-import initialState from "./graphql/initial-state";
-
import * as serviceWorker from "./serviceWorker";
import "./index.css";
@@ -16,27 +9,10 @@ import { default as App } from "./App/App.container";
require("dotenv").config();
-const httpLink = createHttpLink({
- uri: "https://bodyshop-dev-db.herokuapp.com/v1/graphql"
-});
-
-const client = new ApolloClient({
- link: httpLink,
- cache: new InMemoryCache(),
- typeDefs,
- resolvers
-});
-
-client.writeData({
- data: initialState
-});
-
ReactDOM.render(
-
-
-
-
- ,
+
+
+ ,
document.getElementById("root")
);