2019-04-29 00:19:04 +00:00
|
|
|
import { Component } from 'inferno';
|
2019-04-05 19:14:54 +00:00
|
|
|
import { Link } from 'inferno-router';
|
2019-04-29 00:19:04 +00:00
|
|
|
import { Post } from '../interfaces';
|
2019-04-05 19:14:54 +00:00
|
|
|
import { PostListing } from './post-listing';
|
2019-08-10 00:14:43 +00:00
|
|
|
import { T } from 'inferno-i18next';
|
2019-04-05 19:14:54 +00:00
|
|
|
|
|
|
|
interface PostListingsProps {
|
|
|
|
posts: Array<Post>;
|
2019-04-29 00:19:04 +00:00
|
|
|
showCommunity?: boolean;
|
2019-04-05 19:14:54 +00:00
|
|
|
}
|
|
|
|
|
2019-04-29 00:19:04 +00:00
|
|
|
export class PostListings extends Component<PostListingsProps, any> {
|
2019-04-05 19:14:54 +00:00
|
|
|
|
2019-04-08 05:19:02 +00:00
|
|
|
constructor(props: any, context: any) {
|
2019-04-05 19:14:54 +00:00
|
|
|
super(props, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div>
|
2019-04-29 00:19:04 +00:00
|
|
|
{this.props.posts.length > 0 ? this.props.posts.map(post =>
|
2019-08-29 01:43:51 +00:00
|
|
|
<>
|
|
|
|
<PostListing post={post} showCommunity={this.props.showCommunity} />
|
2019-08-29 23:46:09 +00:00
|
|
|
<hr class="d-md-none my-2" />
|
|
|
|
<div class="d-none d-md-block my-3"></div>
|
2019-08-29 01:43:51 +00:00
|
|
|
</>
|
|
|
|
) :
|
2019-08-10 00:14:43 +00:00
|
|
|
<>
|
|
|
|
<div><T i18nKey="no_posts">#</T></div>
|
|
|
|
{this.props.showCommunity !== undefined && <div><T i18nKey="subscribe_to_communities">#<Link to="/communities">#</Link></T></div>}
|
|
|
|
</>
|
2019-04-05 19:14:54 +00:00
|
|
|
}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|