From 611730c289d9c7d99515ed787ade98184a6f3c7a Mon Sep 17 00:00:00 2001 From: Andrew Nicolaou Date: Wed, 11 Sep 2019 19:06:30 +0200 Subject: [PATCH] Refactor Nav --- client/components/Nav.jsx | 757 ++++++++++++++++++++------------------ 1 file changed, 393 insertions(+), 364 deletions(-) diff --git a/client/components/Nav.jsx b/client/components/Nav.jsx index 31b7e5b8..4fc0ea61 100644 --- a/client/components/Nav.jsx +++ b/client/components/Nav.jsx @@ -217,6 +217,396 @@ class Nav extends React.PureComponent { this.timer = setTimeout(this.setDropdown.bind(this, 'none'), 10); } + 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; + } + render() { const navDropdownState = { file: classNames({ @@ -240,372 +630,11 @@ class Nav extends React.PureComponent { 'nav__item--open': this.state.dropdownOpen === 'account' }) }; + return (