2019-04-03 23:01:20 +00:00
|
|
|
import { Component, linkEvent } from 'inferno';
|
2019-04-04 20:53:32 +00:00
|
|
|
import { Link } from 'inferno-router';
|
|
|
|
import { Community, CommunityUser } from '../interfaces';
|
2019-04-03 23:01:20 +00:00
|
|
|
import { mdToHtml } from '../utils';
|
|
|
|
|
|
|
|
interface SidebarProps {
|
|
|
|
community: Community;
|
2019-04-04 20:53:32 +00:00
|
|
|
moderators: Array<CommunityUser>;
|
2019-04-03 23:01:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface SidebarState {
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Sidebar extends Component<SidebarProps, SidebarState> {
|
|
|
|
|
|
|
|
constructor(props, context) {
|
|
|
|
super(props, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
let community = this.props.community;
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<h4>{community.title}</h4>
|
2019-04-04 20:00:19 +00:00
|
|
|
<ul class="list-inline">
|
2019-04-04 20:53:32 +00:00
|
|
|
<li className="list-inline-item"><Link className="badge badge-light" to="/communities">{community.category_name}</Link></li>
|
2019-04-04 20:00:19 +00:00
|
|
|
<li className="list-inline-item badge badge-light">{community.number_of_subscribers} Subscribers</li>
|
|
|
|
<li className="list-inline-item badge badge-light">{community.number_of_posts} Posts</li>
|
|
|
|
<li className="list-inline-item badge badge-light">{community.number_of_comments} Comments</li>
|
|
|
|
</ul>
|
2019-04-03 23:01:20 +00:00
|
|
|
<div><button type="button" class="btn btn-secondary mb-2">Subscribe</button></div>
|
2019-04-04 20:53:32 +00:00
|
|
|
{community.description &&
|
|
|
|
<div>
|
|
|
|
<hr />
|
|
|
|
<div className="md-div" dangerouslySetInnerHTML={mdToHtml(community.description)} />
|
|
|
|
</div>
|
|
|
|
}
|
2019-04-03 23:01:20 +00:00
|
|
|
<hr />
|
2019-04-04 20:53:32 +00:00
|
|
|
<h5>Moderators</h5>
|
|
|
|
{this.props.moderators.map(mod =>
|
|
|
|
<Link to={`/user/${mod.user_id}`}>{mod.user_name}</Link>
|
|
|
|
)}
|
2019-04-03 23:01:20 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|