From 9f35b33dc7238f0d6748beafa79ca0af192b5ca6 Mon Sep 17 00:00:00 2001
From: Dessalines <tyhou13@gmx.com>
Date: Tue, 29 Oct 2019 20:35:39 -0700
Subject: Halfway done with email, not fully working yet.

---
 ui/src/components/navbar.tsx | 80 ++++++++++----------------------------------
 1 file changed, 17 insertions(+), 63 deletions(-)

(limited to 'ui/src/components/navbar.tsx')

diff --git a/ui/src/components/navbar.tsx b/ui/src/components/navbar.tsx
index 151559df..306dc74f 100644
--- a/ui/src/components/navbar.tsx
+++ b/ui/src/components/navbar.tsx
@@ -21,7 +21,6 @@ import { T } from 'inferno-i18next';
 interface NavbarState {
   isLoggedIn: boolean;
   expanded: boolean;
-  expandUserDropdown: boolean;
   replies: Array<Comment>;
   mentions: Array<Comment>;
   fetchCount: number;
@@ -39,14 +38,12 @@ export class Navbar extends Component<any, NavbarState> {
     replies: [],
     mentions: [],
     expanded: false,
-    expandUserDropdown: false,
     siteName: undefined,
   };
 
   constructor(props: any, context: any) {
     super(props, context);
     this.state = this.emptyState;
-    this.handleOverviewClick = this.handleOverviewClick.bind(this);
 
     this.keepFetchingUnreads();
 
@@ -137,50 +134,25 @@ export class Navbar extends Component<any, NavbarState> {
           <ul class="navbar-nav ml-auto mr-2">
             {this.state.isLoggedIn ? (
               <>
-                {
-                  <li className="nav-item">
-                    <Link class="nav-link" to="/inbox">
-                      <svg class="icon">
-                        <use xlinkHref="#icon-mail"></use>
-                      </svg>
-                      {this.state.unreadCount > 0 && (
-                        <span class="ml-1 badge badge-light">
-                          {this.state.unreadCount}
-                        </span>
-                      )}
-                    </Link>
-                  </li>
-                }
-                <li
-                  className={`nav-item dropdown ${this.state
-                    .expandUserDropdown && 'show'}`}
-                >
-                  <a
-                    class="pointer nav-link dropdown-toggle"
-                    onClick={linkEvent(this, this.expandUserDropdown)}
-                    role="button"
+                <li className="nav-item">
+                  <Link class="nav-link" to="/inbox">
+                    <svg class="icon">
+                      <use xlinkHref="#icon-mail"></use>
+                    </svg>
+                    {this.state.unreadCount > 0 && (
+                      <span class="ml-1 badge badge-light">
+                        {this.state.unreadCount}
+                      </span>
+                    )}
+                  </Link>
+                </li>
+                <li className="nav-item">
+                  <Link
+                    class="nav-link"
+                    to={`/u/${UserService.Instance.user.username}`}
                   >
                     {UserService.Instance.user.username}
-                  </a>
-                  <div
-                    className={`dropdown-menu dropdown-menu-right ${this.state
-                      .expandUserDropdown && 'show'}`}
-                  >
-                    <a
-                      role="button"
-                      class="dropdown-item pointer"
-                      onClick={linkEvent(this, this.handleOverviewClick)}
-                    >
-                      <T i18nKey="overview">#</T>
-                    </a>
-                    <a
-                      role="button"
-                      class="dropdown-item pointer"
-                      onClick={linkEvent(this, this.handleLogoutClick)}
-                    >
-                      <T i18nKey="logout">#</T>
-                    </a>
-                  </div>
+                  </Link>
                 </li>
               </>
             ) : (
@@ -194,24 +166,6 @@ export class Navbar extends Component<any, NavbarState> {
     );
   }
 
-  expandUserDropdown(i: Navbar) {
-    i.state.expandUserDropdown = !i.state.expandUserDropdown;
-    i.setState(i.state);
-  }
-
-  handleLogoutClick(i: Navbar) {
-    i.state.expandUserDropdown = false;
-    UserService.Instance.logout();
-    i.context.router.history.push('/');
-  }
-
-  handleOverviewClick(i: Navbar) {
-    i.state.expandUserDropdown = false;
-    i.setState(i.state);
-    let userPage = `/u/${UserService.Instance.user.username}`;
-    i.context.router.history.push(userPage);
-  }
-
   expandNavbar(i: Navbar) {
     i.state.expanded = !i.state.expanded;
     i.setState(i.state);
-- 
cgit v1.2.3

