summaryrefslogtreecommitdiffstats
path: root/ui/src/components/navbar.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2019-10-29 20:35:39 -0700
committerDessalines <tyhou13@gmx.com>2019-10-29 20:35:39 -0700
commit9f35b33dc7238f0d6748beafa79ca0af192b5ca6 (patch)
tree9199b38cc553822d2e43eed2f5d3d7975d2b702a /ui/src/components/navbar.tsx
parent198b5f10dd18244744b6d82b93155a5c5b569bb9 (diff)
Halfway done with email, not fully working yet.
Diffstat (limited to 'ui/src/components/navbar.tsx')
-rw-r--r--ui/src/components/navbar.tsx80
1 files changed, 17 insertions, 63 deletions
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);