From 73a129a24d846b387357336bec7b5c8b09c5a6ba Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 8 May 2019 09:07:34 -0700 Subject: [PATCH] Adding create community and post buttons from sidebar. - Fixes #148 --- ui/src/components/create-post.tsx | 4 +++- ui/src/components/main.tsx | 2 ++ ui/src/components/sidebar.tsx | 6 ++++-- ui/src/index.tsx | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ui/src/components/create-post.tsx b/ui/src/components/create-post.tsx index 1958be72..fdee01f6 100644 --- a/ui/src/components/create-post.tsx +++ b/ui/src/components/create-post.tsx @@ -26,7 +26,9 @@ export class CreatePost extends Component { } get prevCommunityName(): string { - if (this.props.location.state) { + if (this.props.match.params.name) { + return this.props.match.params.name; + } else if (this.props.location.state) { let lastLocation = this.props.location.state.prevPath; if (lastLocation.includes("/c/")) { return lastLocation.split("/c/")[1]; diff --git a/ui/src/components/main.tsx b/ui/src/components/main.tsx index 1ec016ea..ac43b1d9 100644 --- a/ui/src/components/main.tsx +++ b/ui/src/components/main.tsx @@ -136,6 +136,8 @@ export class Main extends Component { } + Create a Community {this.sidebar()} } diff --git a/ui/src/components/sidebar.tsx b/ui/src/components/sidebar.tsx index d14ad68c..8d1459d5 100644 --- a/ui/src/components/sidebar.tsx +++ b/ui/src/components/sidebar.tsx @@ -117,10 +117,12 @@ export class Sidebar extends Component {
{community.subscribed - ? - : + ? + : }
+ Create a Post {community.description &&

diff --git a/ui/src/index.tsx b/ui/src/index.tsx index b744ac7d..04160a9f 100644 --- a/ui/src/index.tsx +++ b/ui/src/index.tsx @@ -41,6 +41,7 @@ class Index extends Component { + -- 2.44.1