summaryrefslogtreecommitdiffstats
path: root/ui/src/components/navbar.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2019-04-29 09:07:41 -0700
committerDessalines <tyhou13@gmx.com>2019-04-29 09:07:41 -0700
commitfe89bc2a42b12d4f483bb3d720c8447de4d97f65 (patch)
treee4ed8480c6bc490e847e1f2a6d0282ea8958fc3f /ui/src/components/navbar.tsx
parent50dfcefc9564baa896de8b3f1efbcc61de7054f3 (diff)
Auto-select current community if creating a post from the community
page. Fixes #133
Diffstat (limited to 'ui/src/components/navbar.tsx')
-rw-r--r--ui/src/components/navbar.tsx6
1 files changed, 5 insertions, 1 deletions
diff --git a/ui/src/components/navbar.tsx b/ui/src/components/navbar.tsx
index 31dab61b..ee19e5c5 100644
--- a/ui/src/components/navbar.tsx
+++ b/ui/src/components/navbar.tsx
@@ -79,7 +79,7 @@ export class Navbar extends Component<any, NavbarState> {
<Link class="nav-link" to="/search">Search</Link>
</li>
<li class="nav-item">
- <Link class="nav-link" to="/create_post">Create Post</Link>
+ <Link class="nav-link" to={{pathname: '/create_post', state: { prevPath: this.currentLocation }}}>Create Post</Link>
</li>
<li class="nav-item">
<Link class="nav-link" to="/create_community">Create Community</Link>
@@ -165,6 +165,10 @@ export class Navbar extends Component<any, NavbarState> {
}
}
+ get currentLocation() {
+ return this.context.router.history.location.pathname;
+ }
+
sendRepliesCount(res: GetRepliesResponse) {
UserService.Instance.sub.next({user: UserService.Instance.user, unreadCount: res.replies.filter(r => !r.read).length});
}