summaryrefslogtreecommitdiff
path: root/src/components/navigation
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-08-28 09:02:38 +0200
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-23 10:05:46 +0200
commitf2de68252a5af08ba73213ae4ea545912ef04690 (patch)
tree7836560375942765bbf983be2aca133eb6002c11 /src/components/navigation
parent7aea29d0b22f7e5932c9b147611fe02373bb9645 (diff)
Complete homepage transfer
Diffstat (limited to 'src/components/navigation')
-rw-r--r--src/components/navigation/Navbar.js46
1 files changed, 29 insertions, 17 deletions
diff --git a/src/components/navigation/Navbar.js b/src/components/navigation/Navbar.js
index c0c8c006..e621b1e4 100644
--- a/src/components/navigation/Navbar.js
+++ b/src/components/navigation/Navbar.js
@@ -8,6 +8,7 @@ import ProfileName from "../../containers/auth/ProfileName";
import "./Navbar.css";
export const NavItem = withRouter(props => <NavItemWithoutRoute {...props}/>);
+export const LoggedInSection = withRouter(props => <LoggedInSectionWithoutRoute {...props}/>);
const NavItemWithoutRoute = ({route, location, children}) => (
<li className={classNames("nav-item", location.pathname === route ? "active" : undefined)}>
@@ -15,6 +16,33 @@ const NavItemWithoutRoute = ({route, location, children}) => (
</li>
);
+const LoggedInSectionWithoutRoute = ({location}) => (
+ <ul className="navbar-nav auth-links">
+ {userIsLoggedIn() ?
+ [
+ location.pathname === "/" ?
+ <NavItem route="/simulations" key="simulations">
+ <Link className="nav-link" title="My Simulations" to="/simulations">
+ My Simulations
+ </Link>
+ </NavItem> :
+ <NavItem route="/profile" key="profile">
+ <Link className="nav-link" title="My Profile" to="/profile">
+ <ProfileName/>
+ </Link>
+ </NavItem>,
+ <NavItem route="logout" key="logout">
+ <Logout/>
+ </NavItem>
+ ] :
+ <NavItem route="login">
+ <Login visible={true}/>
+ </NavItem>
+ }
+ </ul>
+ )
+;
+
const Navbar = ({children}) => (
<nav className="navbar fixed-top navbar-expand-lg navbar-light bg-faded" id="navbar">
<div className="container">
@@ -31,23 +59,7 @@ const Navbar = ({children}) => (
<ul className="navbar-nav mr-auto">
{children}
</ul>
- <ul className="navbar-nav">
- {userIsLoggedIn() ?
- [
- <NavItem route="/profile">
- <Link className="username nav-link" title="My Profile" to="/profile">
- <ProfileName/>
- </Link>
- </NavItem>,
- <NavItem route="logout">
- <Logout/>
- </NavItem>
- ] :
- <NavItem route="login">
- <Login visible={true}/>
- </NavItem>
- }
- </ul>
+ <LoggedInSection/>
</div>
</div>
</nav>