diff options
author | Dessalines <tyhou13@gmx.com> | 2019-04-04 13:53:32 -0700 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2019-04-04 13:53:32 -0700 |
commit | f3cbe9e6cee4a03d8677414ae29b81a59d31b71c (patch) | |
tree | e55c24133e335fd55be926e49d4d500fc019e93b /ui/src/components/sidebar.tsx | |
parent | d07a1b4563b829232040c9b1156a6598f493f469 (diff) |
Getting community moderators
- Getting back mods with a fetch. Fixes #28
Diffstat (limited to 'ui/src/components/sidebar.tsx')
-rw-r--r-- | ui/src/components/sidebar.tsx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/ui/src/components/sidebar.tsx b/ui/src/components/sidebar.tsx index c8e80de6..e8a2f410 100644 --- a/ui/src/components/sidebar.tsx +++ b/ui/src/components/sidebar.tsx @@ -1,9 +1,11 @@ import { Component, linkEvent } from 'inferno'; -import { Community } from '../interfaces'; +import { Link } from 'inferno-router'; +import { Community, CommunityUser } from '../interfaces'; import { mdToHtml } from '../utils'; interface SidebarProps { community: Community; + moderators: Array<CommunityUser>; } interface SidebarState { @@ -22,14 +24,23 @@ export class Sidebar extends Component<SidebarProps, SidebarState> { <div> <h4>{community.title}</h4> <ul class="list-inline"> - <li className="list-inline-item badge badge-light">{community.category_name}</li> + <li className="list-inline-item"><Link className="badge badge-light" to="/communities">{community.category_name}</Link></li> <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> <div><button type="button" class="btn btn-secondary mb-2">Subscribe</button></div> + {community.description && + <div> + <hr /> + <div className="md-div" dangerouslySetInnerHTML={mdToHtml(community.description)} /> + </div> + } <hr /> - {community.description && <div className="md-div" dangerouslySetInnerHTML={mdToHtml(community.description)} />} + <h5>Moderators</h5> + {this.props.moderators.map(mod => + <Link to={`/user/${mod.user_id}`}>{mod.user_name}</Link> + )} </div> ); } |