From: Dessalines Date: Wed, 8 May 2019 16:07:34 +0000 (-0700) Subject: Adding create community and post buttons from sidebar. X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/readmes/%7B%7D/static/%7Bthis.props.icon%7D?a=commitdiff_plain;h=73a129a24d846b387357336bec7b5c8b09c5a6ba;p=lemmy.git Adding create community and post buttons from sidebar. - Fixes #148 --- 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 { +