mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-27 11:51:08 +00:00
parent
d222c60cef
commit
85c07e7154
6 changed files with 45 additions and 37 deletions
2
ui/src/components/communities.tsx
vendored
2
ui/src/components/communities.tsx
vendored
|
@ -160,7 +160,7 @@ export class Communities extends Component<any, CommunitiesState> {
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{this.state.communities.length == communityLimit && (
|
{this.state.communities.length > 0 && (
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-secondary"
|
class="btn btn-sm btn-secondary"
|
||||||
onClick={linkEvent(this, this.nextPage)}
|
onClick={linkEvent(this, this.nextPage)}
|
||||||
|
|
2
ui/src/components/community.tsx
vendored
2
ui/src/components/community.tsx
vendored
|
@ -260,7 +260,7 @@ export class Community extends Component<any, State> {
|
||||||
{i18n.t('prev')}
|
{i18n.t('prev')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{this.state.posts.length == fetchLimit && (
|
{this.state.posts.length > 0 && (
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-secondary"
|
class="btn btn-sm btn-secondary"
|
||||||
onClick={linkEvent(this, this.nextPage)}
|
onClick={linkEvent(this, this.nextPage)}
|
||||||
|
|
20
ui/src/components/inbox.tsx
vendored
20
ui/src/components/inbox.tsx
vendored
|
@ -329,12 +329,14 @@ export class Inbox extends Component<any, InboxState> {
|
||||||
{i18n.t('prev')}
|
{i18n.t('prev')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
{this.unreadCount() > 0 && (
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-secondary"
|
class="btn btn-sm btn-secondary"
|
||||||
onClick={linkEvent(this, this.nextPage)}
|
onClick={linkEvent(this, this.nextPage)}
|
||||||
>
|
>
|
||||||
{i18n.t('next')}
|
{i18n.t('next')}
|
||||||
</button>
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -534,15 +536,19 @@ export class Inbox extends Component<any, InboxState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
sendUnreadCount() {
|
sendUnreadCount() {
|
||||||
let count =
|
UserService.Instance.user.unreadCount = this.unreadCount();
|
||||||
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.sub.next({
|
UserService.Instance.sub.next({
|
||||||
user: UserService.Instance.user,
|
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
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
2
ui/src/components/main.tsx
vendored
2
ui/src/components/main.tsx
vendored
|
@ -497,7 +497,7 @@ export class Main extends Component<any, MainState> {
|
||||||
{i18n.t('prev')}
|
{i18n.t('prev')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{this.state.posts.length == fetchLimit && (
|
{this.state.posts.length > 0 && (
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-secondary"
|
class="btn btn-sm btn-secondary"
|
||||||
onClick={linkEvent(this, this.nextPage)}
|
onClick={linkEvent(this, this.nextPage)}
|
||||||
|
|
18
ui/src/components/search.tsx
vendored
18
ui/src/components/search.tsx
vendored
|
@ -148,7 +148,7 @@ export class Search extends Component<any, SearchState> {
|
||||||
{this.state.type_ == SearchType.Posts && this.posts()}
|
{this.state.type_ == SearchType.Posts && this.posts()}
|
||||||
{this.state.type_ == SearchType.Communities && this.communities()}
|
{this.state.type_ == SearchType.Communities && this.communities()}
|
||||||
{this.state.type_ == SearchType.Users && this.users()}
|
{this.state.type_ == SearchType.Users && this.users()}
|
||||||
{this.noResults()}
|
{this.resultsCount() == 0 && <span>{i18n.t('no_results')}</span>}
|
||||||
{this.paginator()}
|
{this.paginator()}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -383,26 +383,26 @@ export class Search extends Component<any, SearchState> {
|
||||||
{i18n.t('prev')}
|
{i18n.t('prev')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{this.resultsCount() > 0 && (
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-secondary"
|
class="btn btn-sm btn-secondary"
|
||||||
onClick={linkEvent(this, this.nextPage)}
|
onClick={linkEvent(this, this.nextPage)}
|
||||||
>
|
>
|
||||||
{i18n.t('next')}
|
{i18n.t('next')}
|
||||||
</button>
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
noResults() {
|
resultsCount(): number {
|
||||||
let res = this.state.searchResponse;
|
let res = this.state.searchResponse;
|
||||||
return (
|
return (
|
||||||
<div>
|
res.posts.length +
|
||||||
{res &&
|
res.comments.length +
|
||||||
res.posts.length == 0 &&
|
res.communities.length +
|
||||||
res.comments.length == 0 &&
|
res.users.length
|
||||||
res.communities.length == 0 &&
|
|
||||||
res.users.length == 0 && <span>{i18n.t('no_results')}</span>}
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
ui/src/components/user.tsx
vendored
2
ui/src/components/user.tsx
vendored
|
@ -893,12 +893,14 @@ export class User extends Component<any, UserState> {
|
||||||
{i18n.t('prev')}
|
{i18n.t('prev')}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
{this.state.comments.length + this.state.posts.length > 0 && (
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-secondary"
|
class="btn btn-sm btn-secondary"
|
||||||
onClick={linkEvent(this, this.nextPage)}
|
onClick={linkEvent(this, this.nextPage)}
|
||||||
>
|
>
|
||||||
{i18n.t('next')}
|
{i18n.t('next')}
|
||||||
</button>
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue