}
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];
</ul>
</div>
}
+ <Link class="btn btn-sm btn-secondary btn-block mb-3"
+ to="/create_community">Create a Community</Link>
{this.sidebar()}
</div>
}
</ul>
<div>
{community.subscribed
- ? <button class="btn btn-sm btn-secondary" onClick={linkEvent(community.id, this.handleUnsubscribe)}>Unsubscribe</button>
- : <button class="btn btn-sm btn-secondary" onClick={linkEvent(community.id, this.handleSubscribe)}>Subscribe</button>
+ ? <button class="btn btn-sm btn-secondary btn-block mb-3" onClick={linkEvent(community.id, this.handleUnsubscribe)}>Unsubscribe</button>
+ : <button class="btn btn-sm btn-secondary btn-block mb-3" onClick={linkEvent(community.id, this.handleSubscribe)}>Subscribe</button>
}
</div>
+ <Link class="btn btn-sm btn-secondary btn-block mb-3"
+ to={`/create_post/c/${community.name}`}>Create a Post</Link>
{community.description &&
<div>
<hr />
<Route path={`/home/type/:type/sort/:sort/page/:page`} component={Main} />
<Route exact path={`/`} component={Main} />
<Route path={`/login`} component={Login} />
+ <Route path={`/create_post/c/:name`} component={CreatePost} />
<Route path={`/create_post`} component={CreatePost} />
<Route path={`/create_community`} component={CreateCommunity} />
<Route path={`/communities/page/:page`} component={Communities} />