diff --git a/client/components/Nav.jsx b/client/components/Nav.jsx index 253146b0..d47f8eb4 100644 --- a/client/components/Nav.jsx +++ b/client/components/Nav.jsx @@ -11,6 +11,7 @@ import { setAllAccessibleOutput } from '../modules/IDE/actions/preferences'; import { logoutUser } from '../modules/User/actions'; import { metaKeyName, } from '../utils/metaKey'; +import caretLeft from '../images/left-arrow.svg'; const triangleUrl = require('../images/down-filled-triangle.svg'); const logoUrl = require('../images/p5js-logo-small.svg'); @@ -217,6 +218,424 @@ class Nav extends React.PureComponent { this.timer = setTimeout(this.setDropdown.bind(this, 'none'), 10); } + renderDashboardMenu(navDropdownState) { + return ( + + ); + } + + renderProjectMenu(navDropdownState) { + return ( + + ); + } + + renderUnauthenticatedUserMenu(navDropdownState) { + return ( + + ); + } + + renderAuthenticatedUserMenu(navDropdownState) { + return ( + + ); + } + + renderUserMenu(navDropdownState) { + const isLoginEnabled = __process.env.LOGIN_ENABLED; + const isAuthenticated = this.props.user.authenticated; + + if (isLoginEnabled && isAuthenticated) { + return this.renderAuthenticatedUserMenu(navDropdownState); + } else if (isLoginEnabled && !isAuthenticated) { + return this.renderUnauthenticatedUserMenu(navDropdownState); + } + + return null; + } + + renderLeftLayout(navDropdownState) { + switch (this.props.layout) { + case 'dashboard': + return this.renderDashboardMenu(navDropdownState); + case 'project': + default: + return this.renderProjectMenu(navDropdownState); + } + } + render() { const navDropdownState = { file: classNames({ @@ -240,372 +659,11 @@ class Nav extends React.PureComponent { 'nav__item--open': this.state.dropdownOpen === 'account' }) }; + return (