diff --git a/client/src/components/AdminView/AdminBody.js b/client/src/components/AdminView/AdminBody.js index e6bb4ae..1f694b9 100644 --- a/client/src/components/AdminView/AdminBody.js +++ b/client/src/components/AdminView/AdminBody.js @@ -1,4 +1,5 @@ import React from "react"; +import { Switch, Route } from "react-router-dom"; import ClassIterationsSection from "./ClassIterationsSection/ClassIterationsSection"; import StudentsSection from "./StudentsSection/StudentsSection"; import GradesSection from "./GradesSection/GradesSection"; @@ -10,30 +11,30 @@ class AdminBody extends React.Component { render() { return
{this.renderContent()}
; } + renderContent() { - switch (this.props.activeTab) { - case "iteration": - return ; - case "students": - return ( + return ( + + + + + - ); - case "grade": - return ( + + - ); - case "settings": - return ; - default: - console.log("should never get here"); - return; - } + + + + + + ); } } diff --git a/client/src/components/AdminView/AdminSideBar.css b/client/src/components/AdminView/AdminSideBar.css index 3c03971..4471270 100644 --- a/client/src/components/AdminView/AdminSideBar.css +++ b/client/src/components/AdminView/AdminSideBar.css @@ -20,6 +20,8 @@ .adminSidebar-iconContainer { flex-direction: column; + color: var(--dark-grey); + text-decoration: none; width: 100%; height: var(--adminSidebar-iconHeight); } diff --git a/client/src/components/AdminView/AdminSideBar.js b/client/src/components/AdminView/AdminSideBar.js index b7da01d..8cb2b8a 100644 --- a/client/src/components/AdminView/AdminSideBar.js +++ b/client/src/components/AdminView/AdminSideBar.js @@ -1,64 +1,59 @@ import React from "react"; +import { Link, withRouter } from "react-router-dom"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import "./AdminSideBar.css"; class AdminTabButton extends React.Component { render() { - const { activeTab, tabName, tabLabel, icon, onClick, showingMilestones } = this.props; - const active = !showingMilestones && activeTab === tabName; + const { activeTab, to, tabLabel, icon, showingMilestones } = this.props; + const active = !showingMilestones && activeTab === to; return ( -
{ - onClick(tabName); - }} > {tabLabel} -
+ ); } } class AdminSideBar extends React.Component { render() { - const { activeTab, year, setActiveTab, showingMilestones } = this.props; + const { year, showingMilestones } = this.props; return (
@@ -66,4 +61,6 @@ class AdminSideBar extends React.Component { } } -export default AdminSideBar; +const AdminSideBarWithRouter = withRouter((props) => ); + +export default AdminSideBarWithRouter; diff --git a/client/src/components/AdminView/AdminView.js b/client/src/components/AdminView/AdminView.js index 61a1ce2..898edfe 100644 --- a/client/src/components/AdminView/AdminView.js +++ b/client/src/components/AdminView/AdminView.js @@ -1,21 +1,16 @@ import React from "react"; -import AdminSideBar from "./AdminSideBar"; +import AdminSideBarWithRouter from "./AdminSideBar"; import AdminBody from "./AdminBody"; class AdminView extends React.Component { constructor(props) { super(props); this.state = { - activeTab: "iteration", viewedYear: 2019, showingMilestones: false, }; } - setActiveTab = (tab) => { - this.setState({ activeTab: tab, showingMilestones: false }); - }; - setViewedYear = (year) => { this.setState({ viewedYear: year }); }; @@ -27,14 +22,11 @@ class AdminView extends React.Component { render() { return (
- - + ); diff --git a/webpack.config.js b/webpack.config.js index 9a470af..7d2affe 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -59,6 +59,9 @@ module.exports = { "/team": "http://localhost:3000", "/create-team": "http://localhost:3000", "/join-team": "http://localhost:3000", + "/students": "http://localhost:3000", + "/grade": "http://localhost:3000", + "/settings": "http://localhost:3000", "/socket.io/*": { target: "http://localhost:3000", ws: true,