parent
780817840f
commit
73a129a24d
4 changed files with 10 additions and 3 deletions
|
@ -26,7 +26,9 @@ export class CreatePost extends Component<any, any> {
|
||||||
}
|
}
|
||||||
|
|
||||||
get prevCommunityName(): string {
|
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;
|
let lastLocation = this.props.location.state.prevPath;
|
||||||
if (lastLocation.includes("/c/")) {
|
if (lastLocation.includes("/c/")) {
|
||||||
return lastLocation.split("/c/")[1];
|
return lastLocation.split("/c/")[1];
|
||||||
|
|
|
@ -136,6 +136,8 @@ export class Main extends Component<any, MainState> {
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
<Link class="btn btn-sm btn-secondary btn-block mb-3"
|
||||||
|
to="/create_community">Create a Community</Link>
|
||||||
{this.sidebar()}
|
{this.sidebar()}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,10 +117,12 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
|
||||||
</ul>
|
</ul>
|
||||||
<div>
|
<div>
|
||||||
{community.subscribed
|
{community.subscribed
|
||||||
? <button class="btn btn-sm btn-secondary" onClick={linkEvent(community.id, this.handleUnsubscribe)}>Unsubscribe</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" onClick={linkEvent(community.id, this.handleSubscribe)}>Subscribe</button>
|
: <button class="btn btn-sm btn-secondary btn-block mb-3" onClick={linkEvent(community.id, this.handleSubscribe)}>Subscribe</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
<Link class="btn btn-sm btn-secondary btn-block mb-3"
|
||||||
|
to={`/create_post/c/${community.name}`}>Create a Post</Link>
|
||||||
{community.description &&
|
{community.description &&
|
||||||
<div>
|
<div>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
|
@ -41,6 +41,7 @@ class Index extends Component<any, any> {
|
||||||
<Route path={`/home/type/:type/sort/:sort/page/:page`} component={Main} />
|
<Route path={`/home/type/:type/sort/:sort/page/:page`} component={Main} />
|
||||||
<Route exact path={`/`} component={Main} />
|
<Route exact path={`/`} component={Main} />
|
||||||
<Route path={`/login`} component={Login} />
|
<Route path={`/login`} component={Login} />
|
||||||
|
<Route path={`/create_post/c/:name`} component={CreatePost} />
|
||||||
<Route path={`/create_post`} component={CreatePost} />
|
<Route path={`/create_post`} component={CreatePost} />
|
||||||
<Route path={`/create_community`} component={CreateCommunity} />
|
<Route path={`/create_community`} component={CreateCommunity} />
|
||||||
<Route path={`/communities/page/:page`} component={Communities} />
|
<Route path={`/communities/page/:page`} component={Communities} />
|
||||||
|
|
Loading…
Reference in a new issue