diff options
Diffstat (limited to 'ui/src/components/communities.tsx')
-rw-r--r-- | ui/src/components/communities.tsx | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/ui/src/components/communities.tsx b/ui/src/components/communities.tsx index ebcbc345..867cfd81 100644 --- a/ui/src/components/communities.tsx +++ b/ui/src/components/communities.tsx @@ -13,12 +13,14 @@ import { WebSocketJsonResponse, } from '../interfaces'; import { WebSocketService } from '../services'; -import { wsJsonToRes } from '../utils'; +import { wsJsonToRes, toast } from '../utils'; import { i18n } from '../i18next'; import { T } from 'inferno-i18next'; declare const Sortable: any; +const communityLimit = 100; + interface CommunitiesState { communities: Array<Community>; page: number; @@ -174,12 +176,14 @@ export class Communities extends Component<any, CommunitiesState> { <T i18nKey="prev">#</T> </button> )} - <button - class="btn btn-sm btn-secondary" - onClick={linkEvent(this, this.nextPage)} - > - <T i18nKey="next">#</T> - </button> + {this.state.communities.length == communityLimit && ( + <button + class="btn btn-sm btn-secondary" + onClick={linkEvent(this, this.nextPage)} + > + <T i18nKey="next">#</T> + </button> + )} </div> ); } @@ -221,7 +225,7 @@ export class Communities extends Component<any, CommunitiesState> { refetch() { let listCommunitiesForm: ListCommunitiesForm = { sort: SortType[SortType.TopAll], - limit: 100, + limit: communityLimit, page: this.state.page, }; @@ -232,7 +236,7 @@ export class Communities extends Component<any, CommunitiesState> { console.log(msg); let res = wsJsonToRes(msg); if (res.error) { - alert(i18n.t(res.error)); + toast(i18n.t(msg.error), 'danger'); return; } else if (res.op == UserOperation.ListCommunities) { let data = res.data as ListCommunitiesResponse; |