diff --git a/ui/src/components/communities.tsx b/ui/src/components/communities.tsx index 441f7bb14..10a3ab803 100644 --- a/ui/src/components/communities.tsx +++ b/ui/src/components/communities.tsx @@ -160,7 +160,7 @@ export class Communities extends Component { )} - {this.state.communities.length == communityLimit && ( + {this.state.communities.length > 0 && ( )} - {this.state.posts.length == fetchLimit && ( + {this.state.posts.length > 0 && ( )} - + {this.unreadCount() > 0 && ( + + )} ); } @@ -534,15 +536,19 @@ export class Inbox extends Component { } sendUnreadCount() { - let count = - this.state.replies.filter(r => !r.read).length + - this.state.mentions.filter(r => !r.read).length + - this.state.messages.filter( - r => !r.read && r.creator_id !== UserService.Instance.user.id - ).length; - UserService.Instance.user.unreadCount = count; + UserService.Instance.user.unreadCount = this.unreadCount(); UserService.Instance.sub.next({ user: UserService.Instance.user, }); } + + unreadCount(): number { + return ( + this.state.replies.filter(r => !r.read).length + + this.state.mentions.filter(r => !r.read).length + + this.state.messages.filter( + r => !r.read && r.creator_id !== UserService.Instance.user.id + ).length + ); + } } diff --git a/ui/src/components/main.tsx b/ui/src/components/main.tsx index 9e9027d63..9063a0396 100644 --- a/ui/src/components/main.tsx +++ b/ui/src/components/main.tsx @@ -497,7 +497,7 @@ export class Main extends Component { {i18n.t('prev')} )} - {this.state.posts.length == fetchLimit && ( + {this.state.posts.length > 0 && ( )} - + + {this.resultsCount() > 0 && ( + + )} ); } - noResults() { + resultsCount(): number { let res = this.state.searchResponse; return ( -
- {res && - res.posts.length == 0 && - res.comments.length == 0 && - res.communities.length == 0 && - res.users.length == 0 && {i18n.t('no_results')}} -
+ res.posts.length + + res.comments.length + + res.communities.length + + res.users.length ); } diff --git a/ui/src/components/user.tsx b/ui/src/components/user.tsx index 7e679ed1b..af72a3974 100644 --- a/ui/src/components/user.tsx +++ b/ui/src/components/user.tsx @@ -893,12 +893,14 @@ export class User extends Component { {i18n.t('prev')} )} - + {this.state.comments.length + this.state.posts.length > 0 && ( + + )} ); }