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-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-10-19 00:20:27 +00:00
|
|
|
{this.props.posts.length > 0 ? (
|
|
|
|
this.props.posts.map(post => (
|
|
|
|
<>
|
|
|
|
<PostListing
|
|
|
|
post={post}
|
|
|
|
showCommunity={this.props.showCommunity}
|
|
|
|
/>
|
|
|
|
<hr class="d-md-none my-2" />
|
|
|
|
<div class="d-none d-md-block my-2"></div>
|
|
|
|
</>
|
|
|
|
))
|
|
|
|
) : (
|
2019-08-10 00:14:43 +00:00
|
|
|
<>
|
2019-10-19 00:20:27 +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-08-10 00:14:43 +00:00
|
|
|
</>
|
2019-10-19 00:20:27 +00:00
|
|
|
)}
|
2019-04-05 19:14:54 +00:00
|
|
|
</div>
|
2019-10-19 00:20:27 +00:00
|
|
|
);
|
2019-04-05 19:14:54 +00:00
|
|
|
}
|
|
|
|
}
|