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';
|
2020-01-31 20:52:27 +00:00
|
|
|
import { i18n } from '../i18next';
|
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
|
|
|
<>
|
2020-01-31 20:52:27 +00:00
|
|
|
<h2>
|
|
|
|
{ i18n.t('no_posts') }
|
|
|
|
</h2>
|
2019-10-19 00:20:27 +00:00
|
|
|
{this.props.showCommunity !== undefined && (
|
|
|
|
<div>
|
2020-01-31 20:52:27 +00:00
|
|
|
<Link to="/communities">{ i18n.t('subscribe_to_communities') }</Link>
|
2019-10-19 00:20:27 +00:00
|
|
|
</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
|
|
|
}
|
|
|
|
}
|